/* --------------------------------------------------------------------------
   The data panel — the rows behind an answer, on the right (views/panel.js,
   2026-10-15)

   Wide, a column of the layout: the conversation narrows beside it, so the
   answer and its rows are seen together. Narrower than 1100px, a sheet over
   the conversation with a scrim, the conversation inert behind it.
   -------------------------------------------------------------------------- */

.panel {
  display: flex;
  flex-direction: column;
  flex: none;
  /* Until its edge is moved; then views/panel.js sets the width chosen. */
  width: min(480px, 40vw);
  min-width: 320px;
  min-height: 0;
  border-left: 1px solid var(--border);
  background: var(--surface);
  animation: panel-in .22s var(--ease-out) both;
}

.panel[hidden], .panel-scrim[hidden], .panel-resize[hidden] { display: none; }

/* Its left edge, which resizes it: a strip wider than the line it shows,
   lying over the panel's border so it takes no room of its own. */
.panel-resize {
  position: relative;
  z-index: 2;
  flex: none;
  width: 10px;
  margin: 0 -5px;
  cursor: col-resize;
  touch-action: none;
}

.panel-resize::after {
  content: "";
  position: absolute;
  inset: 0 3px;
  border-radius: 2px;
  background: transparent;
  transition: background .15s;
}

.panel-resize:hover::after,
.layout.is-resizing .panel-resize::after { background: var(--accent); }
.panel-resize:focus { outline: none; }
.panel-resize:focus-visible::after { background: var(--accent); box-shadow: 0 0 0 2px var(--surface); }

/* While it is dragged: the column follows the pointer, nothing animates, and
   no text is selected along the way. */
.layout.is-resizing { cursor: col-resize; user-select: none; }
.layout.is-resizing .panel { animation: none; }
.layout.is-resizing iframe { pointer-events: none; }

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 12px 10px 20px;
  border-bottom: 1px solid var(--border);
}

.panel-heading { min-width: 0; }

.panel-eyebrow {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.panel-title {
  margin-top: 2px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.35;
  color: var(--text-strong);
}

.panel-title:focus { outline: none; }
.panel-title:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.panel-size {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.panel-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
}

.panel-tool {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 4px 12px;
  font-size: 12.5px;
}

/* The rows scroll both ways, the column names staying put. One table fills
   the panel; several each get a section, and the panel scrolls through them. */
.panel-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.panel-body.is-single { display: flex; flex-direction: column; overflow: hidden; }
.panel-body.is-single .panel-section { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.panel-body.is-single .panel-table-wrap { flex: 1; min-height: 0; max-height: none; }

.panel-table-wrap { overflow: auto; max-height: 420px; }

.panel-section + .panel-section { border-top: 8px solid var(--surface-sunken); }

.panel-section-head { padding: 14px 20px 0; }

.panel-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-strong);
}

.panel-prose { padding: 16px 20px; font-size: 14px; line-height: 1.6; }

.panel-table {
  width: 100%;
  min-width: 0;
}

.panel-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0;
}

.panel-table td { padding: 9px 14px; }
.panel-table tbody tr:nth-child(even) td { background: var(--surface-raised); }
.panel-table .is-number { text-align: right; }

/* A column name is the button that sorts by it. */
.panel-sort {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 36px;
  padding: 8px 14px;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  text-align: start;
}

.is-number .panel-sort { justify-content: flex-end; }
.panel-sort:hover { color: var(--text-strong); background: color-mix(in srgb, var(--text-strong) 6%, transparent); }
.panel-sort:focus-visible { outline-offset: -2px; }

/* The arrow: faint until a column is sorted, then which way. */
.panel-arrow {
  width: 0;
  height: 0;
  border: 4px solid transparent;
  border-top-color: currentColor;
  border-bottom: 0;
  opacity: 0;
  transition: transform .15s, opacity .15s;
}

.panel-sort:hover .panel-arrow { opacity: .45; }
th.is-up .panel-arrow, th.is-down .panel-arrow { opacity: 1; }
th.is-up .panel-arrow { transform: rotate(180deg); }
th.is-up, th.is-down { color: var(--text-strong); }

/* The answer's icon while its rows are open. */
.msg-data-open.is-on { color: var(--accent); background: var(--accent-soft); }

@keyframes panel-in {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: none; }
}

@media (max-width: 1100px) {
  .panel {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 31;
    /* Over the width chosen for the column (an inline style). */
    width: min(480px, 100vw) !important;
    min-width: 0;
    box-shadow: var(--shadow-lg);
  }

  .panel-resize { display: none; }

  .panel-scrim {
    position: fixed;
    inset: 0;
    z-index: 30;
    background: var(--scrim);
  }
}

@media (prefers-reduced-motion: reduce) {
  .panel { animation: none; }
  .panel-resize::after { transition: none; }
}
