/* Result sets: tabs over the transcript area, and a set's table, under the
   REPL or in a window of its own. Colours and sizes come from studio.css;
   the table itself is table.css. */
@import url("/static/table.css");

#result-tabs {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  padding: 6px 12px 0;
  background: var(--chrome);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
}
.rs-tab {
  height: 26px;
  padding: 0 10px;
  gap: 6px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: transparent;
  color: var(--text);
  font: 500 12px var(--mono);
  margin-bottom: -1px;
}
.rs-tab:first-child { font-family: var(--sans); }
.rs-tab:hover:not(:disabled) { background: var(--surface); border-color: var(--border); }
.rs-tab[aria-selected="true"] {
  background: var(--surface);
  border-color: var(--border);
  color: var(--strong);
}
.rs-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); }
.rs-tab.live .rs-dot { background: var(--green); }
.rs-tab.stale .rs-name { color: var(--muted); text-decoration: line-through; }
.rs-close { color: var(--muted); padding: 0 2px; border-radius: 3px; }
.rs-close:hover { color: var(--strong); background: var(--chrome); }

.rs-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
/* The sheet: a set over the page, from the right, the full table. */
.rs-panel.rs-expanded {
  position: fixed;
  top: 10px;
  right: 10px;
  bottom: 10px;
  width: min(1180px, calc(100vw - 120px));
  z-index: 40;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 16px 56px rgba(7, 54, 66, 0.28);
  animation: rs-sheet 0.16s ease-out;
}
@keyframes rs-sheet { from { transform: translateX(24px); opacity: 0.6; } }
.rs-backdrop { position: fixed; inset: 0; z-index: 39; background: rgba(7, 54, 66, 0.12); }
.rs-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 14px 0; }
.rs-lineage { flex-basis: 100%; font: 11.5px var(--mono); color: var(--muted); }
.rs-lineage:empty { display: none; }
.rs-lineage a { color: var(--blue); cursor: pointer; text-decoration: underline; }
.rs-lineage b { color: var(--strong); }
.rs-step { font-family: var(--sans); }
.rs-query {
  flex: 1;
  min-width: 12em;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  color: var(--strong);
  font: 13px var(--mono);
  outline: none;
}
.rs-query:focus { border-color: var(--blue); }
.rs-buttons { display: flex; gap: 6px; }
.rs-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  padding: 6px 14px 8px;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}
.rs-range { color: var(--strong); font-weight: 500; font-variant-numeric: tabular-nums; }
.rs-state::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--muted);
}
.rs-state.live::before { background: var(--green); }
.rs-state.budget, .rs-state.stale { color: var(--orange); }
.rs-state.budget::before, .rs-state.stale::before { background: var(--orange); }
.rs-loading { color: var(--yellow); }
.rs-loading::before { content: "⟳ "; }
.rs-note { color: var(--muted); }
.rs-relation { font-family: var(--mono); color: var(--blue); }
.rs-caution { color: var(--yellow); }
.rs-error { color: var(--red); }

/* The table, and the row at the cursor below it, or beside it when full. */
.rs-main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.rs-grid { flex: 1; min-height: 0; min-width: 0; display: flex; }
.rs-expanded .rs-main { flex-direction: row; }

.rs-detail {
  max-height: 40%;
  overflow: auto;
  padding: 8px 14px 10px;
  border-top: 1px solid var(--border);
  background: var(--chrome);
}
.rs-expanded .rs-detail {
  max-height: none;
  width: min(38%, 480px);
  flex-shrink: 0;
  border-top: 0;
  border-left: 1px solid var(--border);
}
.rs-detail-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); }
.rs-fields { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 10px; }
.rs-field {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  overflow-x: auto;
  cursor: default;
}
.rs-field.focused { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.rs-field-name { display: flex; gap: 6px; align-items: baseline; margin-bottom: 2px; font: 600 11.5px var(--mono); color: var(--text); }
.rs-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.rs-flash { margin-left: auto; color: var(--blue); }
