/* Plots use their card's content width and the aspect ratio of their viewBox.
 * Do not pad SVGs, cap their height independently, or stretch a signal: several
 * click-to-seek handlers map the SVG bounding width directly to source time. */
.rs-app.rs-professional .rs-reading-surface .pa-workspace :is(
  .pa-recovery-canvas,.pa-coordination-canvas,.ai-coordinate-canvas,
  .ka-signal-chart,.ai-chart,.md-plot,.ob-joint-row,.ar-path-canvas,
  .mp-trace-frame,.mp-trace-stage,.ob-mini-plot,.ob-lumbar-range
) {
  min-width:0;
  max-width:100%;
  box-sizing:border-box;
}

/* Remove legacy 490–520px caps and height constraints. The SVG's intrinsic
 * ratio keeps coordinates and curves proportional at every available width. */
.rs-app.rs-professional .rs-reading-surface .pa-workspace :is(
  svg.ai-chart,.ai-chart>svg,.ka-signal-chart>svg,.ka-work-chart,
  .md-plot>svg,.ob-joint-row>svg,.pa-motion .pa-motion-svg,
  .pa-motion .pa-motion-svg.pa-recovery-svg,
  .pa-motion .pa-motion-svg.pa-coordination-svg,
  .ai-coordinate-canvas>svg,.ar-card .ar-chart,.sg-curve,.pa-atlas,
  .pa-tile-plot
) {
  display:block;
  width:100%;
  height:auto;
  min-height:0;
  max-width:none;
  max-height:none;
  padding:0;
  border:0;
  margin-inline:0;
  overflow:visible;
}

/* Square pose/vector diagrams stay square and centred, without the horizontal
 * gutter of a full-width SVG viewport around a smaller centred drawing. */
.rs-app.rs-professional .rs-reading-surface .pa-workspace :is(
  svg.ai-chart-square,.ai-chart-square>svg,
  .pa-motion .pa-motion-svg.pa-motion-square,.sg-vector
) {
  width:100%;
  height:auto;
  max-width:26rem;
  max-height:none;
  margin-inline:auto;
}

/* A compact metric chart should fill the tile rather than sit as a 240px
 * thumbnail in its middle. Caption and key can wrap independently below it. */
.rs-app.rs-professional .rs-reading-surface .pa-workspace .ob-mini-plot {
  width:100%;
  height:auto;
  margin:12px 0 0;
  padding:10px 0 0;
}
.rs-app.rs-professional .rs-reading-surface .pa-workspace .ob-mini-plot:not(.ob-mini-plot-empty) {
  background:transparent;
  border:0;
  border-radius:0;
  box-shadow:none;
}
.rs-app.rs-professional .rs-reading-surface .pa-workspace :is(
  .ob-mini-plot>svg,.ob-lumbar-range>svg
) {
  display:block;
  width:100%;
  height:auto;
  max-width:none;
  max-height:none;
  padding:0;
  border:0;
  margin-inline:0;
  overflow:visible;
}
.rs-app.rs-professional .rs-reading-surface .pa-workspace .ob-kpi-spark {
  width:100%;
  height:auto;
  aspect-ratio:550 / 190;
  max-height:none;
  margin:12px 0 0;
}
.rs-app.rs-professional .rs-reading-surface .pa-workspace .ob-mini-plot figcaption {
  display:flex;
  flex-wrap:wrap;
  align-items:baseline;
  gap:6px 12px;
  margin:10px 0 0;
  overflow-wrap:anywhere;
}
.rs-app.rs-professional .rs-reading-surface .pa-workspace .ob-mini-legend {
  flex-wrap:wrap;
  gap:8px;
}
.rs-app.rs-professional .rs-reading-surface .pa-workspace .ob-mini-plot-empty {
  padding:12px;
  min-height:0;
}

/* Keep HTML axes, SVG traces and the cursor on the same responsive width.
 * The dense activation map retains its own accessible horizontal scroller. */
.rs-app.rs-professional .rs-reading-surface .pa-workspace .mp-trace-frame {
  width:100%;
  height:auto;
  max-width:none;
  margin-inline:0;
}
.rs-app.rs-professional .rs-reading-surface .pa-workspace .mp-trace-stage {
  aspect-ratio:480 / 180;
}
.rs-app.rs-professional .rs-reading-surface .pa-workspace .mp-trace-svg {
  display:block;
  width:100%;
  height:auto;
  aspect-ratio:480 / 180;
  max-height:none;
  border:0;
  padding:0;
  overflow:visible;
}
.rs-app.rs-professional .rs-reading-surface .pa-workspace .mp-map-scroll {
  max-width:100%;
  min-width:0;
  overflow-x:auto;
  overscroll-behavior-x:contain;
}
.rs-app.rs-professional .rs-reading-surface .pa-workspace :is(
  .ka-chart-legend,.mp-trace-legend,.pa-coordination-readouts,.ob-legend
) {
  flex-wrap:wrap;
  max-width:100%;
}

/* Signal Lab uses width-based seeking as well. A forced minimum height can
 * letterbox the drawing and make the visible time axis differ from hit tests. */
.rs-app.rs-professional .rx-signal-plot {
  min-width:0;
  max-width:100%;
  margin-inline:0;
}
.rs-app.rs-professional .rx-signal-plot>svg {
  display:block;
  width:100%;
  height:auto;
  min-height:0;
  max-width:none;
  max-height:none;
  padding:0;
  border:0;
  overflow:visible;
}

/* SVG type scales with the plot. Keep phone axes readable without changing
 * the coordinate system used by the curves and click-to-seek controls. */
@media(max-width:520px) {
  .rs-app.rs-professional .rs-reading-surface .pa-workspace
  [data-testid="contact-force-shape-insight"]
  svg.ai-chart[viewBox="0 0 480 200"]
  text:is([x="38"][text-anchor="end"],[y="180"],[y="12"]) {
    font-size:18px;
    font-weight:500;
  }
  .rs-app.rs-professional .rs-reading-surface .pa-workspace
  .ka-signal-chart>svg[viewBox="0 0 610 225"]
  text.ka-axis-text:is([x="43"],[y="211"]) {
    font-size:22px;
    font-weight:500;
  }
  .rs-app.rs-professional .rs-reading-surface .pa-workspace
  .ka-signal-chart>svg[viewBox="0 0 610 225"]
  text.ka-unit-text[y="13"] {
    font-size:20px;
  }
}
