:root {
  --bg: #0f1419;
  --panel: #171d25;
  --panel-2: #1c2430;
  --border: #2a3544;
  --text: #e7eef7;
  --muted: #8b9bb0;
  --accent: #3d9cf0;
  --accent-2: #2ecc9a;
  --danger: #e85d5d;
  --warn: #e6b35a;
  --radius: 10px;
  --font: "Segoe UI", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 10% -10%, #1a2a40 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #142820 0%, transparent 50%),
    var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 20, 25, 0.9);
  backdrop-filter: blur(8px);
  gap: 16px;
  flex-shrink: 0;
}
.brand { display: flex; gap: 12px; align-items: center; }
.logo {
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #3d9cf0, #2ecc9a);
  font-weight: 800; letter-spacing: 0.5px;
  font-size: 13px;
}
.brand h1 { margin: 0; font-size: 15px; font-weight: 650; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.menu-details { position: relative; }
.menu-summary {
  list-style: none;
  cursor: pointer;
}
.menu-summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 180px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  z-index: 40;
  box-shadow: 0 12px 28px rgba(0,0,0,.4);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.menu-link-inline {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--text);
  background: transparent;
  cursor: pointer;
  font: inherit;
}
.menu-link-inline:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.menu-panel button,
.menu-link {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
}
.menu-panel button:hover,
.menu-link:hover { background: var(--panel-2); }

.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 260px minmax(240px, 1fr) minmax(340px, 1.3fr);
  gap: 10px;
  padding: 10px;
  transition: grid-template-columns 0.2s ease;
}
.layout.nav-collapsed {
  grid-template-columns: 48px minmax(240px, 1fr) minmax(340px, 1.3fr);
}
.layout.nav-collapsed .sidebar-nav,
.layout.nav-collapsed .sidebar-foot,
.layout.nav-collapsed .sidebar-search,
.layout.nav-collapsed .panel-head-inline {
  display: none;
}
.layout.nav-collapsed .sidebar-head {
  justify-content: center;
  border-bottom: 0;
}

.panel {
  background: rgba(23, 29, 37, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.panel-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
  flex-shrink: 0;
}
.panel-head.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.panel-head-inline {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
}

.sidebar {
  display: flex;
  flex-direction: column;
}
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-search {
  padding: 8px 10px 6px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.text-only-banner {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: rgba(61, 156, 240, 0.08);
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}
.sidebar-nav {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.sidebar-nav .tree {
  flex: 1;
  overflow: auto;
  padding: 6px;
}
.sidebar-foot {
  border-top: 1px solid var(--border);
  background: rgba(12, 16, 22, 0.55);
  flex-shrink: 0;
  padding: 8px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.full-width { width: 100%; justify-content: center; }

.mode-block { padding: 0; border: 0; }
.mode-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
}
.mode-toggle button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 7px 4px;
  font-size: 12px;
  font-weight: 600;
}
.mode-toggle button.active {
  background: linear-gradient(135deg, #2f7ec4, #2aa67a);
  color: #fff;
}
.mode-toggle button:hover:not(.active) {
  color: var(--text);
  background: rgba(255,255,255,0.04);
}

.mode-pane { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.mode-pane.hidden { display: none; }
.random-hint {
  padding: 20px 16px;
  color: var(--muted);
  line-height: 1.5;
}
.random-hint h3 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 15px;
}

/* Progress */
.progress-bar {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: rgba(12, 16, 22, 0.35);
}
.progress-main {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 6px;
}
.progress-track {
  height: 4px;
  border-radius: 999px;
  background: #243041;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2f7ec4, #2ecc9a);
  transition: width 0.25s ease;
}
.progress-dist { margin-top: 6px; font-size: 11px; line-height: 1.45; }

.list-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.toolbar {
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.field-inline {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.field-inline label {
  font-size: 11px;
  color: var(--muted);
}
.field-inline:first-child { flex: 1; }
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-wrap input { width: 100%; padding-right: 28px; }
.clear-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
}

input[type="search"], select, textarea, input[type="text"], input[type="number"] {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 10px;
  font: inherit;
}
input[type="search"] { flex: 1; }
select { min-width: 120px; }
#page-input {
  width: 56px;
  padding: 4px 6px;
  text-align: center;
}

.sample-list {
  overflow: auto;
  padding: 6px;
  flex: 1;
  min-height: 0;
}

.list-state {
  padding: 24px 14px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.list-state.error, .error-text { color: #ffc9c9; }
.spinner {
  width: 18px; height: 18px;
  border: 2px solid #35506e;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.sample-row {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sample-row:hover { background: var(--panel-2); }
.sample-row.active { background: #243247; outline: 1px solid #35506e; }
.sample-row .row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.sample-row .id {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.sample-row .preview {
  font-size: 13px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text);
}
.badges { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; flex-shrink: 0; }
.badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}
.badge.on { color: #b8f0d8; border-color: #2a6b54; background: #16352c; }
.badge.bad { color: #ffc9c9; border-color: #6b2a2a; background: #351616; }
.badge.warn { color: #ffe2b0; border-color: #6b522a; background: #352c16; }
.dataset-quality-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.4;
  font-weight: 650;
  white-space: nowrap;
  vertical-align: middle;
}
.dataset-quality-tag.quality-high {
  color: #cce5ff;
  border: 1px solid #356a9e;
  background: #172d43;
}
.dataset-quality-tag.quality-low {
  color: #ffd1bd;
  border: 1px solid #9e5a35;
  background: #431d17;
}
.dataset-source-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.4;
  font-weight: 650;
  white-space: nowrap;
  vertical-align: middle;
  margin-right: 4px;
}
.dataset-source-tag.source-subset {
  color: #d6f0c8;
  border: 1px solid #4d7a38;
  background: #1d3316;
}
.dataset-source-tag.source-full {
  color: #e4d7ff;
  border: 1px solid #6b5aa0;
  background: #2a2143;
}

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  gap: 8px;
}
.pager-center {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.page-jump { font-size: 11px; color: var(--muted); }

button, .linkbtn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
button:hover, .linkbtn:hover { border-color: #3d5168; }
button.primary {
  background: linear-gradient(135deg, #2f7ec4, #2aa67a);
  border-color: transparent;
  font-weight: 600;
}
button.ghost { background: transparent; }
button.danger { color: #ffc9c9; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.tiny {
  padding: 2px 8px;
  font-size: 11px;
}
.icon-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.icon-btn:hover { color: var(--text); border-color: #3d5168; }

.pill {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.pill.ok { color: #b8f0d8; border-color: #2a6b54; }

/* Detail panel */
.detail-panel {
  position: relative;
}
.detail {
  overflow: auto;
  padding: 12px 14px;
  flex: 1;
  min-height: 0;
}
.detail.empty { color: var(--muted); }
.detail-id-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.detail h2 {
  margin: 0;
  font-size: 14px;
  font-family: var(--mono);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}
.meta-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-size: 12px;
  margin-bottom: 12px;
  color: var(--muted);
}
.meta-grid b { color: var(--text); font-weight: 500; }

.media-block {
  background: #121820;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.media-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.media-block label {
  display: block;
  font-size: 12px;
  color: var(--muted);
}
.media-path {
  margin: 6px 0 0;
  font-size: 11px;
  word-break: break-all;
  font-family: var(--mono);
}
.media-caption {
  margin: 8px 0 0;
  padding: 8px 10px;
  background: #0c1016;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  color: var(--text);
}

/* Dark compact audio player */
audio.dap-audio {
  width: 100%;
  height: 36px;
  border-radius: 8px;
  color-scheme: dark;
  background: #0c1016;
}
audio.dap-audio::-webkit-media-controls-panel {
  background: #1a222e;
}
video {
  width: 100%;
  margin-top: 4px;
  border-radius: 8px;
}
.media-block img {
  max-width: 100%;
  border-radius: 8px;
  display: block;
}
.media-error {
  margin: 8px 0 0;
  color: #ffc9c9 !important;
  font-size: 12px;
}
.hidden { display: none !important; }

.field { margin-bottom: 12px; }
.field > label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
textarea {
  width: 100%;
  min-height: 100px;
  resize: vertical;
  line-height: 1.5;
}
.orig-text {
  background: #121820;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  color: var(--muted);
}
.diff-box {
  background: #121820;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.diff-add { background: rgba(46, 204, 154, 0.25); color: #b8f0d8; }
.diff-del { background: rgba(232, 93, 93, 0.25); color: #ffc9c9; text-decoration: line-through; }
.diff-chg { background: rgba(230, 179, 90, 0.28); color: #ffe2b0; }

.detail-actions {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: rgba(12, 16, 22, 0.92);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.note-inline { width: 100%; }
.note-inline input { width: 100%; }
.detail-action-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.usable-group { display: flex; gap: 6px; flex-wrap: wrap; }
.usable-group button.active.ok {
  background: #1d4a3a; border-color: #2ecc9a; color: #b8f0d8;
}
.usable-group button.active.bad {
  background: #4a1d1d; border-color: #e85d5d; color: #ffc9c9;
}
.usable-group button.active.warn,
.quality-group button.active.warn {
  background: #4a3a1d; border-color: #e6b35a; color: #ffe2b0;
}
.quality-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 2px;
}
.quality-label {
  color: var(--muted);
  font-size: 11px;
}
.quality-group { display: flex; gap: 6px; flex-wrap: wrap; }
.quality-group button.active.quality-high {
  background: #1e3d5b; border-color: #4b9de6; color: #cce5ff;
}
.quality-group button.active.quality-low {
  background: #4a281d; border-color: #e87950; color: #ffd1bd;
}
.quality-group kbd {
  font-size: 10px;
  opacity: 0.7;
  margin-left: 2px;
}
.usable-group kbd {
  font-size: 10px;
  opacity: 0.7;
  margin-left: 2px;
}

.save-status {
  font-size: 12px;
  font-weight: 600;
}
.save-status[data-status="dirty"] { color: var(--warn); }
.save-status[data-status="saving"] { color: var(--accent); }
.save-status[data-status="saved"],
.save-status[data-status="clean"] { color: var(--accent-2); }
.save-status[data-status="failed"] { color: var(--danger); }

.extra-box {
  font-family: var(--mono);
  font-size: 11px;
  white-space: pre-wrap;
  background: #121820;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  color: var(--muted);
  max-height: 160px;
  overflow: auto;
}

.folder-dataset-row {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 10px;
  border-radius: 8px;
}
.folder-dataset-row:hover { background: var(--panel-2); }
.folder-dataset-row.stub { opacity: 0.65; }
.folder-dataset-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.folder-dataset-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 13px;
  font-weight: 650;
}
.folder-dataset-count {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.folder-dataset-meta,
.folder-dataset-path {
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.folder-dataset-path { font-family: var(--mono); opacity: 0.8; }

.folder-overview-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.folder-overview-head h2 { font-size: 17px; }
.folder-overview-task { color: var(--accent); font-size: 12px; margin: 0 0 10px; }
.folder-overview-desc,
.folder-overview-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.folder-overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.hints { padding-left: 18px; }
.hints kbd, kbd {
  font-family: var(--mono);
  font-size: 11px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
  background: var(--panel-2);
}
.muted { color: var(--muted); font-size: 12px; }

/* Tree (unchanged structure, slightly tighter) */
.tree-group {
  margin-bottom: 8px;
  border: 1px solid #2a3a4d;
  border-radius: 10px;
  background: rgba(12, 16, 22, 0.35);
}
.tree-group.is-current {
  border-color: rgba(61, 156, 240, 0.55);
}
.tree-group-body { padding: 4px 6px 8px; }
.tree-empty { margin: 6px 8px; font-size: 12px; }
.tree-group > summary.tree-folder {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px 10px;
  color: #dcecff;
  font-size: 12px;
  font-weight: 700;
  list-style: none;
  background: linear-gradient(180deg, #243449 0%, #1c2a3c 100%);
  border: 0;
  border-bottom: 1px solid #35506e;
}
.tree-group > summary.tree-folder:hover {
  background: linear-gradient(180deg, #2a3d55 0%, #203247 100%);
}
.tree-group > summary.tree-folder.active {
  background: linear-gradient(180deg, #2f5680 0%, #243f5c 100%);
  color: #fff;
}
.tree-group > summary::-webkit-details-marker { display: none; }

.folder-left {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.folder-chevron {
  width: 0; height: 0;
  border-style: solid;
  border-width: 5px 0 5px 7px;
  border-color: transparent transparent transparent var(--muted);
  flex-shrink: 0;
  transition: transform 0.15s ease;
}
.tree-group[open] > summary .folder-chevron,
.tree-subgroup.open > .tree-subgroup-title .folder-chevron {
  transform: rotate(90deg);
}
.folder-badge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  color: #9fd4ff;
  background: rgba(61, 156, 240, 0.2);
  border: 1px solid rgba(61, 156, 240, 0.45);
}
.folder-badge.sub {
  color: #b8f0d8;
  background: rgba(46, 204, 154, 0.14);
  border-color: rgba(46, 204, 154, 0.45);
}
.folder-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.folder-meta {
  font-size: 10px;
  color: #a8bdd4;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.tree-subgroup {
  margin: 6px 2px;
  border-radius: 8px;
  border: 1px solid #2a3a4d;
  background: rgba(20, 28, 38, 0.55);
}
.tree-subgroup.is-current { border-color: rgba(46, 204, 154, 0.5); }
.tree-subgroup-title {
  position: sticky;
  top: 36px;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  text-align: left;
  background: linear-gradient(180deg, #1e2f28 0%, #1a2824 100%);
  border: 0;
  border-bottom: 1px solid #2a4a40;
  color: #d8f5ea;
  cursor: pointer;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 650;
}
.tree-subgroup-title:hover {
  background: linear-gradient(180deg, #254038 0%, #1f322c 100%);
}
.tree-subgroup-title.active {
  background: linear-gradient(180deg, #2a5648 0%, #1f3d34 100%);
  color: #fff;
}
.tree-subgroup-items { padding: 4px; }
.tree-subgroup.collapsed > .tree-subgroup-items { display: none; }

.tree-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.tree-item .name-col { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tree-item .name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-weight: 550;
}
.tree-item .subname {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tree-item:hover { background: var(--panel-2); }
.tree-item.active { background: #243247; outline: 1px solid #35506e; }
.tree-item .count { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11px; flex-shrink: 0; }
.tree-item.stub { opacity: 0.65; }

/* Info drawer */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  justify-content: flex-start;
}
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
}
.drawer-panel {
  position: relative;
  width: min(360px, 92vw);
  height: 100%;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 1;
  box-shadow: 8px 0 30px rgba(0,0,0,.35);
}
.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.drawer-head h2 { margin: 0; font-size: 15px; }
.dataset-info {
  padding: 14px 16px;
  overflow: auto;
  flex: 1;
}
.dataset-info.empty { color: var(--muted); font-size: 13px; }
.dataset-info h3 { margin: 0; font-size: 16px; }
.dataset-info .task {
  color: var(--accent);
  font-size: 12px;
  margin: 6px 0 10px;
}
.dataset-info .desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  margin: 0 0 10px;
}
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.info-cell {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}
.info-cell .k {
  display: block;
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 2px;
}
.info-cell .v {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.info-meta {
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
}
.info-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.info-kind {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  color: #9fd4ff;
  border: 1px solid rgba(61, 156, 240, 0.5);
  background: rgba(61, 156, 240, 0.15);
}
.info-kind.dataset {
  color: #b8f0d8;
  border-color: #2a6b54;
  background: #16352c;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.5);
}
.modal-card {
  position: relative;
  width: min(400px, 92vw);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 20px 50px rgba(0,0,0,.45);
  z-index: 1;
}
.modal-card h3 { margin: 0 0 8px; font-size: 16px; }
.modal-card p { margin: 0 0 14px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.modal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.shortcut-list {
  margin: 0 0 12px;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}
.shortcut-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}
.shortcut-list kbd { color: var(--text); }

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #1e2b3c;
  border: 1px solid #3d9cf0;
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  z-index: 80;
  transition: opacity .2s;
}
.toast.hidden { opacity: 0; pointer-events: none; }
.toast.error { border-color: var(--danger); }

@media (max-width: 1100px) {
  .layout, .layout.nav-collapsed {
    grid-template-columns: 1fr;
    grid-template-rows: 200px 260px 1fr;
  }
  .layout.nav-collapsed .sidebar-nav,
  .layout.nav-collapsed .sidebar-foot,
  .layout.nav-collapsed .panel-head-inline {
    display: flex;
  }
  .layout.nav-collapsed .sidebar-nav { display: flex; }
  .layout.nav-collapsed .panel-head-inline { display: inline; }
}
