/* Ekalix - the execution plan viewer (web\planview.js).
 *
 * Every class starts with pv-. Every colour comes from the theme variables in styles.css, so the
 * five themes work unchanged; a .t-<tone> class sets --tone, --tone-bg and --tone-bd. The only
 * literal colours are black shadows.
 *
 * Motion: the travelling rows, the pulse on a running operator, the entrance and the glides are
 * all switched off under :root[data-motion="off"], and under prefers-reduced-motion unless the
 * reader forced :root[data-motion="on"]. planview.js does not even render the particles then; the
 * rules here are the second lock. Nothing the picture says depends on movement.
 */

.pv {
  position: relative;
  display: flex; flex-direction: column;
  min-width: 0;
  color: var(--text);
  background: var(--surface-1);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.45;
}
.pv button { font-family: inherit; }
.pv-grow { flex: 1 1 auto; min-width: 0; }
.pv-mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.pv-wrap { white-space: pre-wrap; word-break: break-word; }
.pv-muted { color: var(--text-3); font-size: var(--fs-small); margin-top: 2px; }

/* ---------- header ---------------------------------------------------------- */

.pv-head {
  display: flex; flex-direction: column; gap: 8px;
  padding: 11px 14px 11px;
  border-bottom: 1px solid var(--hairline);
  background: linear-gradient(180deg, var(--surface-2), var(--surface-1));
}
.pv-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pv-title {
  flex: 0 1 auto; min-width: 0;
  font-size: 13px; font-weight: 650; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pv-tabs { display: flex; gap: 4px; min-width: 0; overflow: hidden; flex: 0 1 auto; }
.pv-tab {
  appearance: none; flex: 0 1 auto; min-width: 0; max-width: 220px;
  border: 1px solid var(--border); background: var(--surface-1); color: var(--text-2);
  border-radius: var(--r-xs); padding: 2px 9px; cursor: pointer;
  font-size: var(--fs-small); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pv-tab:hover { color: var(--text); border-color: var(--border-2); }
.pv-tab.is-on { color: var(--accent); border-color: var(--accent-bd); background: var(--accent-bg); }
.pv-tab.is-empty { opacity: .6; }
.pv-select {
  max-width: 420px; min-width: 0;
  border: 1px solid var(--border); background: var(--surface-1); color: var(--text);
  border-radius: var(--r-xs); padding: 3px 6px; font-size: var(--fs-small);
}
.pv-live {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-small); font-weight: 700; color: var(--ok);
  border: 1px solid var(--ok-bd); background: var(--ok-bg);
  border-radius: 999px; padding: 1px 9px 1px 8px; white-space: nowrap;
}
.pv-live i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: pv-blink 1.6s ease-in-out infinite; }

.pv-sqlrow { gap: 9px; }
.pv-kind {
  flex: 0 0 auto;
  font-family: var(--mono); font-size: var(--fs-micro); font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent); border: 1px solid var(--accent-bd); background: var(--accent-bg);
  border-radius: var(--r-xs); padding: 1px 6px; white-space: nowrap;
}
.pv-sql {
  flex: 1 1 auto; min-width: 0;
  font-family: var(--mono); font-size: 12px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pv-link {
  appearance: none; flex: 0 0 auto;
  background: none; border: 0; padding: 2px 4px; cursor: pointer;
  color: var(--accent); font-size: var(--fs-small); font-weight: 600; white-space: nowrap;
}
.pv-link:hover { text-decoration: underline; }
.pv-sqlfull {
  margin: 0; max-height: 240px; overflow: auto;
  font-family: var(--mono); font-size: 12px; line-height: 1.55; color: var(--text);
  background: var(--bg); border: 1px solid var(--hairline); border-radius: var(--r-s);
  padding: 10px 12px; white-space: pre-wrap; word-break: break-word;
}

.pv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pv-chip {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  border: 1px solid var(--border); background: var(--surface-1); color: var(--text-2);
  border-radius: 999px; padding: 2px 10px; line-height: 1.55;
  font-size: var(--fs-small); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pv-chip b { font-family: var(--mono); font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
button.pv-chip { appearance: none; cursor: pointer; font-family: inherit; }
button.pv-chip:hover { border-color: var(--tone-bd); color: var(--text); }
.pv-chip.is-tone { border-color: var(--tone-bd); background: var(--tone-bg); color: var(--text); padding-left: 4px; }
.pv-g {
  flex: 0 0 auto;
  display: inline-grid; place-items: center;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--tone); color: var(--surface-1);
  font-family: var(--font); font-size: 10px; font-weight: 800; line-height: 1; font-style: normal;
}

/* missing index */
.pv-mi {
  display: flex; flex-direction: column; gap: 7px;
  border: 1px solid var(--tone-bd); border-left: 3px solid var(--tone);
  background: linear-gradient(90deg, var(--tone-bg), transparent 55%), var(--surface-1);
  border-radius: var(--r-s); padding: 8px 10px 9px;
}
.pv-mi-title { font-weight: 700; font-size: 12px; color: var(--text); white-space: nowrap; }
.pv-mi-note { font-size: var(--fs-small); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pv-mi-item { display: flex; flex-direction: column; gap: 6px; }
.pv-mi-line { gap: 9px; }
.pv-impact {
  flex: 0 0 auto;
  font-family: var(--mono); font-size: var(--fs-small); font-weight: 700; color: var(--tone);
  border: 1px solid var(--tone-bd); border-radius: 999px; padding: 0 7px; white-space: nowrap;
}
.pv-mi-what { flex: 1 1 auto; min-width: 0; font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-mi-what b { color: var(--text); font-weight: 650; }
.pv-code-wrap { position: relative; }
.pv-code {
  margin: 0;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.55; color: var(--text);
  background: var(--bg); border: 1px solid var(--hairline); border-radius: var(--r-xs);
  padding: 8px 10px; white-space: pre-wrap; word-break: break-word; overflow: auto; max-height: 260px;
}
.pv-copy { position: absolute; top: 6px; right: 6px; }
.pv-mi .pv-code { max-height: 150px; font-size: 11px; line-height: 1.45; padding: 7px 9px; }

/* ---------- body: stage and side panel ---------------------------------------- */

.pv-body { display: flex; min-height: 0; }
.pv.is-narrow .pv-body, .pv.is-compact .pv-body { flex-direction: column; }

.pv-stage {
  position: relative;
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; overflow: clip;
  background-color: var(--bg);
  background-image: radial-gradient(circle, var(--border) 1px, transparent 1.3px);
  cursor: grab;
  touch-action: none;
  user-select: none; -webkit-user-select: none;
  outline: none;
}
.pv-stage.is-dragging { cursor: grabbing; }
.pv-stage:focus-visible { box-shadow: inset 0 0 0 2px var(--accent-bd); }
.pv-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.pv-world.is-glide { transition: transform .4s cubic-bezier(.2, .7, .3, 1); }
.pv-layer { position: absolute; inset: 0; }
.pv-empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 24px; text-align: center; color: var(--text-3); font-size: 12.5px;
}
.pv-empty b { color: var(--text); font-size: 13px; }

/* edges */
.pv-edges { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.pv-edge { transition: opacity .3s ease; }
.pv-edge-line { fill: none; stroke: var(--text-3); opacity: .36; stroke-linecap: round; }
.pv-edge-glow { fill: none; stroke: var(--accent); opacity: .15; stroke-linecap: round; }
.pv-edge.is-hot .pv-edge-line { stroke: var(--accent); opacity: .62; }
.pv-edge.is-zero .pv-edge-line { stroke-dasharray: 2 5; opacity: .3; }
.pv-edge-hit { fill: none; stroke: transparent; stroke-width: 14px; pointer-events: stroke; cursor: help; }
.pv-edge-num {
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  fill: var(--text-3);
  paint-order: stroke; stroke: var(--bg); stroke-width: 3.5px; stroke-linejoin: round;
}
.pv-edge.is-hot .pv-edge-num { fill: var(--text-2); }
.pv-edge.is-dim { opacity: .14; }
.pv-edge.is-lit .pv-edge-line { stroke: var(--accent); opacity: .9; }
.pv-edge.is-lit .pv-edge-num { fill: var(--text); }

/* the travelling rows: a dash pattern on a copy of the edge. Longhands, never the `animation`
   shorthand, because planview.js sets animation-duration inline from the row count. */
.pv-particles {
  fill: none; stroke: var(--accent); stroke-linecap: round;
  opacity: 0;
  animation-name: pv-flow;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
.pv-edge.is-hot .pv-particles { stroke: var(--accent); filter: drop-shadow(0 0 3px var(--accent)); }
@keyframes pv-flow { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: no-preference) { .pv-particles { opacity: .95; } }
:root[data-motion="on"] .pv-particles { opacity: .95; }

/* ---------- operator cards ---------------------------------------------------- */

.pv-card {
  position: absolute;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 8px 10px 7px;
  border-radius: var(--r-s);
  border: 1px solid var(--border);
  background: var(--surface-2);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .22);
  cursor: pointer;
  transition: opacity .3s ease, border-color .15s ease, box-shadow .2s ease;
}
.pv-card.t-warning, .pv-card.t-serious, .pv-card.t-critical {
  border-color: var(--tone-bd);
  background-image: linear-gradient(180deg, var(--tone-bg), transparent 72%);
}
.pv-card:hover { border-color: var(--border-2); }
.pv-card.t-warning:hover, .pv-card.t-serious:hover { border-color: var(--tone); }
.pv-card.is-top { box-shadow: 0 0 0 1px var(--tone-bd), 0 0 26px var(--tone-bg), 0 6px 16px rgba(0, 0, 0, .22); }
.pv-card.is-sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent), 0 10px 26px rgba(0, 0, 0, .32); }
.pv-card:focus { outline: none; }
.pv-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--r-s); }

.pv-flag {
  position: absolute; left: 10px; top: -9px; z-index: 2;
  padding: 0 7px; border-radius: 999px;
  background: var(--tone); color: var(--surface-1);
  font-size: 9.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
  line-height: 16px; white-space: nowrap;
}
.pv-card.t-muted .pv-flag { background: var(--accent); }
.pv-card.is-now .pv-flag { background: var(--accent); }

.pv-card-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pv-ic {
  flex: 0 0 auto;
  width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: var(--r-xs);
  background: var(--surface-3); color: var(--text-2);
}
.pv-card.f-access .pv-ic { background: var(--accent-bg); color: var(--accent); }
.pv-card.f-join .pv-ic { color: var(--accent-2); }
.pv-card.t-warning .pv-ic, .pv-card.t-serious .pv-ic, .pv-card.t-critical .pv-ic,
.pv-ic.t-warning, .pv-ic.t-serious, .pv-ic.t-critical { background: var(--tone-bg); color: var(--tone); }
.pv-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.pv-glyph { width: 11px; height: 11px; fill: currentColor; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; flex: 0 0 auto; }
.pv-card-names { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.pv-card-label {
  font-size: 12.5px; font-weight: 650; color: var(--text); line-height: 16px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pv-card-sub {
  font-size: var(--fs-small); color: var(--text-3); line-height: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pv-card-rows { display: flex; align-items: center; gap: 5px; min-width: 0; height: 16px; }
.pv-card-nums {
  flex: 1 1 auto; min-width: 0;
  font-family: var(--mono); font-size: 10px; letter-spacing: -.01em; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pv-badge {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 1px;
  padding: 0 5px; border-radius: 999px;
  border: 1px solid var(--tone-bd); background: var(--tone-bg); color: var(--tone);
  font-family: var(--mono); font-size: 10px; font-weight: 700; line-height: 14px; white-space: nowrap;
}
/* warnings: a bubble on the top-right corner, glyph plus count, so the row numbers keep their room */
.pv-warnbub {
  position: absolute; top: -8px; right: 9px; z-index: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 1px;
  min-width: 18px; height: 17px; padding: 0 5px; border-radius: 999px;
  background: var(--tone); color: var(--surface-1);
  box-shadow: 0 0 0 2px var(--bg);
  font-family: var(--mono); font-size: 10px; font-weight: 800; line-height: 17px; white-space: nowrap;
}
.pv-lod-far .pv-warnbub, .pv-lod-tiny .pv-warnbub { top: -14px; height: 26px; min-width: 28px; font-size: 17px; line-height: 26px; padding: 0 8px; }
.pv-card-foot { display: flex; align-items: center; gap: 8px; }
.pv-card-bar { flex: 1 1 auto; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.pv-card-bar i { display: block; height: 100%; border-radius: 2px; background: var(--tone); }
.pv-card.t-muted .pv-card-bar i { background: var(--text-3); }
.pv-card-pct {
  flex: 0 0 auto; min-width: 34px; text-align: right;
  font-family: var(--mono); font-size: 10.5px; font-weight: 700; color: var(--text-2); line-height: 12px;
}
.pv-card.t-warning .pv-card-pct, .pv-card.t-serious .pv-card-pct, .pv-card.t-critical .pv-card-pct { color: var(--tone); }

/* live: a thin progress line along the top edge; running operators pulse, finished ones settle */
.pv-card-prog {
  position: absolute; left: 0; right: 0; top: 0; height: 3px;
  border-radius: var(--r-s) var(--r-s) 0 0; overflow: hidden;
  background: var(--surface-3);
}
.pv-card-prog i { display: block; height: 100%; background: var(--accent); transition: width .8s ease; }
.pv-card.is-done .pv-card-prog i { background: var(--ok); }
.pv-card.is-pending { opacity: .5; }
.pv-card.is-active { animation: pv-breathe 1.8s ease-in-out infinite; }
@keyframes pv-breathe {
  0%, 100% { box-shadow: 0 0 0 1px var(--accent-bd), 0 6px 16px rgba(0, 0, 0, .22); }
  50% { box-shadow: 0 0 0 3px var(--accent-bg), 0 0 24px var(--accent-bg), 0 6px 16px rgba(0, 0, 0, .22); }
}
@keyframes pv-blink { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* entrance: the plan assembles from the tables toward the result, once per plan */
.pv-card.is-enter { animation: pv-enter .5s cubic-bezier(.2, .7, .3, 1) backwards; }
@keyframes pv-enter { from { opacity: 0; transform: translateX(-16px) scale(.97); } to { opacity: 1; transform: none; } }
.pv.is-moving .pv-edges { animation: pv-fade .7s .25s ease backwards; }
@keyframes pv-fade { from { opacity: 0; } to { opacity: 1; } }

/* the walkthrough */
.pv-card.is-past { opacity: .5; }
.pv-card.is-future { opacity: .22; }
.pv-card.is-now { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent), 0 0 30px var(--accent-bg), 0 10px 26px rgba(0, 0, 0, .32); }

/* zoomed out: two big lines instead of four small ones, then only the shape and its colour */
.pv-far { display: none; }
.pv-lod-far .pv-card-top, .pv-lod-far .pv-card-rows, .pv-lod-far .pv-card-pct, .pv-lod-far .pv-edge-num,
.pv-lod-tiny .pv-card-top, .pv-lod-tiny .pv-card-rows, .pv-lod-tiny .pv-card-pct, .pv-lod-tiny .pv-edge-num { display: none; }
.pv-lod-far .pv-card { justify-content: flex-end; padding: 6px 10px 8px; }
.pv-lod-far .pv-far { display: flex; flex-direction: column; min-width: 0; margin-bottom: 7px; }
/* line one: the table (or operator) and its share; line two: the operator, the full width */
.pv-far-s { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.pv-far-t {
  flex: 1 1 auto; min-width: 0;
  font-size: 25px; line-height: 30px; font-weight: 650; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pv-far-k {
  min-width: 0; font-size: 16px; line-height: 21px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pv-far-s b { flex: 0 0 auto; font-family: var(--mono); font-size: 18px; font-weight: 700; color: var(--text-2); }
.pv-card.t-warning .pv-far-s b, .pv-card.t-serious .pv-far-s b, .pv-card.t-critical .pv-far-s b { color: var(--tone); }
.pv-lod-far .pv-card-bar { height: 7px; border-radius: 4px; }
.pv-lod-far .pv-flag, .pv-lod-tiny .pv-flag { font-size: 17px; line-height: 26px; top: -18px; padding: 0 11px; }
.pv-lod-far .pv-card-prog, .pv-lod-tiny .pv-card-prog { height: 7px; }
.pv-lod-tiny .pv-card { justify-content: center; align-items: center; padding: 8px; }
.pv-lod-tiny .pv-card.t-warning, .pv-lod-tiny .pv-card.t-serious, .pv-lod-tiny .pv-card.t-critical { background: var(--tone-bg); border-width: 3px; }
.pv-lod-tiny .pv-card-foot { position: absolute; left: 10px; right: 10px; bottom: 8px; }
.pv-lod-tiny .pv-card-bar { height: 9px; border-radius: 5px; }
.pv-lod-tiny .pv-card-top { display: flex; justify-content: center; }
.pv-lod-tiny .pv-card-names { display: none; }
.pv-lod-tiny .pv-ic { width: 46px; height: 46px; background: none; }
.pv-lod-tiny .pv-icon { width: 40px; height: 40px; stroke-width: 2.2; }
/* the costly ones also show their share, big: the overview becomes a heat map */
.pv-lod-tiny .pv-card.t-warning, .pv-lod-tiny .pv-card.t-serious, .pv-lod-tiny .pv-card.t-critical { flex-direction: row; gap: 10px; }
.pv-lod-tiny .pv-card.t-warning .pv-card-foot, .pv-lod-tiny .pv-card.t-serious .pv-card-foot, .pv-lod-tiny .pv-card.t-critical .pv-card-foot { position: static; }
.pv-lod-tiny .pv-card.t-warning .pv-card-bar, .pv-lod-tiny .pv-card.t-serious .pv-card-bar, .pv-lod-tiny .pv-card.t-critical .pv-card-bar { display: none; }
.pv-lod-tiny .pv-card.t-warning .pv-card-pct, .pv-lod-tiny .pv-card.t-serious .pv-card-pct, .pv-lod-tiny .pv-card.t-critical .pv-card-pct {
  display: block; font-size: 36px; line-height: 40px; min-width: 0; text-align: left;
}

/* ---------- overlays on the stage ------------------------------------------------ */

.pv-tools {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  display: flex; align-items: center; gap: 4px;
  padding: 4px;
  border: 1px solid var(--border); background: var(--surface-1);
  border-radius: var(--r-s); box-shadow: 0 6px 18px rgba(0, 0, 0, .28);
  cursor: default;
}
.pv-tools-sep { width: 1px; height: 18px; background: var(--hairline); margin: 0 3px; }
.pv-btn {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 26px; min-width: 26px; padding: 0 9px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2);
  border-radius: var(--r-xs); cursor: pointer;
  font-size: var(--fs-small); font-weight: 650; white-space: nowrap;
}
.pv-btn:hover:not(:disabled) { background: var(--surface-3); color: var(--text); border-color: var(--border-2); }
.pv-btn:disabled { opacity: .45; cursor: default; }
.pv-btn.is-primary { background: var(--accent-bg); border-color: var(--accent-bd); color: var(--accent); }
.pv-btn.is-primary:hover:not(:disabled) { background: var(--accent-bg); border-color: var(--accent); color: var(--text); }
.pv-btn.pv-sq { padding: 0; width: 26px; font-size: 14px; }
.pv-close { padding: 0; width: 26px; flex: 0 0 auto; }
.pv-close .pv-glyph { width: 10px; height: 10px; }
.pv-zoom { min-width: 40px; text-align: center; font-family: var(--mono); font-size: 10.5px; color: var(--text-3); }

.pv-note-live {
  position: absolute; left: 10px; top: 10px; z-index: 3; max-width: min(460px, calc(100% - 330px));
  display: flex; gap: 7px; align-items: flex-start;
  font-size: var(--fs-small); color: var(--text-2);
  border: 1px solid var(--tone-bd); background: var(--surface-1);
  border-radius: var(--r-s); padding: 6px 9px; cursor: default;
}

.pv-mini {
  position: absolute; right: 10px; bottom: 10px; z-index: 3;
  padding: 5px; border: 1px solid var(--border); background: var(--surface-1);
  border-radius: var(--r-s); box-shadow: 0 6px 18px rgba(0, 0, 0, .28);
  cursor: crosshair; touch-action: none;
}
.pv-mini svg { display: block; }
.pv-mini-node { fill: var(--text-3); opacity: .55; }
.pv-mini-node.t-warning, .pv-mini-node.t-serious { fill: var(--tone); opacity: .95; }
.pv-mini-view { fill: var(--accent-bg); stroke: var(--accent); stroke-width: 1.2; }
.pv.is-story .pv-mini { bottom: auto; top: 52px; }

.pv-story {
  position: absolute; left: 12px; bottom: 12px; z-index: 4;
  width: min(600px, calc(100% - 24px));
  border: 1px solid var(--accent-bd); background: var(--surface-1);
  border-radius: var(--r); box-shadow: 0 14px 34px rgba(0, 0, 0, .42);
  padding: 10px 13px 13px; overflow: hidden; cursor: default;
}
.pv-story-top { display: flex; align-items: center; gap: 9px; min-width: 0; }
.pv-story-step {
  flex: 0 0 auto;
  font-family: var(--mono); font-size: var(--fs-micro); font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--accent); white-space: nowrap;
}
.pv-story-op { flex: 1 1 auto; min-width: 0; font-weight: 650; font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-story-text { margin: 6px 0 10px; font-size: 13.5px; line-height: 1.5; color: var(--text); overflow-wrap: anywhere; }
.pv-story-ctl { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pv-story-hint { margin-left: auto; font-size: var(--fs-micro); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pv-story-track { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--surface-3); }
.pv-story-track i { display: block; height: 100%; background: var(--accent); transition: width .4s ease; }

/* ---------- the side panel --------------------------------------------------------- */

.pv-side {
  flex: 0 0 344px; width: 344px; min-width: 0;
  border-left: 1px solid var(--hairline);
  background: var(--surface-1);
  overflow: auto;
  padding: 13px 15px 18px;
}
.pv.is-narrow .pv-side, .pv.is-compact .pv-side {
  flex: 0 0 auto; width: auto; height: auto;
  border-left: 0; border-top: 1px solid var(--hairline);
}
.pv-sec { margin-top: 14px; }
.pv-sec-first { margin-top: 2px; }
.pv-h {
  display: flex; align-items: center; gap: 6px;
  margin: 0 0 5px;
  font-size: var(--fs-micro); font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pv-p { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--text); overflow-wrap: anywhere; }
.pv-sum-line + .pv-sum-line { margin-top: 7px; }
.pv-note { margin: 0 0 5px; font-size: var(--fs-small); color: var(--text-3); }
.pv-callout {
  border: 1px solid var(--tone-bd); border-left: 3px solid var(--tone);
  background: var(--tone-bg); border-radius: var(--r-xs); padding: 8px 10px 9px;
}
.pv-callout .pv-h { color: var(--text-2); }
.pv-calm {
  display: flex; gap: 7px; align-items: center;
  font-size: var(--fs-small); color: var(--text-2);
  border: 1px solid var(--hairline); border-radius: var(--r-xs); padding: 6px 9px;
}
.pv-hint {
  font-size: var(--fs-small); color: var(--text-3); line-height: 1.5;
  border-top: 1px solid var(--hairline); padding-top: 11px;
}

.pv-det-head { display: flex; align-items: center; gap: 9px; min-width: 0; }
.pv-det-names { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.pv-det-title { font-size: 14px; font-weight: 650; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-det-sub { font-size: var(--fs-small); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pv .pv-nums { width: 100%; border-collapse: collapse; font-size: var(--fs-small); margin-top: 2px; table-layout: fixed; }
.pv .pv-nums th, .pv .pv-nums td {
  position: static; padding: 4px 6px; border: 0; border-bottom: 1px solid var(--hairline);
  background: none; text-align: left; vertical-align: top;
  font-size: var(--fs-small); letter-spacing: 0; text-transform: none;
}
.pv .pv-nums thead th { color: var(--text-3); font-weight: 700; font-size: var(--fs-micro); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.pv .pv-nums tbody th { color: var(--text-3); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 32%; }
.pv .pv-nums td { color: var(--text); font-family: var(--mono); font-variant-numeric: tabular-nums; word-break: break-word; }
.pv .pv-nums tr:hover > td, .pv .pv-nums tr:hover > th { background: var(--surface-2); }
.pv .pv-nums td.is-flag { color: var(--warning); font-weight: 700; }
.pv-kv { margin: 8px 0 0; display: flex; flex-direction: column; gap: 3px; }
.pv-kv-row { display: flex; gap: 10px; min-width: 0; font-size: var(--fs-small); }
.pv-kv dt { flex: 0 0 38%; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; }
.pv-kv dd { flex: 1 1 auto; min-width: 0; margin: 0; color: var(--text); font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-kv-wide dt { flex-basis: 30%; }
.pv-kv-wide dd { white-space: pre-wrap; word-break: break-word; }
.pv-cols { display: flex; flex-wrap: wrap; gap: 4px; }
.pv-col {
  max-width: 100%;
  font-family: var(--mono); font-size: 10.5px; color: var(--text-2);
  border: 1px solid var(--hairline); background: var(--surface-2); border-radius: var(--r-xs);
  padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pv-warns { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pv-warns li { display: flex; gap: 7px; align-items: flex-start; font-size: 12px; color: var(--text); line-height: 1.45; }
.pv-warns li b { color: var(--tone); font-weight: 700; text-transform: capitalize; }

.pv-top { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
/* name and figure on one line, the bar under them: the full width goes to the name */
.pv-top-row {
  appearance: none; width: 100%;
  display: flex; flex-direction: column; align-items: stretch; gap: 3px;
  border: 1px solid transparent; background: none; border-radius: var(--r-xs);
  padding: 4px 6px 5px; cursor: pointer; text-align: left; color: var(--text);
}
.pv-top-row:hover { background: var(--surface-2); border-color: var(--hairline); }
.pv-top-line { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.pv-top-name { flex: 1 1 auto; min-width: 0; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-top-bar { display: block; width: 100%; height: 4px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.pv-top-bar i { display: block; height: 100%; background: var(--tone); border-radius: 3px; }
.pv-top-row.t-muted .pv-top-bar i { background: var(--text-3); }
.pv-top-pct { flex: 0 0 auto; text-align: right; font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--text-2); white-space: nowrap; }

/* ---------- legend and errors ------------------------------------------------------- */

.pv-legend {
  display: flex; align-items: center; gap: 16px;
  padding: 7px 14px;
  border-top: 1px solid var(--hairline);
  font-size: var(--fs-small); color: var(--text-3);
  white-space: nowrap; overflow: hidden;
}
.pv-legend > span { display: inline-flex; align-items: center; gap: 6px; flex: 0 1 auto; min-width: 0; }
.pv-lg-t { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-legend .pv-badge { font-size: 9.5px; }
.pv-warnbub.pv-warnbub-inline { position: static; box-shadow: none; flex: 0 0 auto; min-width: 16px; height: 15px; line-height: 15px; font-size: 9.5px; }
.pv.is-narrow .pv-lg-low { display: none; }
.pv-lg { flex: 0 0 auto; display: inline-block; width: 24px; height: 8px; position: relative; }
.pv-lg-thick { background: none; border-top: 1px solid var(--text-3); border-bottom: 4px solid var(--text-3); height: 9px; opacity: .6; }
.pv-lg-dots { background-image: radial-gradient(circle, var(--accent) 2.4px, transparent 2.8px); background-size: 8px 8px; background-position: 0 0; }
.pv-lg-hot { height: 4px; border-radius: 3px; background: var(--accent); box-shadow: 0 0 6px var(--accent); }

.pv-error {
  margin: 16px; display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--critical-bd); border-left: 3px solid var(--critical);
  background: var(--critical-bg); border-radius: var(--r-s);
  font-size: 12.5px; color: var(--text);
}
.pv-error b { font-size: 13px; }

/* ---------- motion off ---------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion="on"]) .pv-particles { animation: none; opacity: 0; }
  :root:not([data-motion="on"]) .pv-card,
  :root:not([data-motion="on"]) .pv-edges,
  :root:not([data-motion="on"]) .pv-live i { animation: none; }
  :root:not([data-motion="on"]) .pv-card.is-active { box-shadow: 0 0 0 2px var(--accent-bd), 0 6px 16px rgba(0, 0, 0, .22); }
  :root:not([data-motion="on"]) .pv-world.is-glide,
  :root:not([data-motion="on"]) .pv-card,
  :root:not([data-motion="on"]) .pv-edge,
  :root:not([data-motion="on"]) .pv-card-prog i,
  :root:not([data-motion="on"]) .pv-story-track i { transition: none; }
}
:root[data-motion="off"] .pv-particles { animation: none; opacity: 0; }
:root[data-motion="off"] .pv-card,
:root[data-motion="off"] .pv-edges,
:root[data-motion="off"] .pv-live i { animation: none; }
:root[data-motion="off"] .pv-card.is-active { box-shadow: 0 0 0 2px var(--accent-bd), 0 6px 16px rgba(0, 0, 0, .22); }
:root[data-motion="off"] .pv-world.is-glide,
:root[data-motion="off"] .pv-card,
:root[data-motion="off"] .pv-edge,
:root[data-motion="off"] .pv-card-prog i,
:root[data-motion="off"] .pv-story-track i { transition: none; }
