/* Resource profiles per query (design-cpu-mem/SPEC.md, mocks/res.css): the profile panel (.rp, the ratio axis .rx, the
   sandbox-against-production axis .fd), the peak bar (.pk), the list cells (.rc, .rl), the three bar lists (.tri, .wl),
   the tiles. Tokens only: both themes. Positions on an axis are SVG attributes in percent, computed in resources.py. */
/* ---- the profile table: one row per resource ------------------------------------------------ */
.rp { width: 100%; border-collapse: collapse; table-layout: fixed; }
.rp th { padding: var(--sp-3) var(--sp-4); text-align: left; font-size: var(--fs-2); font-weight: 500; color: var(--ink-3); background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp th > i { font-style: normal; color: var(--ink-3); opacity: .8; }
.rp td { padding: var(--sp-4); border-bottom: 1px solid var(--line); vertical-align: top; min-width: 0; overflow: hidden; }
.rp tr:last-child > td { border-bottom: 0; }
.rp .l1, .rp .l2 { display: flex; align-items: baseline; gap: var(--sp-3); min-width: 0; white-space: nowrap; }
.rp .l1 > span, .rp .l2 > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.rp .l2 { color: var(--ink-3); font-size: var(--fs-2); margin-top: 3px; }
.rp .l1 > b { font-weight: 600; }
.rp .mono { font-family: var(--font-mono); }
.rp-name > b { display: block; font-weight: 600; }
.rp-name > span { display: block; color: var(--ink-3); font-size: var(--fs-2); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp tr.is-decides td:first-child { box-shadow: inset 3px 0 0 var(--ink-2); }
.rp tr.is-quiet td { background: var(--surface-2); }
/* PostgreSQL's busy time in the CPU row's place: its qualifier and source are said in full, wrapped, never cut */
.rp tr.is-busy .rp-name > span, .rp tr.is-wrap .rp-name > span, .rp tr.is-busy .l2, .rp tr.is-wrap .l2 { white-space: normal; }
.rp tr.is-busy .l2 > span, .rp tr.is-wrap .l2 > span { overflow: visible; }
.rp .none { color: var(--ink-3); }
.x { font: 600 var(--fs-3)/1.3 var(--font-mono); }
.x.is-win { color: var(--win); }
.x.is-worse { color: var(--fail); }
.x.is-same { color: var(--ink-2); }

/* the ratio axis: 0 … today (x1) … x1.5, one scale for every row of a profile. An <svg> without a viewBox. */
.rx { display: block; width: 100%; height: 18px; overflow: visible; }
.rx-track { fill: var(--surface-3); }
.rx-fill { fill: var(--ink-3); }
.rx-fill.is-win { fill: var(--win); }
.rx-fill.is-same { fill: var(--ink-3); opacity: .6; }
.rx-fill.is-worse { fill: var(--fail-bg); stroke: var(--fail); stroke-width: 1.5; stroke-dasharray: 3 2; }
.rx-range { stroke: var(--ink); stroke-width: 1.5; }
.rx-one { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 2 2; }
.rx-over { fill: var(--fail); }
.rx-scale { display: block; width: 100%; height: 14px; overflow: visible; }
.rx-scale text { font: 400 11px/1 var(--font-mono); fill: var(--ink-3); }
.rx-scale line { stroke: var(--line-strong); }

/* sandbox against production, per run: a log axis x1/4 … x4 with the "close" (x1.5) and "near" (x3) bands */
.fd { display: block; width: 100%; height: 14px; overflow: visible; }
.fd-near { fill: var(--surface-3); }
.fd-close { fill: var(--win-bg); stroke: var(--win); stroke-width: 1; }
.fd-mid { stroke: var(--ink-3); stroke-width: 1; }
.fd-dot { fill: var(--ink); }
.fd-dot.is-off { fill: var(--surface); stroke: var(--fail); stroke-width: 2; }
.fd-dot.is-near { fill: var(--warn); }
.fd-grade { font-size: var(--fs-2); }
.fd-grade.is-close { color: var(--win); }
.fd-grade.is-near { color: var(--warn); }
.fd-grade.is-off { color: var(--fail); }

/* a peak is not a sum: typical, p95 and max of one shape on one scale, with the server's limit as a rule */
.pk { display: block; width: 100%; height: 16px; overflow: visible; }
.pk-track { fill: var(--surface-3); }
.pk-max { fill: var(--ink-3); opacity: .35; }
.pk-p95 { fill: var(--ink-3); opacity: .7; }
.pk-p50 { fill: var(--ink); }
.pk-limit { stroke: var(--fail); stroke-width: 1.5; }
.pk-est { fill: none; stroke: var(--win); stroke-width: 1.5; stroke-dasharray: 3 2; }
.pk-key { display: flex; flex-wrap: wrap; gap: var(--sp-5); color: var(--ink-3); font-size: var(--fs-2); }
.pk-key i { display: inline-block; width: 10px; height: 8px; margin-right: 4px; vertical-align: -1px; background: var(--ink-3); }
.pk-key i.is-p50 { background: var(--ink); }
.pk-key i.is-p95 { opacity: .7; }
.pk-key i.is-max { opacity: .35; }
.pk-key i.is-limit { width: 2px; height: 12px; background: var(--fail); vertical-align: -2px; }
.pk-key i.is-est { background: none; border: 1.5px dashed var(--win); }

/* panel legends and footers */
.rp-key { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3) var(--sp-6); color: var(--ink-3); font-size: var(--fs-2); }
.rp-key i { display: inline-block; width: 14px; height: 8px; margin-right: 4px; vertical-align: -1px; border-radius: 1px; }
.rp-key i.is-win { background: var(--win); }
.rp-key i.is-worse { background: var(--fail-bg); border: 1.5px dashed var(--fail); }
.rp-key i.is-range { height: 2px; background: var(--ink); vertical-align: 3px; }
.rp-key i.is-one { width: 0; height: 12px; border-left: 1px dashed var(--ink-2); vertical-align: -2px; }
.rp-key i.is-close { background: var(--win-bg); border: 1px solid var(--win); }
.rp-key i.is-near { background: var(--surface-3); }

/* list cells */
.rc { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 2px var(--sp-4); }
.rc > .bar, .rc > svg { grid-column: 1 / -1; }
.rc-v { font: 600 var(--fs-3)/1.3 var(--font-mono); white-space: nowrap; }
.rc-s { text-align: right; color: var(--ink-3); font-size: var(--fs-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.bar.is-cpu > span { background: var(--accent); }
.rl { width: 100%; border-collapse: collapse; table-layout: fixed; }
.rl th { padding: var(--sp-3) var(--sp-4); text-align: left; font-size: var(--fs-2); font-weight: 500; color: var(--ink-3); background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rl th[aria-sort] { color: var(--ink); font-weight: 600; }
.rl td { padding: var(--sp-4); border-bottom: 1px solid var(--line); vertical-align: top; min-width: 0; overflow: hidden; }
.rl tr:last-child > td { border-bottom: 0; }
.rl .l1, .rl .l2 { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; white-space: nowrap; }
.rl .l2 { color: var(--ink-3); font-size: var(--fs-2); margin-top: 3px; }
.rl .clip { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.rl .l1 > b { font-weight: 600; }
.rl td.is-sorted { background: color-mix(in srgb, var(--accent-bg) 45%, transparent); }

/* three bar lists side by side inside one panel */
.tri { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
.tri > div { padding: var(--sp-5); border-left: 1px solid var(--line); min-width: 0; }
.tri > div:first-child { border-left: 0; }
.wl { display: grid; grid-template-columns: minmax(0, 1fr) 4.2rem; gap: 3px var(--sp-4); align-items: center; margin-top: var(--sp-4); }
.wl-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-2); }
.wl-num { font: 500 var(--fs-2)/1.3 var(--font-mono); text-align: right; white-space: nowrap; }
.wl > .bar { grid-column: 1 / -1; margin-bottom: var(--sp-3); }


.hand { margin: 0; padding: var(--sp-5); font: 400 var(--fs-2)/1.55 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); background: var(--surface-2); border-radius: 0 0 var(--r-3) var(--r-3); }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-5); }
.tile { padding: var(--sp-5); border: 1px solid var(--line); border-radius: var(--r-3); background: var(--surface); min-width: 0; }
.tile .stat-value { font: 600 var(--fs-6)/1.2 var(--font-mono); }
.tile .l2 { color: var(--ink-3); font-size: var(--fs-2); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .label { display: block; margin-bottom: var(--sp-2); }

.pair .x { font-size: inherit; }
.rl .spark { height: 26px; }

/* the panel's foot: the legend, then "All numbers" (a disclosure that opens under it, full width) */
.rp-foot { flex-wrap: wrap; }
.rp-all { margin-left: auto; }
.rp-all > summary { cursor: pointer; color: var(--accent); list-style: none; }
.rp-all > summary::-webkit-details-marker { display: none; }
.rp-all[open] { flex-basis: 100%; margin-left: 0; }
.rp-all[open] > summary { text-align: right; margin-bottom: var(--sp-3); }
.rp-all .tbl-wrap { border: 1px solid var(--line); border-radius: var(--r-2); }
.rp-num { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: var(--fs-2); }
.rp-num th, .rp-num td { padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-num th:first-child, .rp-num td:first-child { text-align: left; }
.rp-num th { color: var(--ink-3); font-weight: 500; background: var(--surface-2); }
.rp-num td { font-family: var(--font-mono); }
.rp-num td:first-child { font-family: inherit; }
.rp-num tr:last-child > td { border-bottom: 0; }
.rp-facts { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); margin-top: var(--sp-3); color: var(--ink-3); font-size: var(--fs-2); }
/* the change table's CPU and memory cells */
.fx .x { font-size: var(--fs-2); }
.rp-x { display: inline-flex; align-items: baseline; gap: var(--sp-3); min-width: 0; }
/* the Rank by switch of the lists */
.rank { display: inline-flex; align-items: center; gap: var(--sp-3); }
.rank > .label { margin: 0; }
.seg > .seg-off { height: calc(var(--ctl) - 4px); }
@media (max-width: 1239px) { .tri { grid-template-columns: minmax(0, 1fr); } .tri > div { border-left: 0; border-top: 1px solid var(--line); } .tri > div:first-child { border-top: 0; } .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tiles a.tile { color: inherit; text-decoration: none; }
.tiles a.tile:hover { border-color: var(--line-strong); }
.tile .l2 .chip { vertical-align: 1px; }
/* "All numbers": headers wrap and values break at their spaces; nothing is cut */
.rp-num th { white-space: normal; overflow: visible; vertical-align: bottom; }
.rp-num td { white-space: normal; overflow: visible; overflow-wrap: anywhere; }
.rp-key { margin-left: var(--sp-2); color: var(--ink-2); }
