/* Dataset tab — the record, queryable. Editorial like the analysis section:
   type and hairlines on white, no boxed chrome, brand green as the only accent,
   color reserved for stance (the analysis crimson/green). */
.panel-dataset { background: #ffffff; }
.ds-wrap {
  width: min(1560px, calc(100% - 56px));
  margin: 0 auto;
  padding: clamp(72px, 10vh, 100px) 0 70px;
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

/* ---------- query rail ---------- */
.ds-rail {
  position: sticky;
  top: 76px;
  /* Short enough that even when the grid row bottom-constrains the sticky
     rail (the panel is barely a viewport tall), it can never ride up under
     the floating tab pill: 76px top clearance + the wrap's 70px bottom pad. */
  max-height: calc(100svh - 146px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px 10px 40px 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.ds-rail::-webkit-scrollbar { width: 7px; }
.ds-rail::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }

.ds-search { position: relative; margin-bottom: 22px; }
.ds-search input {
  width: 100%;
  background: var(--room);
  border: 1.5px solid #a8a291;
  border-radius: 9px;
  padding: 13px 38px 13px 15px;
  font: 500 16px/1.3 var(--body);
  color: var(--ink);
  letter-spacing: -0.005em;
}
.ds-search input:focus { outline: none; border-color: #7f7a6a; }
.ds-search input::placeholder { color: var(--ink-faint); }
.ds-search-clear {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: var(--room-up);
  color: var(--ink-dim);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: none;
}
.ds-search.has-q .ds-search-clear { display: block; }
.ds-search-state {
  position: absolute;
  right: 40px;
  top: 50%;
  transform: translateY(-50%);
  font: 400 11px var(--mono);
  color: var(--ink-faint);
}

.ds-facet { border-top: 1px solid var(--line); padding: 14px 0 12px; }
.ds-facet:first-of-type { border-top: 0; }
.ds-facet-h {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  width: 100%;
  border: 0;
  background: none;
  padding: 2px 2px;
  cursor: pointer;
  font: 750 15.5px/1.2 var(--body);
  color: var(--ink);
  letter-spacing: -0.01em;
}
.ds-facet-h .ds-chev {
  color: var(--ink-faint);
  transition: transform 0.16s ease;
  font-size: 10px;
}
.ds-facet[data-open] .ds-chev { transform: rotate(180deg); }
.ds-facet-body { display: none; padding-top: 8px; }
.ds-facet[data-open] .ds-facet-body { display: block; }

.ds-opt {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  border: 0;
  background: none;
  padding: 5.5px 2px;
  cursor: pointer;
  font: 500 14.5px/1.35 var(--body);
  color: var(--ink-dim);
  text-align: left;
}
.ds-opt:hover { color: var(--ink); }
.ds-opt:hover .ds-n { color: var(--ink-dim); }
.ds-opt.on { color: var(--ink); font-weight: 700; }
.ds-opt .ds-mark {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--caption);
  flex: none;
  display: none;
}
.ds-opt.on .ds-mark { display: block; }
.ds-opt .ds-lab { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-opt .ds-n {
  font: 400 13px var(--mono);
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.ds-opt.on .ds-n { color: var(--caption); font-weight: 600; }
.ds-opt[disabled] { opacity: 0.35; cursor: default; }
.ds-opt .ds-sdot { width: 9px; height: 9px; border-radius: 999px; flex: none; }

.ds-more {
  border: 0;
  background: none;
  padding: 6px 2px 2px;
  cursor: pointer;
  font: 650 13.5px var(--body);
  color: var(--caption);
}
.ds-more:hover { text-decoration: underline; text-underline-offset: 3px; }
.ds-facet-scroll { max-height: 272px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.ds-minifind {
  width: 100%;
  margin: 2px 0 8px;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 6px 2px;
  font: 500 14px var(--body);
  color: var(--ink);
}
.ds-minifind:focus { outline: none; border-bottom-color: #a8a291; }
.ds-minifind::placeholder { color: var(--ink-faint); }

/* ---------- results ---------- */
.ds-main { min-width: 0; }
.ds-head { display: flex; align-items: baseline; gap: 22px; flex-wrap: wrap; padding-bottom: 14px; }
.ds-count { font: 750 26px/1.15 var(--body); color: var(--ink); letter-spacing: -0.02em; }
.ds-count b { font-variant-numeric: tabular-nums; font-weight: 800; }
.ds-count span { color: var(--ink-dim); font-weight: 500; font-size: 16.5px; letter-spacing: -0.005em; }
.ds-head-spacer { flex: 1; }

.ds-view { display: inline-flex; gap: 18px; }
.ds-view button {
  border: 0;
  background: none;
  padding: 4px 0;
  font: 650 15px var(--body);
  color: var(--ink-faint);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.ds-view button:hover { color: var(--ink-dim); }
.ds-view button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--caption); }

.ds-dd { position: relative; }
.ds-dd-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: none;
  padding: 4px 0;
  font: 650 15px var(--body);
  color: var(--ink-dim);
  cursor: pointer;
}
.ds-dd-btn:hover { color: var(--ink); }
.ds-dd-btn .ds-chev { font-size: 9px; color: var(--ink-faint); }
.ds-dd-list {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 30;
  min-width: 160px;
  background: var(--room);
  border: 1.5px solid #a8a291;
  border-radius: 11px;
  box-shadow: 0 18px 50px rgba(23, 34, 56, 0.13);
  padding: 6px;
  display: none;
}
.ds-dd[data-open] .ds-dd-list { display: block; }
.ds-dd-list button {
  all: unset;
  display: block;
  width: calc(100% - 24px);
  padding: 9px 12px;
  border-radius: 7px;
  font: 550 14.5px var(--body);
  color: var(--ink);
  cursor: pointer;
}
.ds-dd-list button:hover { background: #f2f0e8; }
.ds-dd-list button.on { background: #eef4ea; font-weight: 700; }

.ds-csv {
  border: 0;
  background: none;
  padding: 4px 0;
  font: 700 15px var(--body);
  color: var(--caption);
  cursor: pointer;
}
.ds-csv:hover { text-decoration: underline; text-underline-offset: 3px; }

.ds-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 14px; }

.ds-window {
  border-top: 2px solid var(--ink);
  height: max(480px, calc(100svh - 226px));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.ds-window::-webkit-scrollbar { width: 8px; }
.ds-window::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }

.ds-row {
  padding: 22px 10px 20px 2px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.ds-row:hover { background: #f7f5ec; }
.ds-row.playing { background: #eef4ea; }
.ds-row:focus-visible { outline: 2px solid var(--caption); outline-offset: -2px; }

.ds-q {
  font: 400 17.5px/1.6 var(--body);
  color: var(--ink);
  letter-spacing: -0.006em;
  max-width: 50em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ds-q mark { background: #d7eeab; color: #123c12; border-radius: 2px; padding: 0 1px; }

.ds-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 11px;
  min-height: 30px;
  font: 500 13px/1.3 var(--body);
  color: var(--ink-faint);
  white-space: nowrap;
}
.ds-meta .ds-sdot { width: 9px; height: 9px; border-radius: 999px; flex: none; }
.ds-meta .ds-nm { color: var(--ink); font: 700 13.5px/1.3 var(--body); letter-spacing: -0.005em; }
.ds-meta .ds-mplace { color: var(--ink-dim); font-weight: 600; }
.ds-sep { color: #cfcaba; }
.ds-mspacer { flex: 1; }
.ds-meta > span, .ds-meta > b { overflow: hidden; text-overflow: ellipsis; }

.ds-scale { display: inline-flex; gap: 3px; align-items: center; flex: none; }
.ds-scale i { width: 4.5px; height: 4.5px; border-radius: 999px; background: #e4e1d4; }
.ds-scale i.f { background: #131711; opacity: 0.5; }

.ds-time { font: 400 12.5px var(--mono); color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.ds-play {
  width: 30px;
  height: 30px;
  flex: none;
  border: 1px solid transparent;
  border-radius: 999px;
  background: none;
  color: var(--ink-faint);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.ds-play svg { width: 12px; height: 12px; fill: currentColor; }
.ds-row:hover .ds-play { border-color: var(--caption); background: var(--caption); color: #ffffff; }
.ds-row.playing .ds-play { border-color: var(--caption); background: var(--caption); color: #ffffff; }

.ds-mhead {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 15px 6px 11px 2px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}
.ds-mhead h3 { margin: 0; font: 800 16px/1.25 var(--body); color: var(--ink); letter-spacing: -0.015em; }
.ds-mhead .ds-mmeta { font: 500 13.5px var(--body); color: var(--ink-dim); }
.ds-mhead .ds-mbar { display: inline-flex; align-self: center; height: 7px; border-radius: 99px; overflow: hidden; width: 88px; }
.ds-mhead .ds-mbar i { display: block; height: 100%; }
.ds-mhead .ds-mspacer { flex: 1; }
.ds-mhead button {
  border: 0;
  background: none;
  font: 700 13.5px var(--body);
  color: var(--caption);
  cursor: pointer;
}
.ds-mhead button:hover { text-decoration: underline; text-underline-offset: 3px; }

.ds-empty { padding: 70px 24px; text-align: center; color: var(--ink-dim); font: 500 16px/1.6 var(--body); }
.ds-empty b { color: var(--ink); font-weight: 750; }
.ds-foot { padding: 18px 4px 6px; font: 400 12.5px var(--mono); color: var(--ink-faint); }

.ds-sdot.no, .ds-mbar i.no { background: #c1121f; }
.ds-sdot.yes, .ds-mbar i.yes { background: #116911; }
.ds-sdot.inquiry, .ds-mbar i.inquiry { background: #2d72d2; }
.ds-sdot.unclear, .ds-mbar i.unclear { background: #c5cbd3; }

@media (max-width: 980px) {
  .ds-wrap { grid-template-columns: 1fr; gap: 20px; }
  .ds-rail { position: static; max-height: none; }
  .ds-meta { flex-wrap: wrap; white-space: normal; }
}
