/* Translucent row materials; dense frosted pinned cells keep passing text legible. */
body:has([data-slot="sidebar-wrapper"] [data-slot="table"]) {
  --ad-grid-row: rgba(249,251,255,.28);
  --ad-grid-pinned: rgba(243,246,253,.95);
  --ad-grid-pinned-active: rgba(229,227,250,.96);
  --ad-grid-pinned-head: rgba(229,235,249,.95);
  --ad-grid-head: rgba(224,231,248,.48);
  --ad-grid-hover: rgba(218,217,249,.38);
  --ad-grid-selected: rgba(205,200,250,.44);
  --ad-grid-disabled: rgba(231,233,242,.24);
  --ad-grid-edge: rgba(110, 115, 130, .13);
  --ad-grid-interaction: rgba(79, 70, 229, .075);
  --ad-grid-ink: #4f46e5;
  --border: var(--ad-grid-edge);
  --input: var(--ad-grid-edge);
}
.dark body:has([data-slot="sidebar-wrapper"] [data-slot="table"]) {
  --ad-grid-row: rgba(28,35,51,.30);
  --ad-grid-pinned: rgba(30,37,53,.96);
  --ad-grid-pinned-active: rgba(57,51,83,.96);
  --ad-grid-pinned-head: rgba(44,54,76,.96);
  --ad-grid-head: rgba(48,58,82,.60);
  --ad-grid-hover: rgba(93,85,142,.27);
  --ad-grid-selected: rgba(113,99,176,.34);
  --ad-grid-disabled: rgba(37,43,58,.28);
  --ad-grid-edge: rgba(220, 225, 240, .10);
  --ad-grid-interaction: rgba(165, 180, 252, .12);
  --ad-grid-ink: #c7d2fe;
}

[data-slot="sidebar-inset"] div.rounded-lg.border:has([data-slot="table"]) {
  border-color: var(--ad-grid-edge);
  background: var(--ad-grid-row);
  box-shadow: inset 0 1px 0 var(--ad-highlight);
}
[data-slot="sidebar-inset"] [data-slot="table-body"] > [data-slot="table-row"] {
  --ad-current-row: var(--ad-grid-row);
  background-color: var(--ad-current-row) !important;
  border-color: var(--ad-grid-edge);
}
[data-slot="sidebar-inset"] [data-slot="table-body"] > [data-slot="table-row"]:is(:hover, :has([aria-expanded="true"])) {
  --ad-current-row: var(--ad-grid-hover);
}
[data-slot="sidebar-inset"] [data-slot="table-body"] > [data-slot="table-row"][data-state="selected"] {
  --ad-current-row: var(--ad-grid-selected);
}
[data-slot="sidebar-inset"] [data-slot="table-body"] > [data-slot="table-row"]:is([aria-disabled="true"], [data-disabled="true"], .bg-table-disabled) {
  --ad-current-row: var(--ad-grid-disabled);
}
[data-slot="sidebar-inset"] [data-slot="table-body"] > [data-slot="table-row"] > [data-slot="table-cell"] {
  background-color: var(--ad-current-row) !important;
  border-color: var(--ad-grid-edge);
  transition: background-color .15s ease;
}
[data-slot="sidebar-inset"] :is([data-slot="table-header"], [data-slot="table-header"] [data-slot="table-row"], [data-slot="table-head"]) {
  --table-header-bg: var(--ad-grid-head);
  background-color: var(--ad-grid-head) !important;
  border-color: var(--ad-grid-edge);
}
[data-slot="sidebar-inset"] :is([data-slot="table-head"], [data-slot="table-cell"]).sticky {
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
[data-slot="sidebar-inset"] div.bg-background.border-t:has([data-slot="select-trigger"]) {
  background: var(--ad-grid-row);
  border-color: var(--ad-grid-edge);
  box-shadow: inset 0 1px 0 var(--ad-highlight);
}

/* Table controls and body-level filter/menu portals share restrained violet
   interaction colors. Semantic success, warning and destructive badges retain
   their native meanings. */
body:has([data-slot="sidebar-wrapper"] [data-slot="table"]) [data-slot="sidebar-inset"] button:is([class~="hover:bg-muted"], [class~="aria-expanded:bg-muted"]):is(:hover, [aria-expanded="true"]) {
  background-color: var(--ad-grid-interaction);
}
body:has([data-slot="sidebar-wrapper"] [data-slot="table"]) [data-slot="sidebar-inset"] button:is(.bg-background, .border-border):is(:hover, [aria-expanded="true"]) {
  border-color: color-mix(in srgb, var(--ad-grid-ink) 25%, transparent);
}
body:has([data-slot="sidebar-wrapper"] [data-slot="table"]) [data-slot="tabs-list"][data-variant="default"] {
  background: var(--ad-control);
  box-shadow: inset 0 0 0 1px var(--ad-grid-edge);
}
body:has([data-slot="sidebar-wrapper"] [data-slot="table"]) [data-slot="tabs-list"][data-variant="default"] [data-slot="tabs-trigger"][data-active] {
  background: var(--ad-grid-interaction);
  color: var(--ad-grid-ink);
  border-color: color-mix(in srgb, var(--ad-grid-ink) 16%, transparent);
  box-shadow: inset 0 1px 0 var(--ad-highlight);
}
body:has([data-slot="sidebar-wrapper"] [data-slot="table"]) :is([data-slot="command-item"][data-selected="true"], [data-slot="select-item"][data-highlighted], [data-slot="dropdown-menu-item"][data-highlighted]:not([data-variant="destructive"])) {
  background-color: var(--ad-grid-interaction);
}
body:has([data-slot="sidebar-wrapper"] [data-slot="table"]) :is([data-slot="command-separator"], [data-slot="dropdown-menu-separator"], [data-slot="select-separator"], [data-slot="separator"]) {
  background-color: var(--ad-grid-edge);
}
[data-slot="sidebar-inset"] [data-slot="table-cell"][data-column-id="group"] [data-slot="status-badge"].text-info {
  color: var(--ad-grid-ink);
}
@media (prefers-reduced-motion: reduce) {
  [data-slot="sidebar-inset"] [data-slot="table-cell"] { transition: none; }
}

/* Native pinned body cells use z-index:10. Keep the entire sticky header's
   stacking context above them, including the horizontally pinned headings. */
[data-slot="sidebar-inset"] [data-slot="table-header"] {
  z-index: 20;
}
