.content:has(.datasets-page) {
 overflow: hidden;
}

.datasets-page {
 --page-title-size: 2rem;
 --page-title-line-height: 1.25;
 --page-title-leading: calc(
  var(--page-title-size) *
   var(--page-title-line-height)
 );
 display: flex;
 flex: 1;
 min-height: 0;
 width: 100%;
 height: 100%;
 background: var(--background);
}

.datasets-pane {
 display: flex;
 flex-direction: column;
 width: 260px;
 flex-shrink: 0;
 min-height: 0;
 border-right: 1px solid var(--border);
 background: var(--shell-surface);
 padding-top: calc(
  32px + var(--page-title-leading)
 );
}

.datasets-pane-header {
 display: flex;
 flex-direction: column;
 gap: 8px;
 padding: 0 12px 8px;
}

.datasets-pane-sub-row {
 display: flex;
 align-items: center;
 gap: 6px;
 width: 100%;
 min-width: 0;
}

.datasets-pane-sub-row
 > .datasets-filter-menu {
 flex-shrink: 0;
 margin-left: auto;
}

.datasets-filter-trigger {
 position: relative;
 width: 28px;
 height: 28px;
 flex-shrink: 0;
}

.datasets-filter-active {
 position: absolute;
 top: 4px;
 right: 4px;
 width: 6px;
 height: 6px;
 border: 1px solid var(--card);
 border-radius: 999px;
 background: var(--primary);
 opacity: 0;
}

.datasets-filter-trigger.active
 .datasets-filter-active {
 opacity: 1;
}

.datasets-filter-option input {
 width: 14px;
 height: 14px;
 margin: 0;
 accent-color: var(--primary);
}

.datasets-item-text {
 display: flex;
 flex-direction: column;
 gap: 2px;
 min-width: 0;
 flex: 1;
}

.datasets-item-archived {
 font-size: 10px;
 text-transform: uppercase;
 letter-spacing: 0.04em;
}

.datasets-item-location {
 max-width: 100%;
 overflow: hidden;
 text-overflow: ellipsis;
}

.datasets-pane-header h1,
.datasets-crumbs h2 {
 margin: 0;
 font-weight: 600;
}

.datasets-pane-header h1 {
 font-size: var(--page-title-size);
 line-height: var(
  --page-title-line-height
 );
}

.datasets-list,
.datasets-main-body {
 display: flex;
 flex-direction: column;
 gap: 4px;
 min-height: 0;
 overflow: auto;
}

.datasets-list {
 flex: 1;
 padding: 8px 12px 16px;
}

.datasets-item,
.datasets-table {
 display: flex;
 align-items: center;
 gap: 8px;
 width: 100%;
 padding: 8px 12px;
 border: 0;
 border-radius: var(--radius-md);
 background: transparent;
 color: var(--foreground);
 font: inherit;
 text-align: left;
 cursor: pointer;
}

.datasets-table {
 flex-direction: column;
 align-items: flex-start;
}

.datasets-item span,
.datasets-name {
 overflow: hidden;
 text-overflow: ellipsis;
 white-space: nowrap;
}

.datasets-item:hover,
.datasets-table:hover,
.datasets-item.active,
.datasets-table.active {
 background: var(--sidebar-item-hover);
}

.datasets-main {
 display: flex;
 flex-direction: column;
 flex: 1;
 min-width: 0;
 min-height: 0;
 padding: calc(
   32px + var(--page-title-leading)
  )
  24px 24px;
 gap: 12px;
}

.datasets-main-header {
 display: flex;
 flex-wrap: wrap;
 align-items: flex-start;
 justify-content: space-between;
 gap: 12px;
}

.datasets-actions,
.datasets-row-actions,
.datasets-column-row {
 display: flex;
 align-items: center;
 gap: 8px;
}

.datasets-row-menu {
 flex-shrink: 0;
}

.datasets-row-actions {
 flex-wrap: wrap;
}

.datasets-columns {
 display: flex;
 flex-direction: column;
 gap: 8px;
}

.datasets-column-row .input,
.datasets-column-row select {
 flex: 1;
 min-width: 0;
}

.datasets-tables {
 display: flex;
 flex-direction: column;
 gap: 4px;
}

.datasets-meta {
 font-size: var(--text-xs);
}

.datasets-col-summary {
 display: flex;
 flex-wrap: wrap;
 gap: 2px 10px;
 max-width: 100%;
 color: var(--muted-foreground);
 font-size: var(--text-xs);
}

.datasets-col-chip {
 display: inline-flex;
 align-items: center;
 gap: 4px;
 min-width: 0;
}

.datasets-type {
 display: inline-flex;
 align-items: center;
 justify-content: center;
 width: 18px;
 height: 18px;
 flex: 0 0 auto;
 border-radius: var(--radius-sm);
 color: var(--muted-foreground);
 cursor: help;
}

.datasets-type:hover {
 background: var(--sidebar-item-hover);
 color: var(--foreground);
}

.datasets-type-tip {
 position: fixed;
 z-index: 80;
 transform: translateX(-50%);
 padding: 2px 8px;
 border-radius: var(--radius-sm);
 background: var(--foreground);
 color: var(--background);
 font-size: var(--text-xs);
 line-height: 1.4;
 white-space: nowrap;
 pointer-events: none;
}

.datasets-filter {
 width: 220px;
 max-width: 100%;
 flex: 0 1 220px;
}

.datasets-empty {
 margin: 8px 0;
}

.datasets-grid {
 overflow: auto;
 min-height: 0;
}

.datasets-picker {
 display: flex;
 flex-direction: column;
 gap: 12px;
 min-height: 240px;
}

.datasets-picker-list {
 display: flex;
 flex-direction: column;
 gap: 4px;
 max-height: 360px;
 overflow: auto;
}

.datasets-picker-row {
 display: flex;
 align-items: center;
 gap: 10px;
 padding: 8px;
 border-radius: var(--radius-md);
 cursor: pointer;
}

.datasets-picker-row:hover {
 background: var(--sidebar-item-hover);
}

.datasets-picker-text {
 display: flex;
 flex-direction: column;
 min-width: 0;
}

.datasets-picker-check {
 width: 16px;
 height: 16px;
 margin: 0;
 accent-color: var(--primary);
}

.dialog.datasets-picker-dialog {
 width: min(560px, calc(100vw - 32px));
}

@media (max-width: 720px) {
 .datasets-page {
  flex-direction: column;
 }

 .datasets-pane {
  width: 100%;
  max-height: 38%;
  border-right: none;
  border-bottom: 1px solid var(--border);
  padding-top: calc(
   16px + var(--page-title-leading)
  );
 }

 .datasets-main {
  padding: 16px;
 }
}
