/* ============================================================
   CORTEX — self-contained stylesheet
   Palette and controls referenced from /glitch-fx/css/style.css
   (independent copy).
   ============================================================ */

* {
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
}

@font-face {

    font-display: swap;
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 100 800;
    src: url('../fonts/jetbrains-mono-vf.ttf') format('truetype');

}

:root {

    --fx-purple:        #6c47ff;
    --fx-purple-soft:   #221456;
    --fx-purple-glow:   hsla(252, 100%, 64%, 0.45);
    --fx-purple-glow-alt:   hsla(252, 100%, 64%, 0.2);
    --fx-red:           color(display-p3 1 .25 .39);
    --fx-green:         color(display-p3 0.3 1 0.7);
    --fx-green-soft:    color(display-p3 0.3 1 0.7 / 0.15);
    --fx-yellow:        color(display-p3 1 0.7 0.18);
    --fx-cyan:          color(display-p3 0.35 0.85 1);
    --fx-magenta:       color(display-p3 1 0.3 0.85);

    --fx-txt:           hsl(240, 20%, 80%);
    --fx-txt-dim:       hsl(240, 10%, 50%);
    --fx-txt-low:       hsl(240, 15%, 30%);

    --fx-bg:            #111117;
    --fx-bg-2:          #15151d;
    --fx-bg-3:          #232333;
    --fx-bg-4:          #1c1c28;
    --fx-bg-toggle:     #323248;
    --fx-range-trail:   #39267f;
    --fx-line:          hsla(240, 15%, 25%, 0.5);
    --fx-line-strong:   hsla(240, 15%, 30%, 0.85);

    --fx-pad:           1.5em;
    --fx-radius:        0.5em;
    --fx-radius-small:  0.25em;
    --fx-mono:          "JetBrains Mono", Consolas, "Andale Mono", "DejaVu Sans Mono", "Liberation Mono", Monaco, "Courier New", Courier, monospace;
    --fx-letter-spacing: 0;
    --fx-letter-spacing-progress-bar: 0.1em;

    /* Chart series. The purple is one step lighter than --fx-purple so a
       2px line keeps its contrast against the card surface. */
    --cx-series-purple:  hsl(252, 100%, 70%);
    --cx-series-green:   var(--fx-green);
    --cx-series-cyan:    var(--fx-cyan);
    --cx-series-yellow:  var(--fx-yellow);
    --cx-series-magenta: var(--fx-magenta);
    --cx-series-red:     var(--fx-red);
    --cx-series-muted:   hsl(240, 12%, 42%);

}

html, body {
    height: 100%;
    background: var(--fx-bg);
    color: var(--fx-txt);
    font-family: var(--fx-mono);
    font-size: 15px;
    line-height: 1.4;
    font-weight: 500;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Layout ---------- */

.app {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100%;
}

.app-header {
    display: flex;
    align-items: center;
    gap: 1em;
    padding: 1.25em var(--fx-pad);
    border-bottom: 1px solid var(--fx-line);
    background: var(--fx-bg-2);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.85em;
    flex: 1;
    min-width: 0;
}

.brand-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    line-height: 1.05;
    font-size: 0.9em;
    letter-spacing: var(--fx-letter-spacing);
    text-transform: uppercase;
    padding-left: 1em;
    border-left: 2px solid hsl(240deg 15% 25%);
    pointer-events: none;
}
/* Both lines give way to the status on narrow screens. */
.brand-name,
.brand-sub {
    font-size: 0.85em;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.brand-name { color: var(--fx-txt); }
.brand-sub { color: var(--fx-txt-dim); }

/* Server state, right of the brand. */
.app-status {
    display: flex;
    align-items: center;
    gap: 0.7em;
    font-size: 0.78em;
    font-weight: 700;
    letter-spacing: var(--fx-letter-spacing);
    text-transform: uppercase;
    color: var(--fx-txt-dim);
    white-space: nowrap;
    flex: 0 0 auto;
    --state: var(--fx-txt-low);
}
.app-status-extra:empty { display: none; }
.app-status-dot {
    width: 0.7em;
    height: 0.7em;
    border-radius: 50%;
    background: var(--state);
    flex-shrink: 0;
}
.app-status[data-state="online"]  { --state: var(--fx-green);  color: var(--fx-txt); }
.app-status[data-state="warn"]    { --state: var(--fx-yellow); color: var(--fx-txt); }
.app-status[data-state="offline"] { --state: var(--fx-red);    color: var(--fx-txt); }

.app-header-nxd {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}
/* Logo is painted via mask so it can be recoloured on hover / active. */
.app-header-nxd-mark {
    display: block;
    height: 1.6em;
    width: calc(1.6em * (200 / 56));
    background-color: var(--fx-txt);
    transition: background-color 0.15s ease;
    -webkit-mask: url("../img/nxdco.logo.svg") no-repeat center / contain;
    mask: url("../img/nxdco.logo.svg") no-repeat center / contain;
}
.app-header-nxd:hover .app-header-nxd-mark,
.app-header-nxd:focus-visible .app-header-nxd-mark {
    background-color: #e4e4f0;
}
.app-header-nxd:active .app-header-nxd-mark {
    background-color: #ffffff;
}

/* History on the left, the live panel on the right. */
.app-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 26em;
    min-height: 0;
}

.panel {
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

.panel-stage {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    background: var(--fx-bg);
}

.panel-controls {
    background: var(--fx-bg-2);
    overflow-y: auto;
    border-left: 1px solid var(--fx-line);
}

/* ---------- Stage ---------- */

.stage {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--fx-pad);
    padding: var(--fx-pad);
    container-type: inline-size;
}
.stage > * { flex: 0 0 auto; }

/* ---------- Live headline figures ---------- */

.kpis {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 1px;
    background: var(--fx-line);
    border: 1px solid var(--fx-line);
    border-radius: var(--fx-radius);
    overflow: hidden;
}
/* Column counts all divide the six tiles, so no row is left half empty. */
@container (max-width: 78em) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@container (max-width: 32em) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.kpi {
    display: flex;
    flex-direction: column;
    gap: 0.55em;
    min-width: 0;
    padding: 1.1em 1.2em 1.2em;
    background: var(--fx-bg-2);
}

.kpi-label {
    font-size: 0.78em;
    font-weight: 700;
    letter-spacing: var(--fx-letter-spacing);
    text-transform: uppercase;
    color: var(--fx-txt-dim);
}
.kpi-value {
    font-size: 1.75em;
    font-weight: 700;
    line-height: 1.1;
    color: var(--fx-txt);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.2s;
}
.kpi-value small {
    margin-left: 0.4em;
    font-size: 0.45em;
    font-weight: 700;
    color: var(--fx-txt-dim);
    text-transform: uppercase;
}
.kpi-value small:empty { display: none; }
.kpi-sub {
    font-size: 0.78em;
    color: var(--fx-txt-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kpi .meter { margin-top: 0.2em; }
/* Tiles without a meter keep the same height as the ones with. */
.kpi:not(:has(.meter))::after {
    content: "";
    height: 0.4em;
    margin-top: 0.2em;
}

/* ---------- Meter ---------- */

.meter {
    height: 0.4em;
    border-radius: 1em;
    background: var(--fx-bg-3);
    overflow: hidden;
}
.meter > span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: 1em;
    background: var(--fx-purple);
    transition: width 0.4s ease, background 0.2s;
}
.meter.is-warn > span { background: var(--fx-yellow); }
.meter.is-crit > span { background: var(--fx-red); }
.meter.is-good > span { background: var(--fx-green); }

/* ---------- History: section bar with the range buttons ---------- */

.section-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.8em 1em;
}
.section-title {
    font-size: 0.85em;
    font-weight: 700;
    letter-spacing: var(--fx-letter-spacing);
    text-transform: uppercase;
    color: var(--fx-purple);
}
.section-note {
    font-size: 0.78em;
    color: var(--fx-txt-dim);
    text-transform: uppercase;
    white-space: nowrap;
}
.section-rule {
    flex: 1 1 2em;
    height: 1px;
    background: var(--fx-line);
}
.range {
    display: flex;
    gap: 0.4em;
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4em;
    padding: 0.85em 1.2em;
    font-family: inherit;
    font-size: 0.85em;
    font-weight: 700;
    letter-spacing: var(--fx-letter-spacing);
    color: var(--fx-txt);
    background: var(--fx-bg-3);
    border: 1px solid var(--fx-line-strong);
    border-radius: var(--fx-radius);
    cursor: pointer;
    user-select: none;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    text-transform: uppercase;
}
.btn:hover {
    border-color: var(--fx-purple);
    color: var(--fx-purple);
    background: var(--fx-purple-soft);
}
.btn:focus-visible {
    outline: 2px solid var(--fx-purple);
    outline-offset: 2px;
}
.btn-ghost {
    background: transparent;
    border-color: var(--fx-line);
    color: var(--fx-txt-dim);
}
.btn-ghost:hover {
    color: var(--fx-purple);
    border-color: var(--fx-purple);
}
.btn-mini {
    padding: 0.5em 0.8em;
    font-size: 0.78em;
    letter-spacing: var(--fx-letter-spacing);
}
.btn.is-active,
.btn.is-active:hover {
    background: var(--fx-purple);
    border-color: var(--fx-purple);
    color: #fff;
}

/* ---------- History: totals for the range ---------- */

.totals {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 1.2em 1.5em;
    padding: 1.2em;
    background: var(--fx-bg-2);
    border: 1px solid var(--fx-line);
    border-radius: var(--fx-radius);
    transition: opacity 0.2s;
}
/* Like the tiles above: column counts that divide the eight figures. */
@container (max-width: 78em) { .totals { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@container (max-width: 34em) { .totals { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.total {
    display: flex;
    flex-direction: column;
    gap: 0.35em;
    min-width: 0;
}
.total-num {
    font-size: 1.25em;
    font-weight: 700;
    line-height: 1.1;
    color: var(--fx-txt);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.total-num small {
    margin-left: 0.35em;
    font-size: 0.6em;
    color: var(--fx-txt-dim);
    text-transform: uppercase;
}
.total-num.is-bad { color: var(--fx-red); }
.total-label {
    font-size: 0.72em;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--fx-txt-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- History: charts ---------- */

.charts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 27em), 1fr));
    gap: 1em;
}
.totals.is-loading,
.charts.is-loading .chart-body,
.charts.is-loading .chart-legend {
    opacity: 0.35;
}

.chart {
    min-width: 0;
    background: var(--fx-bg-2);
    border: 1px solid var(--fx-line);
    border-radius: var(--fx-radius);
    overflow: hidden;
}
/* Card header: title row and legend on a lighter strip, a line below. */
.chart-top {
    padding: 0.95em 1.2em 1em;
    background: var(--fx-bg-4);
    border-bottom: 1px solid var(--fx-line);
}
.chart-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1em;
    margin-bottom: 0.15em;
}
.chart-title {
    display: flex;
    align-items: center;
    gap: 0.7em;
    font-size: 0.85em;
    font-weight: 700;
    letter-spacing: var(--fx-letter-spacing);
    text-transform: uppercase;
    color: var(--fx-txt);
    white-space: nowrap;
}
/* The kit swaps <i> for <svg> in its SVG mode; cover both. */
.chart-title > i,
.chart-title > svg {
    flex-shrink: 0;
    color: var(--fx-txt-dim);
}
.chart-sub {
    min-width: 0;
    font-size: 0.72em;
    color: var(--fx-txt-dim);
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chart.is-hover .chart-sub { color: var(--fx-txt); }

/* Legend and readout in one: the values follow the crosshair. */
/* One line of inline text, so what does not fit ends in "…" instead of wrapping. */
.chart-legend {
    font-size: 0.78em;
    color: var(--fx-txt-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.2s;
}
.chart-key { margin-right: 1.4em; }
.chart-key:last-child { margin-right: 0; }
.chart-key i {
    display: inline-block;
    vertical-align: middle;
    width: 0.9em;
    height: 2px;
    margin-right: 0.55em;
    border-radius: 1px;
    background: var(--c);
}
.chart-key.is-bar i {
    width: 0.6em;
    height: 0.6em;
    border-radius: 2px;
}
.chart-key.is-dot i {
    width: 0.6em;
    height: 0.6em;
    border-radius: 50%;
}
.chart-key b {
    margin-right: 0.55em;
    font-weight: 700;
    color: var(--fx-txt);
    font-variant-numeric: tabular-nums;
}

.chart-body {
    display: grid;
    grid-template-columns: 3.6em minmax(0, 1fr);
    grid-template-rows: 9.5em 1.6em;
    padding: 1.4em 1.2em 0.9em;
    transition: opacity 0.2s;
}
.chart-y,
.chart-x {
    position: relative;
    font-size: 0.68em;
    color: var(--fx-txt-dim);
    font-variant-numeric: tabular-nums;
}
.chart-y { font-size: inherit; }
.chart-y span {
    position: absolute;
    right: 0.9em;
    font-size: 0.68em;
    line-height: 1;
    transform: translateY(50%);
    white-space: nowrap;
}
.chart-x {
    grid-column: 2;
    font-size: inherit;
}
.chart-x span {
    position: absolute;
    top: 0.75em;
    font-size: 0.68em;
    line-height: 1;
    transform: translateX(-50%);
    white-space: nowrap;
}

.chart-plot {
    position: relative;
    min-width: 0;
    cursor: crosshair;
    touch-action: pan-y;
}
.chart-plot svg {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}
.chart-grid line {
    stroke: var(--fx-line);
    stroke-width: 1px;
    vector-effect: non-scaling-stroke;
}
.chart-line {
    fill: none;
    stroke: var(--c);
    stroke-width: 2px;
    stroke-linejoin: round;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}
.chart-area {
    fill: var(--c);
    opacity: 0.1;
}
/* One dot per measurement: a zero-length stroke with a round cap. */
.chart-dots {
    fill: none;
    stroke: var(--c);
    stroke-width: 4px;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}
.chart-dots.is-solid { stroke-width: 5px; }
/* The trend through the dots is a guide, not data: thin, neutral and faint,
   so it stays readable where it crosses dots of the series colour. */
.chart-trend {
    stroke: var(--fx-txt);
    stroke-width: 1.5px;
    opacity: 0.55;
}
/* From a step's average up to its longest value. */
.chart-stems {
    fill: none;
    stroke: var(--c);
    stroke-width: 1.5px;
    vector-effect: non-scaling-stroke;
}
/* Bars are strokes, so their width is in pixels whatever the card's size. */
.chart-bars {
    fill: none;
    stroke: var(--c);
    stroke-width: 3px;
    vector-effect: non-scaling-stroke;
}

.chart-cross {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    margin-left: -0.5px;
    background: var(--fx-txt-dim);
    pointer-events: none;
    display: none;
}
.chart-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    margin: -4px 0 0 -4px;
    border-radius: 50%;
    background: var(--c);
    box-shadow: 0 0 0 2px var(--fx-bg-2);
    pointer-events: none;
    display: none;
}
.chart.is-hover .chart-cross { display: block; }
.chart.is-hover .chart-dot.is-on { display: block; }

.chart-empty {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
    font-size: 0.78em;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--fx-txt-low);
    border: 1px dashed var(--fx-line-strong);
    border-radius: var(--fx-radius);
    cursor: default;
}
.chart.is-empty .chart-empty { display: grid; }
/* Only the plot's own drawing: the title icon is an svg too. */
.chart.is-empty .chart-plot svg,
.chart.is-empty .chart-y,
.chart.is-empty .chart-x { visibility: hidden; }

/* ---------- Live panel ---------- */

.ctl-section {
    border-bottom: 1px solid var(--fx-line);
    padding: var(--fx-pad);
}

.ctl-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.1em;
}

.ctl-section.is-collapsible .ctl-section-head {
    cursor: pointer;
    user-select: none;
}
.ctl-section.is-collapsible:not(.is-open) .ctl-section-head {
    margin-bottom: 0;
}
.ctl-section.is-collapsible:not(.is-open) .ctl-section-body {
    display: none;
}
.ctl-section-caret {
    color: var(--fx-txt-low);
    font-size: 0.85em;
    line-height: 1;
}
.ctl-section-caret .fa-angle-up { display: none; }
.ctl-section.is-open .ctl-section-caret .fa-angle-down { display: none; }
.ctl-section.is-open .ctl-section-caret .fa-angle-up { display: inline; }

.ctl-title {
    display: flex;
    align-items: center;
    gap: 0.7em;
    font-size: 0.85em;
    font-weight: 700;
    letter-spacing: var(--fx-letter-spacing);
    color: var(--fx-txt);
}
/* The kit swaps <i> for <svg> in its SVG mode; cover both. */
.ctl-title > i,
.ctl-title > svg {
    flex-shrink: 0;
    color: var(--fx-txt-dim);
}

.ctl-note {
    margin-top: 1em;
    font-size: 0.78em;
    color: var(--fx-txt-dim);
    line-height: 1.5;
}
.ctl-note:empty { display: none; }

/* Label / value row, optionally with a meter spanning below it. */
.fx-param {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 0.35em 1em;
    margin-bottom: 0.25em;
}
.fx-param:last-child { margin-bottom: 0; }
.fx-param:has(.meter) { margin-bottom: 1em; }
.fx-param:has(.meter):last-child { margin-bottom: 0; }

.fx-param-label {
    font-size: 0.8em;
    color: var(--fx-txt-dim);
    letter-spacing: var(--fx-letter-spacing);
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fx-param-val {
    font-size: 0.8em;
    color: var(--fx-green);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
    transition: opacity 0.2s;
}
.fx-param-val.is-warn { color: var(--fx-yellow); }
.fx-param-val.is-bad  { color: var(--fx-red); }
.fx-param-val.is-off  { color: var(--fx-txt-dim); }
.fx-param .meter { grid-column: 1 / -1; }

/* Groups injected between static rows keep the same rhythm. */
[data-bind="slots"]:not(:empty),
[data-bind="tiers"]:not(:empty),
[data-bind="mem-legend"]:not(:empty) { margin-bottom: 1em; }
[data-bind="fans"]:not(:empty) { margin-top: 1em; }

.effects-list {
    display: flex;
    flex-direction: column;
    gap: 0.7em;
}

/* One card per loaded model. */
.fx-card {
    border: 1px solid var(--fx-line);
    border-radius: var(--fx-radius);
    background: var(--fx-bg);
    overflow: hidden;
}
.fx-head {
    display: flex;
    align-items: center;
    gap: 0.85em;
    padding: 0.85em 1em;
    background: var(--fx-bg-4);
}
.fx-name {
    flex: 1;
    min-width: 0;
    font-size: 0.9em;
    font-weight: 700;
    letter-spacing: var(--fx-letter-spacing);
    color: var(--fx-purple);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fx-tag {
    flex-shrink: 0;
    font-size: 0.78em;
    font-weight: 700;
    color: var(--fx-green);
}
.fx-body {
    padding: 1em 1em 1.1em;
    border-top: 1px solid var(--fx-line);
    background: var(--fx-bg-2);
}

.ctl-empty {
    padding: 1.2em 1em;
    font-size: 0.8em;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    color: var(--fx-txt-low);
    border: 1px dashed var(--fx-line-strong);
    border-radius: var(--fx-radius);
}

/* CPU tier: one bar per core, filled from the bottom. */
.tier { margin-bottom: 1em; }
.tier:last-child { margin-bottom: 0; }
.cores {
    display: grid;
    grid-template-columns: repeat(var(--cols, 12), minmax(0, 1fr));
    gap: 3px;
    height: 2.6em;
    margin-top: 0.5em;
}
.core {
    position: relative;
    border-radius: 2px;
    background: var(--fx-bg-3);
    overflow: hidden;
}
.core > span {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 0;
    background: var(--fx-purple);
    transition: height 0.4s ease;
}

/* Memory: one bar split into its parts, legend below. */
.ratio {
    display: flex;
    gap: 2px;
    height: 0.75em;
    margin-bottom: 1em;
    border-radius: 1em;
    overflow: hidden;
    background: var(--fx-bg-3);
}
.ratio:empty { display: none; }
.ratio-seg {
    height: 100%;
    min-width: 2px;
    background: var(--c);
    transition: width 0.4s ease;
}
.ratio-legend .fx-param-label {
    display: flex;
    align-items: center;
    gap: 0.65em;
}
.ratio-legend .fx-param-label::before {
    content: "";
    width: 0.65em;
    height: 0.65em;
    border-radius: 2px;
    background: var(--c);
    flex-shrink: 0;
}

/* ---------- Scrollbars ---------- */
.panel-controls::-webkit-scrollbar,
.stage::-webkit-scrollbar { width: 0.5em; }
.panel-controls::-webkit-scrollbar-track,
.stage::-webkit-scrollbar-track { background: transparent; }
.panel-controls::-webkit-scrollbar-thumb,
.stage::-webkit-scrollbar-thumb {
    background: var(--fx-line-strong);
    border-radius: 1em;
}
.panel-controls::-webkit-scrollbar-thumb:hover,
.stage::-webkit-scrollbar-thumb:hover { background: var(--fx-purple); }

/* ---------- Responsive ---------- */
@media (max-width: 800px) {
    /* The page scrolls as a whole: figures, history, then the live panel. */
    html, body {
        height: auto;
        min-height: 100%;
        overflow: auto;
        overflow-x: hidden;
    }
    .app { display: block; height: auto; }
    .app-main { display: block; }
    .panel { overflow: visible; }
    .stage { overflow: visible; }
    .panel-controls {
        border-left: 0;
        border-top: 1px solid var(--fx-line);
        overflow: visible;
    }
    .app-header {
        position: sticky;
        top: 0;
        z-index: 20;
    }
    .app-status-extra { display: none; }
    .range { flex: 1 0 100%; }
    .range .btn { flex: 1 1 0; }
    .section-rule { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

@supports (corner-shape: superellipse(2)) {

    :root {

        --fx-radius:        1em;
        --fx-radius-small:  0.5em;

    }

    .btn,
    .kpis,
    .totals,
    .chart,
    .chart-empty,
    .fx-card,
    .ctl-empty {
        corner-shape: superellipse(2);
    }

}
