/* =============================================================================
 * Portal-style profile discovery workspace.
 * Architecture donor: SHARED_PORTAL/frontend/css/portal-browse.css.
 * IndianMarriage adaptation: portrait cards, relationship actions, brand tokens,
 * same-origin dashboard embedding, and the canonical profile detail contract.
 * ========================================================================== */

/* ---------------------------------------------------------------------------
 * SHARED_PORTAL → IndianMarriage token compatibility shim.
 * The donor stylesheets (this file + matching-section.css) reference the
 * portal's token names (--text-primary, --border-color, --color-error, …),
 * which IM's tokens.css does NOT define. Every reference therefore fell
 * through to its hard-coded LIGHT fallback and never flipped in dark mode —
 * dark background + dark text = invisible copy (the reported bug).
 * Re-map each portal name onto IM's canonical semantic token, which DOES
 * re-bind under .dark / [data-theme="dark"] / prefers-color-scheme. Custom
 * properties inherit, so every descendant of body.ds-page — including the
 * .mx-* cards, chips and the Saved-searches drawer mounted on <body> — picks
 * these up. Light mode is unchanged (canonical light values == old fallbacks);
 * dark mode now resolves correctly.
 * ------------------------------------------------------------------------- */
body.ds-page {
  --text-primary: var(--color-text-primary, #0f172a);
  --text-secondary: var(--color-text-secondary, #475569);
  --text-muted: var(--color-text-muted, #94a3b8);
  --border-color: var(--color-border-primary, #cbd5e1);
  --color-error: var(--color-danger, #dc2626);
}

body.ds-page {
  margin: 0;
  overflow: hidden;
  background: var(--color-bg-secondary, #f4f6fb);
  color: var(--text-primary, #0f172a);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.ds-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  height: calc(100vh - var(--app-header-offset, 4rem));
  margin: 0;
  padding: 0;
  min-height: 34rem;
  overflow: hidden;
  background: var(--color-bg-secondary, #f4f6fb);
}

html.page-mode-embedded .ds-shell { height: 100vh; }

.ds-toolbar {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-height: 3.25rem;
  padding: 0.5rem 1rem;
  background: var(--color-bg-primary, #fff);
  border-bottom: 0.0625rem solid var(--border-color, #e3e8ef);
}

.ds-toolbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.05rem;
  font-weight: 750;
  white-space: nowrap;
}

.ds-toolbar__brand i { color: var(--love-pink, #ec4899); }
.ds-toolbar__tag {
  display: inline-flex;
  align-items: center;
  min-height: 1.75rem;
  padding: 0.2rem 0.625rem;
  border-radius: var(--radius-full, 9999px);
  color: var(--marriage-gold-700, #9a6700);
  background: var(--marriage-gold-100, #fef3c7);
  font-size: 0.72rem;
  font-weight: 700;
}

.ds-toolbar__spacer { flex: 1; }

.ds-icon-button,
.ds-toolbar-button {
  min-height: 2.75rem;
  border: 0.0625rem solid var(--border-color, #cbd5e1);
  border-radius: var(--radius-lg, 0.5rem);
  background: var(--color-bg-secondary, #f8fafc);
  color: var(--text-secondary, #64748b);
  cursor: pointer;
}

.ds-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
}

.ds-toolbar-button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0 0.85rem;
  font-size: 0.8rem;
  font-weight: 650;
}

.ds-icon-button:hover,
.ds-toolbar-button:hover {
  color: var(--text-primary, #0f172a);
  border-color: var(--marriage-gold-700, #b8860b);
}

.ds-searchbar {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 1rem;
  background: var(--color-bg-secondary, #f8fafc);
  border-bottom: 0.0625rem solid var(--border-color, #e3e8ef);
}

.ds-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 20rem;
  min-width: 12rem;
}

.ds-search > i {
  position: absolute;
  left: 0.8rem;
  color: var(--text-muted, #94a3b8);
  pointer-events: none;
}

.ds-search input,
.ds-sort {
  min-height: 2.75rem;
  border: 0.0625rem solid var(--border-color, #cbd5e1);
  border-radius: var(--radius-lg, 0.5rem);
  background: var(--color-bg-primary, #fff);
  color: var(--text-primary, #0f172a);
  font-size: 0.875rem;
}

.ds-search input {
  width: 100%;
  padding: 0 0.875rem 0 2.4rem;
}

.ds-search input:focus,
.ds-sort:focus {
  outline: none;
  border-color: var(--love-pink, #ec4899);
  box-shadow: 0 0 0 0.1875rem rgba(236, 72, 153, 0.16);
}

.ds-search input::placeholder { color: var(--text-muted, #94a3b8); opacity: 1; }

.ds-sort {
  flex: 0 0 12rem;
  padding: 0 0.75rem;
}

.ds-crumbbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.45rem 1rem;
  background: var(--color-bg-primary, #fff);
  border-bottom: 0.0625rem solid var(--border-color, #e3e8ef);
}

.ds-crumbbar__icon { color: var(--text-muted, #94a3b8); }
.ds-tokens-wrap {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.ds-tokens-wrap:empty::after {
  content: "All discoverable profiles";
  color: var(--text-muted, #94a3b8);
  font-size: 0.8rem;
  font-style: italic;
}

.ds-tokens-wrap .mx-tokens { width: 100%; }

.ds-workspace {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr) 24rem;
  flex: 1;
  min-height: 0;
}

@media (min-width: 68.01rem) {
  .ds-workspace:has(> .ds-filter-pane.is-collapsed) {
    grid-template-columns: 0 minmax(0, 1fr) 24rem;
  }
  .ds-workspace:has(> .ds-detail-pane.is-collapsed) {
    grid-template-columns: 15rem minmax(0, 1fr) 0;
  }
  .ds-workspace:has(> .ds-filter-pane.is-collapsed):has(> .ds-detail-pane.is-collapsed) {
    grid-template-columns: 0 minmax(0, 1fr) 0;
  }
}

.ds-filter-pane,
.ds-detail-pane {
  min-width: 0;
  background: var(--color-bg-primary, #fff);
}

.ds-filter-pane {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  border-right: 0.0625rem solid var(--border-color, #e3e8ef);
}

.ds-pane-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 3.25rem;
  padding: 0.625rem 0.75rem 0.625rem 1rem;
  background: var(--color-bg-primary, #fff);
  border-bottom: 0.0625rem solid var(--border-color, #e3e8ef);
  color: var(--text-secondary, #64748b);
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.ds-pane-head__spacer { flex: 1; }
.ds-pane-head .ds-icon-button {
  width: 2.25rem;
  min-height: 2.25rem;
}

.ds-quick-section,
.ds-facet-rail { padding: 0.75rem; }
.ds-quick-section { border-bottom: 0.0625rem solid var(--border-color, #e3e8ef); }
.ds-facet-rail { padding-bottom: 1.5rem; }

.ds-facet-title {
  margin: 0 0 0.4rem 0.3rem;
  color: var(--text-muted, #94a3b8);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.ds-quick-section .mx-chiprow {
  flex-direction: column;
  align-items: stretch;
  gap: 0.25rem;
}

.ds-quick-section .mx-chip {
  justify-content: flex-start;
  width: 100%;
  min-height: 2.5rem;
  border-color: transparent;
  background: transparent;
}

.ds-quick-section .mx-chip:hover { background: var(--color-bg-secondary, #f8fafc); }

.ds-facet-group { margin-bottom: 1rem; }
.ds-facet-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 2.5rem;
  padding: 0.3rem 0.55rem;
  border: 0;
  border-radius: var(--radius-md, 0.375rem);
  background: transparent;
  color: var(--text-primary, #0f172a);
  cursor: pointer;
  text-align: left;
}

.ds-facet-option:hover { background: var(--color-bg-secondary, #f8fafc); }
.ds-facet-option.is-active {
  background: var(--marriage-gold-100, #fef3c7);
  color: var(--marriage-gold-700, #9a6700);
  font-weight: 650;
}

.ds-facet-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 1.1rem;
  width: 1.1rem;
  height: 1.1rem;
  border: 0.0625rem solid var(--border-color, #cbd5e1);
  border-radius: 0.3rem;
  color: transparent;
  font-size: 0.65rem;
}

.ds-facet-option.is-active .ds-facet-check {
  border-color: var(--love-pink, #ec4899);
  background: var(--love-pink, #ec4899);
  color: #fff;
}

.ds-facet-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
}

.ds-facet-count {
  color: var(--text-muted, #94a3b8);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.ds-facet-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2rem 0.75rem;
  color: var(--text-muted, #94a3b8);
  font-size: 0.8rem;
  text-align: center;
}

.ds-master-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--color-bg-secondary, #f4f6fb);
}

.ds-master-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3.25rem;
  padding: 0.5rem 1rem;
  background: var(--color-bg-primary, #fff);
  border-bottom: 0.0625rem solid var(--border-color, #e3e8ef);
  flex-wrap: wrap;
}

.ds-resultcount {
  margin: 0;
  color: var(--text-secondary, #64748b);
  font-size: 0.8rem;
}

.ds-resultcount strong {
  color: var(--text-primary, #0f172a);
  font-size: 1rem;
}

.ds-save-button {
  min-height: 2.25rem;
  margin-left: auto;
  padding: 0 0.75rem;
  border: 0.0625rem solid var(--border-color, #cbd5e1);
  border-radius: var(--radius-md, 0.375rem);
  background: transparent;
  color: var(--text-secondary, #64748b);
  font-size: 0.76rem;
  font-weight: 650;
  cursor: pointer;
}

.ds-save-button:hover { color: var(--love-pink, #ec4899); border-color: currentColor; }

.ds-view-switcher {
  display: inline-flex;
  gap: 0.2rem;
  padding: 0.2rem;
  border: 0.0625rem solid var(--border-color, #e3e8ef);
  border-radius: var(--radius-md, 0.375rem);
  background: var(--color-bg-secondary, #f8fafc);
}

.ds-view-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.2rem;
  padding: 0 0.65rem;
  border: 0;
  border-radius: var(--radius-sm, 0.25rem);
  background: transparent;
  color: var(--text-secondary, #64748b);
  font-size: 0.74rem;
  font-weight: 650;
  cursor: pointer;
}

.ds-view-button:hover { color: var(--text-primary, #0f172a); }
.ds-view-button.is-active {
  background: var(--color-bg-primary, #fff);
  color: var(--love-pink, #ec4899);
  box-shadow: 0 0.0625rem 0.1875rem rgba(15, 23, 42, 0.12);
}

.ds-master-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem;
}

.ds-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 1rem;
}

.ds-results-grid .mx-card {
  cursor: pointer;
  border-color: var(--border-color, #e3e8ef);
}

.ds-results-grid .mx-card__media { aspect-ratio: 4 / 5; }
.ds-results-grid .mx-card.is-selected {
  border-color: var(--love-pink, #ec4899);
  box-shadow: 0 0 0 0.125rem var(--love-pink, #ec4899);
}

.ds-results-list { min-width: 44rem; }
.ds-list__header,
.ds-list__row {
  display: grid;
  grid-template-columns: minmax(13rem, 2fr) 3rem minmax(6rem, 1fr) minmax(6rem, 1fr) minmax(7rem, 1fr) 5rem;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.6rem;
}

.ds-list__header {
  position: sticky;
  top: -1rem;
  z-index: 1;
  border-radius: var(--radius-sm, 0.25rem);
  background: var(--color-bg-primary, #fff);
  color: var(--text-muted, #94a3b8);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.ds-list__row {
  min-height: 4.25rem;
  border: 0.0625rem solid transparent;
  border-radius: var(--radius-md, 0.375rem);
  cursor: pointer;
}

.ds-list__row:hover { background: var(--color-bg-primary, #fff); }
.ds-list__row.is-selected {
  border-color: var(--love-pink, #ec4899);
  background: var(--color-bg-primary, #fff);
}

.ds-list__cell {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
}

.ds-list__identity { display: flex; align-items: center; gap: 0.65rem; min-width: 0; }
.ds-list__identity-copy { display: flex; flex-direction: column; min-width: 0; }
.ds-list__name,
.ds-list__occupation { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-list__occupation { color: var(--text-secondary, #64748b); }

.ds-results-brief { display: flex; flex-direction: column; gap: 0.45rem; }
.ds-brief {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 0.7rem 0.75rem;
  border: 0.0625rem solid transparent;
  border-radius: var(--radius-md, 0.375rem);
  background: var(--color-bg-primary, #fff);
  cursor: pointer;
}

.ds-brief:hover { border-color: var(--border-color, #cbd5e1); }
.ds-brief.is-selected { border-color: var(--love-pink, #ec4899); }
.ds-brief__body { flex: 1; min-width: 0; }
.ds-brief__title-row,
.ds-brief__facts { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem; }
.ds-brief__name { margin-right: 0.25rem; font-size: 0.92rem; }
.ds-brief__subtitle { margin: 0.25rem 0 0.45rem; color: var(--text-secondary, #64748b); font-size: 0.78rem; }
.ds-brief__tick {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 1.75rem;
  padding: 0.15rem 0.5rem;
  border: 0.0625rem solid var(--border-color, #e3e8ef);
  border-radius: var(--radius-full, 9999px);
  background: var(--color-bg-secondary, #f8fafc);
  color: var(--text-secondary, #64748b);
  font-size: 0.72rem;
}

.ds-results-mini {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
  gap: 0.625rem;
}

.ds-mini {
  position: relative;
  overflow: hidden;
  border: 0.0625rem solid var(--border-color, #e3e8ef);
  border-radius: var(--radius-md, 0.375rem);
  background: var(--color-bg-primary, #fff);
  cursor: pointer;
}

.ds-mini:hover { border-color: var(--marriage-gold-700, #b8860b); }
.ds-mini.is-selected { border-color: var(--love-pink, #ec4899); box-shadow: 0 0 0 0.125rem var(--love-pink, #ec4899); }
.ds-mini__name,
.ds-mini__meta { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 0.45rem; }
.ds-mini__name { padding-top: 0.4rem; font-size: 0.73rem; }
.ds-mini__meta { padding-bottom: 0.45rem; color: var(--text-secondary, #64748b); font-size: 0.68rem; }
.ds-mini__verified { position: absolute; top: 0.4rem; right: 0.4rem; color: var(--color-success, #16a34a); text-shadow: 0 0.0625rem 0.1875rem #fff; }

.ds-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  overflow: hidden;
  background: linear-gradient(145deg, var(--marriage-gold-100, #fef3c7), rgba(236, 72, 153, 0.14));
  color: var(--marriage-gold-700, #9a6700);
}

.ds-photo__img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ds-photo__initials { font-size: 1.25rem; font-weight: 800; letter-spacing: 0.03em; }
.ds-photo--list { width: 3rem; height: 3rem; border-radius: var(--radius-md, 0.375rem); }
.ds-photo--brief { width: 4.5rem; height: 5.625rem; border-radius: var(--radius-md, 0.375rem); }
.ds-photo--mini { width: 100%; aspect-ratio: 4 / 5; }
.ds-photo--detail { width: 100%; aspect-ratio: 4 / 5; border-radius: var(--radius-lg, 0.5rem); }

.ds-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.35rem;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full, 9999px);
  background: var(--color-bg-secondary, #f1f5f9);
  color: var(--text-secondary, #64748b);
  font-size: 0.66rem;
  font-weight: 700;
}

.ds-badge--verified { background: rgba(22, 163, 74, 0.14); color: var(--color-success, #15803d); }
.ds-badge--premium { background: rgba(236, 72, 153, 0.14); color: var(--love-pink-700, #be185d); }
.ds-badge--trust { background: var(--marriage-gold-100, #fef3c7); color: var(--marriage-gold-700, #9a6700); }

.ds-detail-pane {
  display: flex;
  flex-direction: column;
  border-left: 0.0625rem solid var(--border-color, #e3e8ef);
}

.ds-detail-pane.is-collapsed,
.ds-filter-pane.is-collapsed { display: none; }

.ds-detail-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem;
}

.ds-detail__name { margin: 0.85rem 0 0.25rem; font-size: 1.3rem; line-height: 1.2; }
.ds-detail__subtitle { margin: 0; color: var(--text-secondary, #64748b); font-size: 0.82rem; line-height: 1.5; }
.ds-detail__badges { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.65rem; }
.ds-detail__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.9rem 0 1rem; }
.ds-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  padding: 0 0.8rem;
  border: 0.0625rem solid var(--border-color, #cbd5e1);
  border-radius: var(--radius-md, 0.375rem);
  background: var(--color-bg-secondary, #f8fafc);
  color: var(--text-primary, #0f172a);
  font-size: 0.76rem;
  font-weight: 650;
  cursor: pointer;
}

.ds-action--primary { border-color: var(--love-pink, #ec4899); background: var(--love-pink, #ec4899); color: #fff; }
.ds-action:hover { filter: brightness(1.04); }
.ds-detail__section { padding: 0.75rem 0 0.9rem; border-top: 0.0625rem solid var(--border-color, #e3e8ef); }
.ds-detail__section-title { margin: 0 0 0.65rem; font-size: 0.86rem; }
.ds-detail__facts { display: grid; grid-template-columns: minmax(6rem, max-content) 1fr; gap: 0.4rem 0.85rem; margin: 0; }
.ds-detail__facts dt { color: var(--text-muted, #94a3b8); font-size: 0.76rem; }
.ds-detail__facts dd { margin: 0; font-size: 0.82rem; }
.ds-detail__prose { margin: 0; font-size: 0.82rem; line-height: 1.55; }
.ds-detail__gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.45rem; }
.ds-detail__gallery-image { width: 100%; aspect-ratio: 4 / 5; border-radius: var(--radius-sm, 0.25rem); object-fit: cover; }
.ds-detail__loading,
.ds-detail__empty { color: var(--text-muted, #94a3b8); font-size: 0.78rem; line-height: 1.5; }
.ds-detail__empty { display: grid; place-items: center; min-height: 12rem; text-align: center; }

.ds-master-pane .pagination {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.55rem 1rem;
  border-top: 0.0625rem solid var(--border-color, #e3e8ef);
  background: var(--color-bg-primary, #fff);
}

/* Advanced-filter drawer and saved-search drawer content. */
.ds-field { display: flex; flex-direction: column; gap: 0.25rem; }
.ds-field__label {
  color: var(--text-primary, #1f2937);
  font-size: 0.8125rem;
  font-weight: 600;
}

.ds-field input,
.ds-field select {
  padding: 0.4375rem 0.625rem;
  border: 0.0625rem solid var(--border-color, #e5e7eb);
  border-radius: var(--radius-md, 0.375rem);
  background: var(--color-bg-primary, #fff);
  color: var(--text-primary, #1f2937);
  font-size: 0.8125rem;
}

.ds-field--row { flex-direction: row; gap: 0.5rem; }
.ds-field--row input { flex: 1 1 0; min-width: 0; }
.ds-checks { display: flex; flex-direction: column; gap: 0.375rem; }
.ds-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary, #6b7280);
  font-size: 0.8125rem;
}

.ds-saved { display: flex; flex-direction: column; gap: 0.5rem; }
.ds-saved__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: 0.0625rem solid var(--border-color, #e5e7eb);
  border-radius: var(--radius-lg, 0.5rem);
  background: var(--color-bg-primary, #fff);
}

.ds-saved__meta { display: flex; flex-direction: column; gap: 0.125rem; min-width: 0; }
.ds-saved__name { color: var(--text-primary, #1f2937); font-size: 0.875rem; font-weight: 600; }
.ds-saved__sub { color: var(--text-secondary, #6b7280); font-size: 0.75rem; }
.ds-saved__actions { display: flex; flex-shrink: 0; gap: 0.375rem; }
.ds-iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 0.0625rem solid var(--border-color, #e5e7eb);
  border-radius: var(--radius-md, 0.375rem);
  background: var(--color-bg-primary, #fff);
  color: var(--text-secondary, #6b7280);
  cursor: pointer;
}

.ds-iconbtn:hover { background: var(--color-bg-secondary, #f3f4f6); }
.ds-iconbtn--danger:hover { color: var(--color-error, #dc2626); }
.ds-quota { padding: 0.5rem 0; color: var(--text-secondary, #6b7280); font-size: 0.75rem; }

.ds-toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  z-index: var(--z-toast, 1080);
  max-width: min(28rem, calc(100vw - 2rem));
  padding: 0.625rem 1rem;
  border-radius: var(--radius-lg, 0.5rem);
  background: var(--text-primary, #1f2937);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 550;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(1rem);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.ds-toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.ds-toast--success { background: var(--color-success, #16a34a); }
.ds-toast--error { background: var(--color-error, #dc2626); }

@media (max-width: 68rem) {
  .ds-workspace { grid-template-columns: 15rem minmax(0, 1fr); }
  .ds-detail-pane {
    position: fixed;
    top: var(--app-header-offset, 0);
    right: 0;
    bottom: 0;
    z-index: 50;
    width: min(26rem, 92vw);
    box-shadow: -0.5rem 0 2rem rgba(15, 23, 42, 0.28);
  }
}

@media (max-width: 60rem) {
  .ds-workspace { grid-template-columns: minmax(0, 1fr); }
  .ds-filter-pane {
    position: fixed;
    top: var(--app-header-offset, 0);
    left: 0;
    bottom: 0;
    z-index: 50;
    width: min(20rem, 88vw);
    box-shadow: 0.5rem 0 2rem rgba(15, 23, 42, 0.28);
  }
  .ds-filter-pane.is-collapsed { display: none; }
}

@media (max-width: 44rem) {
  .ds-toolbar { flex-wrap: wrap; }
  .ds-toolbar__tag { display: none; }
  .ds-searchbar { flex-wrap: wrap; padding: 0.5rem 0.75rem; }
  .ds-search { flex-basis: 100%; }
  .ds-sort { flex: 1 1 auto; }
  .ds-toolbar-button span,
  .ds-save-button span,
  .ds-view-button span { display: none; }
  .ds-view-button { padding: 0 0.55rem; }
  .ds-master-scroll { padding: 0.75rem; }
  .ds-results-grid { grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 0.65rem; }
  .ds-results-grid .mx-card__body { padding: 0.7rem; }
  .ds-results-grid .mx-card__facts { display: none; }
  .ds-results-grid .mx-card__actions { flex-wrap: wrap; }
  .ds-results-grid .mx-btn { padding: 0.45rem; }
  .ds-results-mini { grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); }
  .ds-master-scroll--list { overflow-x: hidden; }
  .ds-results-list { min-width: 0; }
  .ds-list__header { display: none; }
  .ds-list__row {
    display: flex;
    gap: 0.6rem;
    min-height: 4rem;
    padding: 0.5rem;
  }
  .ds-list__identity { flex: 1; }
  .ds-list__row > .ds-list__cell:nth-child(n+3):nth-last-child(n+2) { display: none; }
  .ds-list__row > .ds-list__cell:nth-child(2) { margin-left: auto; }
  .ds-brief__facts { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ds-toast,
  .mx-card { transition: none; }
}

/* =============================================================================
 * Saved-searches / filter drawer — real OVERLAY, even embedded.
 * matching-section.css forces `.mx-drawer { position: static }` under
 * html.page-mode-embedded, which drops the Saved-searches panel in-flow BELOW
 * the results grid inside the dashboard iframe. A position:fixed element is
 * clipped to the iframe's own viewport, so it correctly covers the search
 * workspace instead of stacking under the grid. Re-assert the slide-over here
 * (this file loads after matching-section.css, and body.ds-page raises
 * specificity above the shared embedded rule).
 *   Desktop → right-side slide-over with dimmed backdrop.
 *   Mobile  → full-screen, page-like (per the "new page for mobile" ask).
 * ========================================================================== */
html.page-mode-embedded body.ds-page .mx-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

html.page-mode-embedded body.ds-page .mx-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(28rem, 92vw);
  transform: translateX(100%);
  box-shadow: var(--shadow-5, 0 1.5rem 3rem -0.75rem rgba(0, 0, 0, 0.45));
  border-top: 0;
}

html.page-mode-embedded body.ds-page .mx-drawer.is-open { transform: translateX(0); }

/* Mobile: present Saved searches as a full-screen page (both embed modes). */
@media (max-width: 44rem) {
  body.ds-page .mx-drawer,
  html.page-mode-embedded body.ds-page .mx-drawer {
    width: 100%;
    max-width: 100%;
  }
}
