/* The Table viewer page (table_view.js). Colours come from web_tokens.css. */
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
button,
select,
input[type="text"],
input[type="number"] {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 4px 10px;
}
button {
  cursor: pointer;
}
button:hover:not(:disabled) {
  background: var(--surface-2);
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
button[aria-pressed="true"] {
  border-color: var(--link);
  background: var(--highlight);
  font-weight: 600;
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}
a {
  color: var(--link);
}
a:hover {
  color: var(--link-hover);
}
.tv-header {
  padding: 16px 24px 12px;
}
.tv-trail {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--text-2);
}
.tv-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
}
.tv-title h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
}
.tv-crumb-sep {
  margin: 0 2px;
  color: var(--text-2);
}
.tv-up {
  display: inline-block;
  min-width: 24px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-align: center;
  font-size: 14px;
  text-decoration: none;
}
.tv-up[aria-disabled="true"] {
  color: var(--muted);
}
.tv-kind {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-2);
}
.tv-download,
.tv-summary {
  font-size: 13px;
}
.tv-summary {
  color: var(--text-2);
}
.tv-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0 24px 16px;
  /* Open panes push the table down rather than shrink it: main scrolls, and
     the table keeps main's height (100cqh). */
  overflow-y: auto;
  container-type: size;
}
.tv-panes {
  flex: none;
  height: 45vh;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  overflow: hidden;
}
.tv-popout .tv-header,
.tv-popout .tv-panes-handle,
.tv-popout .tv-toolbar,
.tv-popout .tv-filterbar,
.tv-popout .tv-pager,
.tv-popout .tv-scroll {
  display: none;
}
.tv-popout .tv-main {
  padding: 0;
}
.tv-popout .tv-panes {
  flex: 1;
  height: auto;
  border-radius: 0;
}
.tv-popout .tv-table-area {
  flex: none;
  height: auto;
  min-height: 0;
  border: none;
}
.tv-panes[hidden],
.tv-panes-handle[hidden] {
  display: none;
}
.tv-pane-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.tv-range {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--surface-2);
}
.tv-hint {
  font-size: 11px;
}
.tv-pane-root {
  flex: 1;
  min-height: 0;
  display: flex;
  padding: 6px;
  gap: 6px;
  background: var(--surface-2);
}
.tv-pane-root > * {
  flex: 1 1 0;
}
.tv-split {
  display: flex;
  min-width: 0;
  min-height: 0;
}
.tv-split-row {
  flex-direction: row;
}
.tv-split-column {
  flex-direction: column;
}
.tv-split-handle {
  flex: 0 0 6px;
  cursor: col-resize;
}
.tv-split-column > .tv-split-handle {
  cursor: row-resize;
}
.tv-split-handle:hover {
  background: var(--line);
}
.tv-pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.tv-pane-active {
  border: 2px solid var(--link);
  box-shadow: 0 0 0 3px var(--highlight);
}
.tv-tabs {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  padding: 4px 6px 0;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.tv-pane-active .tv-tabs {
  background: var(--highlight);
}
.tv-tab {
  display: flex;
  align-items: center;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 5px 5px 0 0;
  margin-bottom: -1px;
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap;
}
.tv-tab-current {
  background: var(--surface);
  border-color: var(--line);
  font-weight: 600;
}
.tv-tab button {
  border: none;
  background: none;
  padding: 4px 6px;
}
.tv-tab-kind {
  margin-right: 6px;
  font-family: var(--font-sans);
  font-size: 10px;
  text-transform: uppercase;
  color: var(--muted);
}
.tv-active-label {
  padding: 0 6px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--link);
  white-space: nowrap;
}
.tv-icon {
  display: inline-flex;
  border: none;
  background: none;
  padding: 3px;
  margin-bottom: 3px;
}
.tv-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--text-2);
  stroke-width: 1.3;
}
.tv-pane-body {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.tv-tab[draggable="true"] {
  cursor: grab;
}
.tv-drop-strip {
  outline: 2px dashed var(--link);
  outline-offset: -2px;
}
/* Where a dragged tab would land: the whole pane, or the half split off. */
.tv-pane-body[data-drop]::after {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0;
  background: var(--highlight);
  border: 2px dashed var(--link);
  pointer-events: none;
}
.tv-pane-body[data-drop="left"]::after {
  right: 50%;
}
.tv-pane-body[data-drop="right"]::after {
  left: 50%;
}
.tv-pane-body[data-drop="top"]::after {
  bottom: 50%;
}
.tv-pane-body[data-drop="bottom"]::after {
  top: 50%;
}
.tv-tab-view {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
}
.tv-tab-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  font-size: 12px;
}
.tv-tab-title strong {
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
}
/* A text file's line numbers stay at the left as long lines scroll. The line
   height is fixed, so that a line in a fallback font stays beside its number. */
.tv-source {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: flex-start;
  overflow: auto;
  font-size: 12px;
  line-height: 1.5;
}
.tv-source[hidden] {
  display: none;
}
.tv-text,
.tv-line-numbers {
  flex: none;
  margin: 0;
  font-family: var(--font-mono);
  font-size: inherit;
  line-height: inherit;
  white-space: pre;
}
.tv-line-numbers {
  position: sticky;
  left: 0;
  z-index: 1;
  margin-right: 10px;
  padding-right: 8px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  text-align: right;
  user-select: none;
}
.tv-line-numbers:empty {
  display: none;
}
.tv-highlighted {
  font-family: inherit;
}
.tv-markdown {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 10px;
  overflow-wrap: anywhere;
}
.tv-markdown h1,
.tv-markdown h2,
.tv-markdown h3 {
  margin: 1em 0 0.45em;
  line-height: 1.25;
}
.tv-markdown h1 {
  font-size: 1.5em;
}
.tv-markdown h2 {
  font-size: 1.25em;
}
.tv-markdown h3 {
  font-size: 1.1em;
}
.tv-markdown p,
.tv-markdown ul,
.tv-markdown ol,
.tv-markdown blockquote {
  margin: 0.6em 0;
}
.tv-markdown ul,
.tv-markdown ol {
  padding-left: 1.8em;
}
.tv-markdown blockquote {
  padding-left: 1em;
  border-left: 3px solid var(--line);
  color: var(--text-2);
}
.tv-markdown code {
  font-family: var(--font-mono);
  background: var(--code-bg);
  padding: 1px 4px;
  border-radius: 3px;
}
.tv-markdown pre {
  overflow: auto;
  background: var(--code-bg);
  padding: 10px;
  border-radius: 6px;
}
.tv-markdown pre code {
  padding: 0;
  background: transparent;
}
.tv-markdown .markdown-table {
  overflow: auto;
}
.tv-markdown table {
  border-collapse: collapse;
}
.tv-markdown th,
.tv-markdown td {
  border: 1px solid var(--line);
  padding: 4px 8px;
}
.tv-pdf {
  flex: 1;
  min-height: 0;
  width: 100%;
  border: 0;
  background: var(--surface-2);
}
.tv-pdf-note {
  margin: 0;
  font-size: 12px;
}
.tv-format-label {
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
}
.tv-image,
.tv-video {
  flex: 1;
  min-height: 0;
  max-width: 100%;
  object-fit: contain;
}
.tv-audio-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.tv-audio-controls .tv-video {
  flex: 1 1 100%;
  max-height: 50vh;
}
.tv-plot-buttons {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.tv-audio-controls .tv-video.tv-plots-on {
  max-height: 40vh;
}
.tv-channel-choice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tv-channel-choice[hidden] {
  display: none;
}
.tv-audio {
  flex: 1;
  min-width: 200px;
  height: 36px;
}
.tv-analysis-status {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
.tv-analysis-status:empty {
  display: none;
}
.tv-plot {
  position: relative;
  min-height: 0;
}
.tv-plot[hidden] {
  display: none;
}
.tv-plot canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  border-radius: 4px;
}
.tv-plot-handle {
  flex: none;
  height: 6px;
  margin: -3px 0;
  cursor: row-resize;
  border-radius: 3px;
}
.tv-plot-handle:hover {
  background: var(--line);
}
.tv-plot-handle[hidden] {
  display: none;
}
.tv-waveform-box {
  flex: 0 0 64px;
  min-height: 32px;
  background: var(--surface-sunken);
  border-radius: 4px;
}
.tv-spectrogram-box {
  flex: 1 1 120px;
  /* A short pane scrolls rather than squeezing the plot away. */
  min-height: 120px;
}
.tv-spectrogram-box[data-top]::before {
  content: attr(data-top);
  position: absolute;
  top: 2px;
  right: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: #ffffff;
  pointer-events: none;
}
.tv-time-axis {
  flex: none;
  position: relative;
  height: 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
}
.tv-time-axis span {
  position: absolute;
  white-space: nowrap;
}
.tv-time-axis[hidden] {
  display: none;
}
.tv-panes-handle {
  flex: none;
  height: 10px;
  cursor: row-resize;
  background: var(--line-soft);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
.tv-panes-handle:hover {
  background: var(--line);
}
.tv-panes:not([hidden]) ~ .tv-table-area {
  border-radius: 0 0 8px 8px;
}
.tv-open-row,
.tv-open-table {
  font-size: 12px;
  white-space: nowrap;
}
.tv-table-area {
  flex: none;
  height: 100cqh;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.tv-table-area[hidden] {
  display: none;
}
.tv-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
.tv-toolbar label {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tv-toolbar label > span:first-child {
  color: var(--text-2);
}
.tv-segmented {
  display: inline-flex;
}
.tv-segmented button {
  border-radius: 0;
}
.tv-segmented button:first-child {
  border-radius: 6px 0 0 6px;
}
.tv-segmented button:last-child {
  border-radius: 0 6px 6px 0;
}
.tv-pattern {
  width: 12em;
  font-family: var(--font-mono);
}
.tv-missing {
  font-size: 12px;
  font-weight: 600;
  color: var(--s-bad);
}
.tv-spacer {
  flex-grow: 1;
}
.tv-separator-other {
  width: 3.5em;
  text-align: center;
  font-family: var(--font-mono);
}
.tv-filterbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-sunken);
  font-size: 13px;
}
.tv-filterbar:empty {
  display: none;
}
.tv-filter-label {
  color: var(--text-2);
}
.tv-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 4px 2px 10px;
  border: 1px solid var(--link);
  border-radius: 14px;
  background: var(--highlight);
}
.tv-chip code {
  font-family: var(--font-mono);
}
.tv-chip button {
  border: none;
  background: none;
  padding: 0 6px;
}
.tv-filter-form {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.tv-filter-value {
  width: 10em;
  font-family: var(--font-mono);
}
.tv-link-button {
  border: none;
  background: none;
  color: var(--link);
  padding: 2px 4px;
}
.tv-muted {
  color: var(--muted);
}
.tv-error {
  margin: 0;
  padding: 10px 16px;
  color: var(--s-bad);
  background: var(--s-bad-bg);
  border-bottom: 1px solid var(--line);
}
.tv-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.tv-table {
  border-collapse: collapse;
  min-width: 100%;
  font-size: 13px;
}
.tv-table th,
.tv-table td {
  padding: 7px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line-soft);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-width: 40em;
}
.tv-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  white-space: nowrap;
}
.tv-table .tv-number {
  color: var(--muted);
  text-align: right;
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: nowrap;
}
.tv-sort {
  border: none;
  background: none;
  padding: 0;
  font-weight: 600;
  white-space: nowrap;
}
.tv-sort:hover:not(:disabled) {
  background: none;
  color: var(--link);
}
.tv-table thead tr.tv-describe th,
.tv-table thead tr.tv-describe td {
  position: static;
  background: var(--surface-sunken);
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 12px;
  border-bottom: 1px solid var(--line-soft);
}
.tv-table thead tr.tv-describe:last-child th,
.tv-table thead tr.tv-describe:last-child td {
  border-bottom: 2px solid var(--line);
}
.tv-histogram {
  flex: 1 1 120px;
  min-height: 120px;
  display: flex;
  align-items: flex-end;
  /* Many bars leave no room for a gap of a fixed size. */
  gap: min(2px, 0.2%);
  border-bottom: 1px solid var(--line);
}
.tv-histogram-bins {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.tv-histogram-axis {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}
.tv-histogram-bin {
  flex: 1;
  display: flex;
  align-items: flex-end;
  height: 100%;
}
.tv-histogram-bar {
  flex: 1;
  background: var(--link);
  border-radius: 2px 2px 0 0;
}
.tv-top-values {
  min-width: 120px;
  max-width: 280px;
}
.tv-top-value {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.tv-top-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tv-table tbody tr:hover {
  background: var(--highlight);
}
.tv-table tbody tr.tv-row-current {
  background: var(--highlight);
}
.tv-table tbody tr.tv-row-current > td:first-child {
  box-shadow: inset 3px 0 0 var(--link);
  font-weight: 600;
}
.tv-table tbody td.tv-cell-current {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}
.tv-row-notice {
  margin: 0;
  padding: 1rem;
  color: var(--muted);
}
.tv-media {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tv-media-path {
  font-family: var(--font-mono);
  font-size: 12px;
}
.tv-tree-path {
  display: block;
}
.tv-directory {
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: left;
}
.tv-directory-cell {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}
.tv-enter {
  font-size: 12px;
  text-decoration: none;
}
.tv-media-properties,
.tv-media-error {
  font-size: 11px;
  color: var(--text-2);
  white-space: normal;
}
.tv-media-error {
  color: var(--s-bad);
}
.tv-empty {
  padding: 16px;
  color: var(--muted);
}
.tv-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
.tv-pager:empty {
  display: none;
}
.tv-export {
  font-size: 13px;
  white-space: nowrap;
}
.tv-pager-count {
  color: var(--text-2);
}
.tv-pager-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.tv-pager-buttons label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px;
}
.tv-page-input {
  width: 6em;
}
.tv-pager-size {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
}
@media (max-width: 640px) {
  .tv-header {
    padding: 12px 16px 8px;
  }
  .tv-main {
    padding: 0 16px 12px;
  }
}
