/* Scientific plotting studio: project workspace selected on 2026-08-30. */

body[data-page="scientific-plotting"] {
  --studio-ink: #102d27;
  --studio-copy: #435b55;
  --studio-muted: #72817c;
  --studio-green: #17664c;
  --studio-green-soft: #e8f1eb;
  --studio-blue: #1e5a8d;
  --studio-line: #d8ded8;
  --studio-line-dark: #bfc9c1;
  --studio-paper: #fffefa;
  --studio-canvas: #f2f3ee;
  --studio-panel: #f8f8f4;
  background: #f5f5ef;
}

/* The plotting surface remains a calibrated light-paper workspace in dark site
   mode. This avoids mixed light panels with low-contrast dark-theme form
   tokens while the global header can still follow the selected site theme. */
html[data-theme="dark"] body[data-page="scientific-plotting"] {
  --studio-ink: #102d27;
  --studio-copy: #435b55;
  --studio-muted: #72817c;
  --studio-green: #17664c;
  --studio-green-soft: #e8f1eb;
  --studio-line: #d8ded8;
  --studio-line-dark: #bfc9c1;
  --studio-paper: #fffefa;
  --studio-canvas: #f2f3ee;
  --studio-panel: #f8f8f4;
  --pc-bg: #f5f6f2;
  --pc-surface: #fff;
  --pc-surface-2: #f8faf7;
  --pc-ink: #172b22;
  --pc-muted: #607068;
  --pc-faint: #87938d;
  --pc-line: #d8dfd7;
  --pc-line-strong: #c5d0c4;
  --pc-brand: #4f7b48;
  --pc-brand-2: #244f32;
  --pc-soft: #eaf1e6;
  --pc-accent: #b3cf87;
  --re-paper: #f6f5ef;
  --re-surface: #fffefa;
  --re-surface-soft: #f1f3ee;
  --re-ink: #1c3028;
  --re-text: #42534c;
  --re-muted: #76837e;
  --re-line: #d9ddd6;
  --re-line-strong: #c8cec7;
  --re-green: #2e674f;
  --re-green-soft: #e9efe8;
  --re-blue: #5d79a9;
  --re-red: #cb5f63;
  color: var(--studio-copy);
  background: #f5f5ef;
  color-scheme: light;
}

html[data-theme="dark"] body[data-page="scientific-plotting"] :is(.plotrun-dialog, .plotstudio-library) {
  --studio-ink: #102d27;
  --studio-copy: #435b55;
  --studio-muted: #72817c;
  --studio-green: #17664c;
  --studio-green-soft: #e8f1eb;
  --studio-line: #d8ded8;
  --studio-line-dark: #bfc9c1;
  --studio-paper: #fffefa;
  --studio-canvas: #f2f3ee;
  --studio-panel: #f8f8f4;
  --pc-bg: #f5f6f2;
  --pc-surface: #fff;
  --pc-surface-2: #f8faf7;
  --pc-ink: #172b22;
  --pc-muted: #607068;
  --pc-faint: #87938d;
  --pc-line: #d8dfd7;
  --pc-line-strong: #c5d0c4;
  --pc-brand: #4f7b48;
  --pc-brand-2: #244f32;
  --pc-soft: #eaf1e6;
  --re-paper: #f6f5ef;
  --re-surface: #fffefa;
  --re-surface-soft: #f1f3ee;
  --re-ink: #1c3028;
  --re-text: #42534c;
  --re-muted: #76837e;
  --re-line: #d9ddd6;
  --re-line-strong: #c8cec7;
  --re-green: #2e674f;
  --re-green-soft: #e9efe8;
  color: var(--studio-ink) !important;
  color-scheme: light;
}

html[data-theme="dark"] body[data-page="scientific-plotting"] :is(.plotrun-dialog, .plotstudio-library) :is(input, textarea, select) {
  color: var(--studio-ink) !important;
  border-color: var(--studio-line-dark) !important;
  background-color: #fff !important;
  color-scheme: light;
}

html[data-theme="dark"] body[data-page="scientific-plotting"] .plotstudio-heading h1 {
  color: var(--studio-ink) !important;
}

html[data-theme="dark"] body[data-page="scientific-plotting"] .plotstudio-library-head h2 {
  color: var(--studio-ink) !important;
}

body[data-page="scientific-plotting"] .plotcat-page {
  display: block;
  padding: 0;
}

body[data-page="scientific-plotting"] .plotcat-page > :not(.plotrun-layer) {
  display: none;
}

body[data-page="scientific-plotting"] .plotrun-layer {
  position: static;
  inset: auto;
  z-index: auto;
  display: block;
  padding: 24px 0 44px;
  overflow: visible;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .58), transparent 160px),
    #f5f5ef;
}

body[data-page="scientific-plotting"] .plotrun-backdrop {
  display: none;
}

body[data-page="scientific-plotting"] .plotrun-dialog {
  position: relative;
  display: block;
  width: min(calc(100% - 48px), 1320px);
  height: auto;
  max-height: none;
  margin: 0 auto;
  overflow: visible;
  color: var(--studio-ink);
  background: var(--studio-paper);
  border: 1px solid var(--studio-line-dark);
  border-radius: 10px;
  box-shadow: 0 18px 50px rgba(27, 49, 40, .08);
  animation: none;
}

body[data-page="scientific-plotting"] .plotrun-head {
  position: relative;
  z-index: 12;
  display: flex;
  min-height: 70px;
  padding: 14px 20px;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  color: var(--studio-ink);
  background: #fffefa;
  border: 0;
  border-bottom: 1px solid var(--studio-line);
  border-radius: 10px 10px 0 0;
}

.plotstudio-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 18px;
}

.plotstudio-heading h1 {
  flex: 0 0 auto;
  margin: 0;
  padding-right: 18px;
  font-size: 22px;
  font-weight: 720;
  line-height: 1;
  letter-spacing: -.02em;
  border-right: 1px solid var(--studio-line-dark);
}

.plotstudio-heading p {
  display: flex;
  min-width: 0;
  margin: 0;
  align-items: center;
  gap: 9px;
  color: var(--studio-muted);
  font-size: 13px;
  white-space: nowrap;
}

.plotstudio-heading p i {
  color: #a8b1ac;
  font-style: normal;
}

.plotstudio-heading p strong {
  max-width: 270px;
  overflow: hidden;
  color: var(--studio-ink);
  font-weight: 650;
  text-overflow: ellipsis;
}

.plotstudio-head-actions,
.plotstudio-export-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.plotstudio-head-actions > button,
.plotstudio-export {
  min-height: 38px;
  padding: 0 15px;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  border-radius: 5px;
  cursor: pointer;
}

.plotstudio-save {
  color: var(--studio-ink);
  background: transparent;
  border: 1px solid var(--studio-line-dark);
}

.plotstudio-export {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  background: var(--studio-green);
  border: 1px solid var(--studio-green);
}

.plotstudio-export img {
  width: 16px;
  height: 16px;
  filter: brightness(0) invert(1);
}

.plotstudio-save:hover,
.plotstudio-save:focus-visible {
  background: #f0f2ed;
}

.plotstudio-export:hover,
.plotstudio-export:focus-visible {
  background: #0f573e;
}

.plotstudio-export-menu {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  z-index: 30;
  width: 260px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--studio-line-dark);
  border-radius: 7px;
  box-shadow: 0 16px 34px rgba(20, 45, 36, .15);
}

.plotstudio-export-menu[hidden] {
  display: none;
}

.plotstudio-export-menu header {
  display: grid;
  gap: 3px;
  padding: 8px 9px 10px;
  border-bottom: 1px solid var(--studio-line);
}

.plotstudio-export-menu header strong {
  font-size: 13px;
}

.plotstudio-export-menu header span,
.plotstudio-export-menu button small {
  color: var(--studio-muted);
  font-size: 11px;
}

.plotstudio-export-menu button {
  display: grid;
  width: 100%;
  padding: 9px;
  grid-template-columns: 44px 1fr;
  align-items: center;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}

.plotstudio-export-menu button:hover,
.plotstudio-export-menu button:focus-visible {
  background: var(--studio-green-soft);
}

.plotstudio-export-menu button span {
  grid-row: 1 / 3;
  color: var(--studio-green);
  font-weight: 750;
}

body[data-page="scientific-plotting"] .plotstudio-stepper {
  position: relative;
  z-index: 4;
  display: grid;
  height: 78px;
  padding: 9px 56px 8px;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  background: #f9faf6;
  border-bottom: 1px solid var(--studio-line);
}

body[data-page="scientific-plotting"] .plotstudio-stepper::before {
  position: absolute;
  top: 26px;
  right: calc(10% + 56px);
  left: calc(10% + 56px);
  height: 1px;
  content: "";
  background: var(--studio-line-dark);
}

body[data-page="scientific-plotting"] .plotstudio-stepper button {
  position: relative;
  z-index: 1;
  display: grid;
  min-width: 0;
  padding: 0;
  place-items: center;
  align-content: center;
  gap: 5px;
  color: var(--studio-muted);
  background: transparent;
  border: 0;
  cursor: pointer;
}

body[data-page="scientific-plotting"] .plotstudio-stepper button span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--studio-copy);
  font-size: 12px;
  font-weight: 760;
  background: #f9faf6;
  border: 1px solid var(--studio-line-dark);
  border-radius: 50%;
}

body[data-page="scientific-plotting"] .plotstudio-stepper button strong {
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

body[data-page="scientific-plotting"] .plotstudio-stepper button[aria-selected="true"] {
  color: var(--studio-green);
}

body[data-page="scientific-plotting"] .plotstudio-stepper button[aria-selected="true"] span {
  color: #fff;
  background: var(--studio-green);
  border-color: var(--studio-green);
  box-shadow: 0 0 0 5px var(--studio-green-soft);
}

body[data-page="scientific-plotting"] .plotrun-body {
  display: grid;
  min-height: 780px;
  grid-template:
    "project stage controls" 600px
    "drawer drawer drawer" auto
    "utility utility utility" auto /
    220px minmax(0, 1fr) 360px;
  align-items: stretch;
  overflow: visible;
  background: #fffefa;
}

.plotstudio-project {
  grid-area: project;
  min-width: 0;
  padding: 0 14px 16px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #b6c0b8 transparent;
  background: #fbfbf7;
  border-right: 1px solid var(--studio-line);
}

.plotstudio-project > header {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  height: 48px;
  align-items: center;
  justify-content: space-between;
  background: #fbfbf7;
  border-bottom: 1px solid var(--studio-line);
}

.plotstudio-project-actions {
  display: flex;
  align-items: center;
  gap: 3px;
}

.plotstudio-project .plotstudio-library-trigger {
  display: inline-flex;
  min-height: 29px;
  padding: 0 7px;
  align-items: center;
  gap: 5px;
  color: var(--studio-green);
  font: inherit;
  font-size: 9px;
  font-weight: 700;
  background: var(--studio-green-soft);
  border: 1px solid #c5d9cc;
  border-radius: 4px;
  cursor: pointer;
}

.plotstudio-project .plotstudio-library-trigger img {
  width: 13px;
  height: 13px;
}

.plotstudio-project .plotstudio-library-trigger b {
  color: #fff;
  font-size: 8px;
  font-weight: 760;
  background: var(--studio-green);
  border-radius: 3px;
  padding: 2px 4px;
}

.plotstudio-project .plotstudio-library-trigger:hover,
.plotstudio-project .plotstudio-library-trigger:focus-visible {
  background: #dfece3;
  border-color: var(--studio-green);
}

.plotstudio-project > header strong,
.plotstudio-section-label strong,
body[data-page="scientific-plotting"] .plotrun-section-head h3,
.plotwb-setting-section h4 {
  color: var(--studio-ink);
  font-size: 13px;
  font-weight: 720;
}

.plotstudio-project > header button,
.plotstudio-section-label button {
  display: inline-flex;
  min-height: 36px;
  padding: 0 7px;
  align-items: center;
  justify-content: center;
  color: var(--studio-muted);
  font: inherit;
  font-size: 11px;
  background: transparent;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}

.plotstudio-project > header button {
  min-width: 36px;
  padding: 0;
}

.plotstudio-project > header button:hover,
.plotstudio-project > header button:focus-visible,
.plotstudio-section-label button:hover,
.plotstudio-section-label button:focus-visible {
  color: var(--studio-green);
  background: var(--studio-green-soft);
}

.plotstudio-project > header img {
  width: 15px;
  height: 15px;
}

.plotstudio-project section {
  padding: 15px 0;
  border-bottom: 1px solid var(--studio-line);
}

.plotstudio-section-label {
  display: flex;
  margin-bottom: 10px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.plotstudio-section-label > span {
  color: var(--studio-muted);
  font-size: 10px;
}

.plotstudio-section-label .is-ready {
  color: var(--studio-green);
}

body[data-page="scientific-plotting"] .plotwb-dropzone {
  display: grid;
  min-width: 0;
  min-height: 90px;
  padding: 13px;
  place-items: center;
  align-content: center;
  gap: 4px;
  text-align: center;
  background: #fff;
  border: 1px dashed #9eaea4;
  border-radius: 5px;
  cursor: pointer;
}

body[data-page="scientific-plotting"] .plotwb-dropzone:hover,
body[data-page="scientific-plotting"] .plotwb-dropzone.is-dragging {
  background: var(--studio-green-soft);
  border-color: var(--studio-green);
}

body[data-page="scientific-plotting"] .plotwb-dropzone img {
  width: 19px;
  height: 19px;
}

body[data-page="scientific-plotting"] .plotwb-dropzone strong {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 150px;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-page="scientific-plotting"] .plotwb-dropzone small,
.plotstudio-privacy,
.plotstudio-dataset [data-data-pane] > p {
  margin: 0;
  color: var(--studio-muted);
  font-size: 10px;
  line-height: 1.5;
}

.plotstudio-privacy {
  display: flex;
  margin-top: 8px;
  align-items: center;
  gap: 5px;
}

.plotstudio-privacy img {
  width: 13px;
  height: 13px;
}

body[data-page="scientific-plotting"] .plotwb-file-chip {
  display: none;
}

body[data-page="scientific-plotting"] .plotwb-tabs {
  display: grid;
  margin-top: 8px;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--studio-line);
  border-radius: 4px;
  overflow: hidden;
}

body[data-page="scientific-plotting"] .plotwb-tabs button {
  min-height: 29px;
  color: var(--studio-muted);
  font: inherit;
  font-size: 10px;
  background: #fff;
  border: 0;
  border-right: 1px solid var(--studio-line);
  cursor: pointer;
}

body[data-page="scientific-plotting"] .plotwb-tabs button:last-child {
  border-right: 0;
}

body[data-page="scientific-plotting"] .plotwb-tabs button[aria-selected="true"] {
  color: var(--studio-green);
  font-weight: 700;
  background: var(--studio-green-soft);
}

.plotstudio-dataset textarea {
  width: 100%;
  margin: 8px 0;
  padding: 8px;
  resize: vertical;
  color: var(--studio-copy);
  font: 10px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #fff;
  border: 1px solid var(--studio-line-dark);
  border-radius: 4px;
}

.plotstudio-recent-list > button,
.plotstudio-chart-grid > button {
  color: inherit;
  font: inherit;
  background: transparent;
  cursor: pointer;
}

.plotstudio-recent-list > button {
  display: grid;
  width: 100%;
  padding: 7px 0;
  grid-template-columns: 58px 1fr;
  align-items: center;
  gap: 9px;
  text-align: left;
  border: 0;
  border-bottom: 1px solid #e8ebe6;
}

.plotstudio-recent-list > button:last-child {
  border-bottom: 0;
}

.plotstudio-recent-list canvas {
  width: 58px;
  height: 37px;
  background: #f2f4f0;
  border: 1px solid var(--studio-line);
}

.plotstudio-recent-list span {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.plotstudio-recent-list strong {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plotstudio-recent-list small {
  color: var(--studio-muted);
  font-size: 9px;
}

.plotstudio-recent-empty {
  margin: 0;
  padding: 8px 0;
  color: var(--studio-muted);
  font-size: 9px;
  line-height: 1.55;
}

.plotstudio-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.plotstudio-chart-grid > button {
  display: grid;
  min-width: 0;
  padding: 5px;
  gap: 5px;
  text-align: left;
  border: 1px solid var(--studio-line);
  border-radius: 4px;
}

.plotstudio-chart-grid > button:hover,
.plotstudio-chart-grid > button:focus-visible,
.plotstudio-chart-grid > button.is-active {
  background: var(--studio-green-soft);
  border-color: var(--studio-green);
}

.plotstudio-chart-grid canvas {
  width: 100%;
  height: 43px;
  background: #fff;
}

.plotstudio-chart-grid span {
  overflow: hidden;
  font-size: 9px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-page="scientific-plotting"] .plotrun-stage {
  grid-area: stage;
  display: flex;
  min-width: 0;
  min-height: 600px;
  padding: 0;
  flex-direction: column;
  background: var(--studio-canvas);
  border: 0;
  border-right: 1px solid var(--studio-line);
  border-radius: 0;
  overflow: hidden;
}

body[data-page="scientific-plotting"] .plotrun-stagebar {
  display: flex;
  min-height: 48px;
  padding: 10px 14px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #fbfbf7;
  border-bottom: 1px solid var(--studio-line);
}

body[data-page="scientific-plotting"] .plotrun-stagebar > div:first-child {
  min-width: 0;
}

body[data-page="scientific-plotting"] .plotrun-stagebar > div:first-child p {
  display: flex;
  margin: 0;
  align-items: center;
  gap: 7px;
}

body[data-page="scientific-plotting"] .plotrun-stagebar strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plotstudio-maturity {
  flex: 0 0 auto;
  padding: 2px 5px;
  color: var(--studio-green);
  font-size: 8px;
  font-weight: 700;
  line-height: 1.35;
  background: var(--studio-green-soft);
  border: 1px solid #c9dccf;
  border-radius: 3px;
}

.plotstudio-maturity[data-level="workbench"] {
  color: #856328;
  background: #f5efe1;
  border-color: #e5d6b7;
}

body[data-page="scientific-plotting"] .plotrun-stagebar #plotDescription {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--studio-muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plotstudio-quality {
  flex: 0 0 auto;
  text-align: right;
}

.plotstudio-quality span {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  color: var(--studio-green);
  font-size: 10px;
  font-weight: 650;
}

.plotstudio-quality span i {
  width: 6px;
  height: 6px;
  background: #2d9a69;
  border-radius: 50%;
}

.plotstudio-quality small {
  color: var(--studio-muted);
  font-size: 9px;
}

body[data-page="scientific-plotting"] .plotwb-canvas-viewport {
  position: relative;
  display: grid;
  min-height: 484px;
  padding: 30px 24px 46px;
  flex: 1 1 auto;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(rgba(35, 83, 65, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(35, 83, 65, .035) 1px, transparent 1px),
    #eff1ec;
  background-size: 24px 24px;
}

body[data-page="scientific-plotting"] #plotCanvas {
  display: block;
  width: min(calc(100% - 10px), 720px);
  height: auto;
  max-height: 430px;
  object-fit: contain;
  background: #fff;
  border: 1px solid #cfd8d1;
  box-shadow: 0 12px 30px rgba(29, 49, 41, .08);
  transform: scale(var(--plot-zoom, 1));
  transform-origin: center;
}

body[data-page="scientific-plotting"] .plotwb-canvas-viewport:fullscreen {
  box-sizing: border-box;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
  overflow: auto;
  overscroll-behavior: contain;
}

body[data-page="scientific-plotting"].plotstudio-emulated-fullscreen {
  overflow: hidden;
}

body[data-page="scientific-plotting"] .plotwb-canvas-viewport.is-fullscreen-emulated {
  position: fixed;
  top: 0;
  right: 0;
  bottom: auto;
  left: 0;
  z-index: 2147481000;
  box-sizing: border-box;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
  overflow: auto;
  overscroll-behavior: contain;
}

body[data-page="scientific-plotting"] .plotwb-canvas-viewport:fullscreen #plotCanvas {
  position: relative;
  inset: auto;
  width: var(--plot-fullscreen-display-width, 1200px);
  height: var(--plot-fullscreen-display-height, 720px);
  max-width: none;
  max-height: none;
  flex: 0 0 auto;
  place-self: center;
  transform: none;
}

body[data-page="scientific-plotting"] .plotwb-canvas-viewport.is-fullscreen-emulated #plotCanvas {
  position: relative;
  inset: auto;
  width: var(--plot-fullscreen-display-width, 1200px);
  height: var(--plot-fullscreen-display-height, 720px);
  max-width: none;
  max-height: none;
  flex: 0 0 auto;
  place-self: center;
  transform: none;
}

body[data-page="scientific-plotting"] .plotwb-canvas-viewport:fullscreen .plotstudio-direct-hint {
  position: fixed;
  top: 18px;
}

body[data-page="scientific-plotting"] .plotwb-canvas-viewport.is-fullscreen-emulated .plotstudio-direct-hint {
  position: fixed;
  top: 18px;
}

.plotstudio-direct-layer {
  position: absolute;
  z-index: 3;
  overflow: hidden;
  cursor: crosshair;
  touch-action: pan-y;
}

.plotstudio-direct-layer.is-graphic-move {
  cursor: grab;
  touch-action: none;
}

.plotstudio-direct-layer.is-graphic-dragging {
  cursor: grabbing;
}

.plotstudio-direct-layer.is-graphic-move .plotstudio-direct-item {
  cursor: grab;
}

.plotstudio-direct-layer.is-shape-edit {
  cursor: crosshair;
  touch-action: none;
}

.plotstudio-direct-layer.is-shape-edit .plotstudio-direct-item {
  pointer-events: auto;
}

.plotstudio-selection-marquee {
  position: absolute;
  z-index: 8;
  box-sizing: border-box;
  display: block;
  background: rgba(36, 111, 219, .09);
  border: 1px solid #2f73d4;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .65) inset;
  pointer-events: none;
}

.plotstudio-selection-marquee[hidden] {
  display: none;
}

.plotstudio-direct-hint {
  position: absolute;
  top: 8px;
  left: 50%;
  z-index: 2;
  max-width: calc(100% - 24px);
  padding: 5px 9px;
  overflow: hidden;
  color: #52645b;
  font-size: 10px;
  font-weight: 650;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(255, 255, 252, .88);
  border: 1px solid rgba(164, 179, 169, .72);
  border-radius: 999px;
  box-shadow: 0 5px 16px rgba(29, 49, 41, .07);
  pointer-events: none;
  transform: translateX(-50%);
  transition: opacity .18s ease, transform .18s ease;
}

.plotstudio-direct-layer.has-annotations .plotstudio-direct-hint,
.plotstudio-direct-layer:focus-within .plotstudio-direct-hint {
  opacity: 0;
  transform: translate(-50%, -5px);
}

.plotstudio-direct-item {
  position: absolute;
  z-index: 1;
  display: block;
  max-width: 72%;
  min-width: 24px;
  min-height: 20px;
  padding: 2px 5px;
  overflow: hidden;
  color: transparent;
  font: inherit;
  font-weight: 650;
  line-height: 1.25;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  outline: 0;
  cursor: move;
  touch-action: none;
  user-select: none;
  transform: translate(var(--direct-shift-x, -4px), -50%) rotate(var(--direct-angle, 0deg));
  transform-origin: center;
  -webkit-text-fill-color: transparent;
}

.plotstudio-direct-item[data-direct-align="center"] {
  --direct-shift-x: -50%;
}

.plotstudio-direct-item[data-direct-align="right"],
.plotstudio-direct-item[data-direct-align="end"] {
  --direct-shift-x: -100%;
}

.plotstudio-direct-item:hover,
.plotstudio-direct-item:focus-visible,
.plotstudio-direct-item.is-selected {
  background: rgba(235, 246, 239, .42);
  border-color: rgba(24, 111, 79, .74);
  box-shadow: 0 0 0 2px rgba(24, 111, 79, .11);
}

.plotstudio-direct-item.is-dragging,
.plotstudio-direct-item.is-editing {
  z-index: 4;
  color: #173d30;
  background: rgba(255, 255, 252, .97);
  border-color: var(--studio-green);
  box-shadow: 0 8px 24px rgba(21, 55, 43, .18);
  -webkit-text-fill-color: currentColor;
}

.plotstudio-direct-item.is-editing {
  min-width: 90px;
  cursor: text;
  user-select: text;
}

.plotstudio-direct-item.is-editing:empty::before {
  color: #7b8a82;
  content: attr(data-placeholder);
  font-weight: 500;
  -webkit-text-fill-color: currentColor;
}

.plotstudio-direct-item[data-direct-kind="yAxis"] {
  transform: translate(-50%, -50%) rotate(-90deg);
}

.plotstudio-direct-item[data-direct-kind="xAxis"] {
  transform: translate(-50%, -50%);
}

.plotstudio-direct-item[data-direct-kind="annotation"] {
  font-weight: 560;
}

.plotstudio-shape-item {
  position: absolute;
  z-index: 3;
  box-sizing: border-box;
  display: block;
  background: transparent;
  border: 1px dashed transparent;
  border-radius: 2px;
  outline: 0;
  cursor: move;
  touch-action: none;
  user-select: none;
}

.plotstudio-shape-item.is-ellipse {
  border-radius: 50%;
}

.plotstudio-shape-item:not(.is-line):hover,
.plotstudio-shape-item:not(.is-line):focus-visible,
.plotstudio-shape-item:not(.is-line).is-selected {
  background: rgba(235, 246, 239, .12);
  border-color: rgba(20, 112, 78, .92);
  box-shadow: 0 0 0 2px rgba(20, 112, 78, .12);
}

.plotstudio-shape-item.is-dragging {
  cursor: grabbing;
}

.plotstudio-shape-item.is-line {
  border: 0;
  pointer-events: auto;
  transform: translateY(-50%) rotate(var(--shape-angle, 0deg));
  transform-origin: left center;
}

.plotstudio-shape-segment {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  cursor: move;
  touch-action: none;
}

.plotstudio-shape-segment::after {
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  border-top: 2px solid transparent;
  content: "";
  transform: translateY(-50%);
}

.plotstudio-shape-segment:hover::after,
.plotstudio-shape-item.is-line:focus-visible .plotstudio-shape-segment::after,
.plotstudio-shape-item.is-line.is-selected .plotstudio-shape-segment::after {
  border-color: rgba(20, 112, 78, .95);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .85);
}

.plotstudio-shape-handle {
  position: absolute;
  z-index: 5;
  display: block;
  width: 9px;
  height: 9px;
  background: #fff;
  border: 2px solid var(--studio-green);
  border-radius: 2px;
  box-shadow: 0 2px 6px rgba(20, 61, 45, .2);
  touch-action: none;
  transform: translate(-50%, -50%);
}

.plotstudio-shape-handle[data-shape-handle="nw"] { top: 0; left: 0; cursor: nwse-resize; }
.plotstudio-shape-handle[data-shape-handle="n"] { top: 0; left: 50%; cursor: ns-resize; }
.plotstudio-shape-handle[data-shape-handle="ne"] { top: 0; left: 100%; cursor: nesw-resize; }
.plotstudio-shape-handle[data-shape-handle="e"] { top: 50%; left: 100%; cursor: ew-resize; }
.plotstudio-shape-handle[data-shape-handle="se"] { top: 100%; left: 100%; cursor: nwse-resize; }
.plotstudio-shape-handle[data-shape-handle="s"] { top: 100%; left: 50%; cursor: ns-resize; }
.plotstudio-shape-handle[data-shape-handle="sw"] { top: 100%; left: 0; cursor: nesw-resize; }
.plotstudio-shape-handle[data-shape-handle="w"] { top: 50%; left: 0; cursor: ew-resize; }

.plotstudio-shape-handle.is-line-handle {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  cursor: crosshair;
  pointer-events: auto;
}

.plotstudio-canvas-tools {
  position: absolute;
  right: 13px;
  bottom: 13px;
  display: flex;
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--studio-line-dark);
  border-radius: 5px;
  overflow: hidden;
  z-index: 5;
}

.plotstudio-canvas-tools button {
  display: inline-flex;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--studio-copy);
  font: inherit;
  font-size: 10px;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--studio-line);
  cursor: pointer;
}

.plotstudio-canvas-tools button:last-child {
  border-right: 0;
}

.plotstudio-canvas-tools output {
  display: inline-flex;
  min-width: 48px;
  height: 30px;
  padding: 0 7px;
  align-items: center;
  justify-content: center;
  color: #3d5147;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  background: #f8faf8;
  border-right: 1px solid var(--studio-line);
}

.plotwb-canvas-viewport:fullscreen .plotstudio-canvas-tools {
  position: fixed;
  right: 18px;
  bottom: 18px;
  box-shadow: 0 10px 30px rgba(19, 42, 33, .16);
}

.plotwb-canvas-viewport.is-fullscreen-emulated .plotstudio-canvas-tools {
  position: fixed;
  right: 18px;
  bottom: 18px;
  box-shadow: 0 10px 30px rgba(19, 42, 33, .16);
}

.plotstudio-canvas-tools button:hover,
.plotstudio-canvas-tools button:focus-visible,
.plotstudio-canvas-tools button.is-active {
  color: var(--studio-green);
  background: var(--studio-green-soft);
}

.plotstudio-canvas-tools button:disabled {
  color: #9ca8a1;
  background: #f6f7f4;
  cursor: not-allowed;
  opacity: .58;
}

.plotstudio-canvas-tools #plotDeleteShape:not(:disabled):hover,
.plotstudio-canvas-tools #plotDeleteShape:not(:disabled):focus-visible {
  color: #a43d35;
  background: #fbefec;
}

.plotstudio-canvas-tools button.is-active {
  box-shadow: inset 0 -2px 0 var(--studio-green);
}

.plotstudio-canvas-tools img {
  width: 13px;
  height: 13px;
}

body[data-page="scientific-plotting"] .plotwb-stage-summary {
  padding: 8px 12px;
  background: #fbfbf7;
  border-top: 1px solid var(--studio-line);
}

body[data-page="scientific-plotting"] .plotwb-stage-summary dl {
  display: grid;
  margin: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

body[data-page="scientific-plotting"] .plotwb-stage-summary dl > div {
  display: grid;
  grid-template-columns: auto repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 7px;
}

body[data-page="scientific-plotting"] .plotwb-stage-summary dt {
  padding-right: 7px;
  color: var(--studio-muted);
  font-size: 9px;
  font-weight: 650;
  border-right: 1px solid var(--studio-line);
}

body[data-page="scientific-plotting"] .plotwb-stage-summary dd {
  display: grid;
  min-width: 0;
  margin: 0;
  gap: 2px;
}

body[data-page="scientific-plotting"] .plotwb-stage-summary dd span {
  color: var(--studio-muted);
  font-size: 8px;
}

body[data-page="scientific-plotting"] .plotwb-stage-summary dd strong {
  overflow: hidden;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-page="scientific-plotting"] .plotrun-data {
  --plot-control-height: 38px;
  --plot-control-radius: 5px;
  container-type: inline-size;
  grid-area: controls;
  display: flex;
  min-width: 0;
  min-height: 600px;
  padding: 0;
  flex-direction: column;
  background: #fbfbf7;
  border: 0;
  border-radius: 0;
  overflow: hidden;
}

body[data-page="scientific-plotting"] .plotrun-section-head {
  display: flex;
  min-height: 48px;
  padding: 9px 14px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: transparent;
  border-bottom: 1px solid var(--studio-line);
}

body[data-page="scientific-plotting"] .plotrun-section-head h3 {
  margin: 0;
  font-size: 13px;
  line-height: 1.25;
}

body[data-page="scientific-plotting"] .plotrun-section-head small {
  display: block;
  margin-top: 2px;
  color: var(--studio-muted);
  font-size: 9px;
}

body[data-page="scientific-plotting"] .plotrun-section-head button {
  min-width: 64px;
  min-height: 32px;
  padding: 0 10px;
  color: var(--studio-copy);
  font: inherit;
  font-size: 9px;
  background: transparent;
  border: 1px solid var(--studio-line);
  border-radius: var(--plot-control-radius);
  cursor: pointer;
}

body[data-page="scientific-plotting"] .plotrun-scroll {
  min-height: 0;
  padding: 0;
  flex: 1 1 auto;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #acb8b0 transparent;
}

body[data-page="scientific-plotting"] .plotwb-control-panel {
  display: block;
  padding: 0;
}

body[data-page="scientific-plotting"] .plotwb-control-panel[hidden] {
  display: none;
}

body[data-page="scientific-plotting"] .plotwb-setting-section {
  padding: 14px;
  border-bottom: 1px solid var(--studio-line);
}

body[data-page="scientific-plotting"] .plotwb-section-title {
  display: flex;
  margin-bottom: 11px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

body[data-page="scientific-plotting"] .plotwb-setting-section h4 {
  margin: 0;
  font-size: 12px;
  line-height: 1.3;
}

body[data-page="scientific-plotting"] .plotwb-section-title > span {
  color: var(--studio-green);
  font-size: 10px;
  line-height: 1.3;
  text-align: right;
}

body[data-page="scientific-plotting"] .plotwb-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 12px 12px;
}

body[data-page="scientific-plotting"] .plotwb-form-grid > * {
  min-width: 0;
}

body[data-page="scientific-plotting"] .plotwb-style-groups {
  display: grid;
  gap: 10px;
}

body[data-page="scientific-plotting"] .plotwb-style-group {
  min-width: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--studio-line);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(24, 53, 40, .035);
}

body[data-page="scientific-plotting"] .plotwb-style-group > header {
  display: flex;
  min-height: 36px;
  padding: 8px 10px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #f7f9f5;
  border-bottom: 1px solid var(--studio-line);
}

body[data-page="scientific-plotting"] .plotwb-style-group > header strong {
  color: var(--studio-ink);
  font-size: 11px;
  font-weight: 720;
}

body[data-page="scientific-plotting"] .plotwb-style-group > header small {
  color: var(--studio-muted);
  font-size: 9px;
  text-align: right;
}

body[data-page="scientific-plotting"] .plotwb-style-group > .plotwb-form-grid {
  padding: 12px;
  gap: 12px;
}

body[data-page="scientific-plotting"] .plotwb-style-group[data-style-group="legend"] > .plotwb-form-grid,
body[data-page="scientific-plotting"] .plotwb-style-group[data-style-group="colors"] > .plotwb-form-grid {
  grid-template-columns: minmax(0, 1fr);
}

body[data-page="scientific-plotting"] .plotwb-style-group[data-style-group="legend"] [data-plot-key],
body[data-page="scientific-plotting"] .plotwb-style-group[data-style-group="colors"] [data-plot-key] {
  grid-column: 1 / -1;
}

body[data-page="scientific-plotting"] .plotwb-style-group[data-style-group="titles"] [data-plot-key="chartTitle"],
body[data-page="scientific-plotting"] .plotwb-style-group[data-style-group="titles"] [data-plot-key="chartSubtitle"] {
  grid-column: 1 / -1;
}

body[data-page="scientific-plotting"] .plotwb-form-grid > label,
body[data-page="scientific-plotting"] .plotwb-task-name {
  display: grid;
  min-width: 0;
  grid-template-rows: minmax(15px, auto) var(--plot-control-height);
  gap: 6px;
  color: var(--studio-copy);
  font-size: 11px;
  font-weight: 650;
}

body[data-page="scientific-plotting"] .plotwb-form-grid > label > span:first-child {
  overflow: hidden;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-page="scientific-plotting"] .plotwb-toggle-field > span:first-child {
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: normal !important;
}

body[data-page="scientific-plotting"] .plotwb-form-grid select,
body[data-page="scientific-plotting"] .plotwb-form-grid input,
body[data-page="scientific-plotting"] .plotwb-task-name input {
  width: 100%;
  min-width: 0;
  height: var(--plot-control-height);
  padding: 0 10px;
  color: var(--studio-ink);
  font: inherit;
  font-size: 11px;
  background: #fff;
  border: 1px solid var(--studio-line-dark);
  border-radius: var(--plot-control-radius);
  transition: border-color .14s ease, box-shadow .14s ease, background-color .14s ease;
}

body[data-page="scientific-plotting"] .plotwb-form-grid select {
  padding-right: 30px;
  appearance: none;
  background-image: url("./icons/lucide/chevron-down.svg");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 14px;
}

body[data-page="scientific-plotting"] .plotwb-form-grid :is(select, input):focus-visible,
body[data-page="scientific-plotting"] .plotwb-task-name input:focus-visible {
  border-color: var(--studio-green);
  box-shadow: 0 0 0 3px rgba(23, 102, 76, .1);
  outline: 0;
}

body[data-page="scientific-plotting"] .plotwb-form-grid input[type="range"] {
  height: 24px;
  padding: 0;
  accent-color: var(--studio-green);
  background: transparent;
  border: 0;
  box-shadow: none;
}

body[data-page="scientific-plotting"] .plotwb-range-field {
  grid-column: 1 / -1;
  grid-template-rows: minmax(15px, auto) var(--plot-control-height) !important;
}

body[data-page="scientific-plotting"] .plotwb-range-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  align-items: center;
  gap: 10px;
  min-height: var(--plot-control-height);
}

body[data-page="scientific-plotting"] .plotwb-range-control input[type="number"] {
  padding: 0 8px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

body[data-page="scientific-plotting"] .plotwb-toggle-field {
  display: flex !important;
  min-height: 44px;
  padding: 8px 10px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--studio-line);
  border-radius: var(--plot-control-radius);
}

body[data-page="scientific-plotting"] .plotwb-setting-section > .plotwb-form-grid > .plotwb-toggle-field {
  display: grid !important;
  min-height: 0;
  padding: 0;
  grid-template-rows: minmax(15px, auto) var(--plot-control-height);
  align-items: stretch;
  justify-content: initial;
  gap: 6px;
  background: transparent;
  border: 0;
  border-radius: 0;
}

body[data-page="scientific-plotting"] .plotwb-setting-section > .plotwb-form-grid > .plotwb-toggle-field > span:first-child {
  display: flex;
  align-items: flex-start;
  overflow: hidden !important;
  line-height: 1.35;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

body[data-page="scientific-plotting"] .plotwb-setting-section > .plotwb-form-grid > .plotwb-toggle-field > .plotwb-toggle-control {
  display: flex;
  width: 100%;
  min-height: var(--plot-control-height);
  padding: 0 10px;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  background: #fff;
  border: 1px solid var(--studio-line-dark);
  border-radius: var(--plot-control-radius);
}

body[data-page="scientific-plotting"] .plotwb-color-control {
  display: grid;
  width: 100%;
  height: var(--plot-control-height);
  padding: 4px 9px 4px 4px;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  color: var(--studio-muted);
  background: #fff;
  border: 1px solid var(--studio-line-dark);
  border-radius: var(--plot-control-radius);
}

body[data-page="scientific-plotting"] .plotwb-color-control:focus-within {
  border-color: var(--studio-green);
  box-shadow: 0 0 0 3px rgba(23, 102, 76, .1);
}

body[data-page="scientific-plotting"] .plotwb-color-control input[type="color"] {
  width: 38px;
  min-width: 38px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 5px;
  box-shadow: none;
  cursor: pointer;
}

body[data-page="scientific-plotting"] .plotwb-color-control input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

body[data-page="scientific-plotting"] .plotwb-color-control input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(34, 61, 49, .18);
  border-radius: 5px;
}

body[data-page="scientific-plotting"] .plotwb-color-control output {
  overflow: hidden;
  font: 600 10px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: .04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-page="scientific-plotting"] .plotwb-radio-field {
  display: grid;
  min-width: 0;
  grid-column: 1 / -1;
  gap: 6px;
  color: var(--studio-copy);
  font-size: 11px;
  font-weight: 650;
}

body[data-page="scientific-plotting"] .plotwb-radio-options {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
  gap: 6px;
}

body[data-page="scientific-plotting"] .plotwb-radio-options label {
  display: inline-flex;
  min-width: 0;
  min-height: var(--plot-control-height);
  padding: 0 9px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--studio-copy);
  font-size: 10px;
  font-weight: 620;
  background: #fff;
  border: 1px solid var(--studio-line-dark);
  border-radius: var(--plot-control-radius);
  cursor: pointer;
}

body[data-page="scientific-plotting"] .plotwb-radio-options label:has(input:checked) {
  color: var(--studio-green);
  background: var(--studio-green-soft);
  border-color: var(--studio-green);
}

body[data-page="scientific-plotting"] .plotwb-radio-options input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--studio-green);
}

body[data-page="scientific-plotting"] .plotwb-toggle-control {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
}

body[data-page="scientific-plotting"] .plotwb-toggle-control input[type="checkbox"] {
  position: relative;
  width: 42px;
  min-width: 42px;
  height: 24px;
  margin: 0;
  padding: 0;
  appearance: none;
  background: #c9d1cc;
  border: 0;
  border-radius: 999px !important;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(34, 65, 53, .08);
  overflow: hidden;
  transition: background-color .16s ease, box-shadow .16s ease;
}

body[data-page="scientific-plotting"] .plotwb-toggle-control input[type="checkbox"]::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  content: "";
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(22, 42, 34, .24);
  transition: transform .16s ease;
}

body[data-page="scientific-plotting"] .plotwb-toggle-control input[type="checkbox"]:checked {
  background: var(--studio-green);
  box-shadow: inset 0 0 0 1px rgba(0, 47, 34, .08);
}

body[data-page="scientific-plotting"] .plotwb-toggle-control input[type="checkbox"]:checked::after {
  transform: translateX(18px);
}

body[data-page="scientific-plotting"] .plotwb-toggle-control input[type="checkbox"]:focus-visible {
  outline: 3px solid rgba(23, 102, 76, .18);
  outline-offset: 2px;
}

body[data-page="scientific-plotting"] .plotwb-toggle-status {
  min-width: 22px;
  color: var(--studio-muted);
  font-size: 9px;
  font-weight: 600;
}

body[data-page="scientific-plotting"] .plotwb-toggle-control input:checked + .plotwb-toggle-status {
  color: var(--studio-green);
}

.plotstudio-sample-source {
  display: grid;
  margin: 0 0 13px;
  padding: 10px 11px;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 10px;
  background: #f3f7f3;
  border: 1px solid #d4e1d8;
  border-left: 3px solid var(--studio-green);
  border-radius: 6px;
}

.plotstudio-sample-source > span {
  grid-column: 1 / -1;
  color: var(--studio-green);
  font-size: 8px;
  font-weight: 760;
  letter-spacing: .08em;
}

.plotstudio-sample-source strong {
  min-width: 0;
  overflow: hidden;
  color: var(--studio-ink);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plotstudio-sample-source small {
  min-width: 0;
  overflow: hidden;
  color: var(--studio-muted);
  font-size: 9px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plotstudio-sample-source a {
  grid-row: 2 / 4;
  grid-column: 2;
  align-self: center;
  color: var(--studio-green);
  font-size: 9px;
  font-weight: 680;
  text-decoration: none;
}

.plotstudio-sample-source a:hover,
.plotstudio-sample-source a:focus-visible {
  text-decoration: underline;
}

.plotstudio-sample-source[data-mode="imported"] {
  background: #f7f7f3;
  border-color: var(--studio-line);
  border-left-color: #9ba69f;
}

body[data-page="scientific-plotting"] .plotwb-palette-row {
  display: grid;
  margin-bottom: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

body[data-page="scientific-plotting"] .plotwb-palette-row button {
  width: 100%;
  height: 28px;
  padding: 0;
  background: linear-gradient(90deg, #3978b8, #f0eee6, #d55450);
  border: 2px solid #fff;
  border-radius: var(--plot-control-radius);
  outline: 1px solid var(--studio-line);
  cursor: pointer;
}

body[data-page="scientific-plotting"] .plotwb-palette-row button:nth-child(2) { background: linear-gradient(90deg, #3b4cc0, #4fa5a5, #f9dc46); }
body[data-page="scientific-plotting"] .plotwb-palette-row button:nth-child(3) { background: linear-gradient(90deg, #d9ebdf, #64a079, #17664c); }
body[data-page="scientific-plotting"] .plotwb-palette-row button:nth-child(4) { background: linear-gradient(90deg, #6c4aa0, #c47b7c, #e46852); }
body[data-page="scientific-plotting"] .plotwb-palette-row button.is-active { outline: 2px solid var(--studio-green); }

body[data-page="scientific-plotting"] .plotrun-submit {
  position: static;
  display: grid;
  padding: 12px 14px;
  grid-template-columns: minmax(0, 1fr) 110px;
  align-items: center;
  gap: 8px;
  background: #fffefa;
  border-top: 1px solid var(--studio-line);
}

body[data-page="scientific-plotting"] .plotrun-submit > button {
  width: 100%;
  min-height: var(--plot-control-height);
  padding: 0 12px;
  color: #fff;
  font: inherit;
  font-size: 11px;
  font-weight: 680;
  background: var(--studio-green);
  border: 1px solid var(--studio-green);
  border-radius: var(--plot-control-radius);
  cursor: pointer;
}

body[data-page="scientific-plotting"] .plotrun-auto {
  display: grid;
  gap: 2px;
  color: var(--studio-copy);
  font-size: 9px;
}

body[data-page="scientific-plotting"] .plotrun-auto label {
  display: inline-flex;
  min-height: 20px;
  align-items: center;
  gap: 6px;
}

body[data-page="scientific-plotting"] #plotRenderState i {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 4px;
  background: #2d9a69;
  border-radius: 50%;
}

body[data-page="scientific-plotting"] #plotMessage {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--studio-muted);
  font-size: 9px;
}

.plotstudio-data-drawer {
  grid-area: drawer;
  min-width: 0;
  background: #fffefa;
  border-top: 1px solid var(--studio-line-dark);
}

.plotstudio-data-drawer > header {
  display: flex;
  min-height: 44px;
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.plotstudio-data-drawer > header button,
.plotstudio-data-drawer > header > div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.plotstudio-data-drawer > header button {
  color: var(--studio-copy);
  font: inherit;
  font-size: 10px;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.plotstudio-data-drawer > header button img {
  width: 15px;
  height: 15px;
}

.plotstudio-data-drawer > header strong {
  color: var(--studio-ink);
  font-size: 12px;
}

.plotstudio-data-drawer > header span {
  color: var(--studio-muted);
  font-size: 9px;
}

.plotstudio-drawer-chevron {
  transition: transform .18s ease;
}

.plotstudio-data-drawer.is-collapsed .plotstudio-drawer-chevron {
  transform: rotate(-90deg);
}

body[data-page="scientific-plotting"] .plotwb-data-table-wrap {
  max-height: 186px;
  overflow: auto;
  overscroll-behavior: contain;
  border-top: 1px solid var(--studio-line);
  scrollbar-width: thin;
}

.plotstudio-data-drawer.is-collapsed .plotwb-data-table-wrap {
  display: none;
}

body[data-page="scientific-plotting"] #plotDataPreview {
  width: 100%;
  border-collapse: collapse;
  color: var(--studio-copy);
  font-size: 9px;
  white-space: nowrap;
}

body[data-page="scientific-plotting"] #plotDataPreview th,
body[data-page="scientific-plotting"] #plotDataPreview td {
  min-width: 86px;
  padding: 8px 11px;
  text-align: left;
  border-right: 1px solid #e6eae5;
  border-bottom: 1px solid #e6eae5;
}

body[data-page="scientific-plotting"] #plotDataPreview th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--studio-ink);
  background: #f1f4ef;
}

.plotstudio-utility {
  grid-area: utility;
  display: flex;
  min-height: 48px;
  padding: 8px 14px;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  background: #f8f8f4;
  border-top: 1px solid var(--studio-line);
  border-radius: 0 0 10px 10px;
}

.plotstudio-utility button,
.plotstudio-utility a,
.plotstudio-utility .plot-font-control {
  display: inline-flex;
  min-height: 29px;
  padding: 0 9px;
  align-items: center;
  color: var(--studio-copy);
  font: inherit;
  font-size: 9px;
  text-decoration: none;
  background: #fff;
  border: 1px solid var(--studio-line);
  border-radius: 3px;
  cursor: pointer;
}

.plotstudio-utility .plot-font-control {
  margin-right: auto;
  gap: 2px;
}

.plotstudio-utility .plot-font-control button {
  min-height: 22px;
  padding: 0 6px;
  border: 0;
}

body[data-page="scientific-plotting"] .plotrun-info {
  width: auto;
  margin: 0;
  padding: 42px;
  background: #fffefa;
}

body[data-page="scientific-plotting"] .plotrun-info[hidden] {
  display: none;
}

body[data-page="scientific-plotting"] .plotrun-loading {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  background: rgba(245, 247, 242, .88);
  backdrop-filter: blur(2px);
}

body[data-page="scientific-plotting"] .plotrun-loading[hidden] {
  display: none;
}

body[data-page="scientific-plotting"] .plotrun-loading img {
  width: 23px;
  animation: plotstudio-spin .8s linear infinite;
}

body[data-page="scientific-plotting"] .plotrun-loading strong { font-size: 12px; }
body[data-page="scientific-plotting"] .plotrun-loading small { color: var(--studio-muted); font-size: 9px; }

@keyframes plotstudio-spin { to { transform: rotate(1turn); } }

body[data-page="scientific-plotting"] .plotrun-secondary,
body[data-page="scientific-plotting"] .plotwb-param-actions button {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  color: var(--studio-copy);
  font: inherit;
  font-size: 10px;
  font-weight: 650;
  background: #fff;
  border: 1px solid var(--studio-line-dark);
  border-radius: var(--plot-control-radius, 5px);
  cursor: pointer;
}

body[data-page="scientific-plotting"] .plotwb-param-actions {
  display: grid;
  margin-top: 9px;
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  gap: 6px;
}

body[data-page="scientific-plotting"] .plotstudio-saved-head {
  display: flex;
  margin-top: 14px;
  padding-top: 12px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--studio-line);
}

body[data-page="scientific-plotting"] .plotstudio-saved-head strong {
  color: var(--studio-ink);
  font-size: 10px;
}

body[data-page="scientific-plotting"] .plotstudio-saved-head span {
  color: var(--studio-muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

body[data-page="scientific-plotting"] .plotstudio-saved-tasks {
  display: grid;
  margin-top: 7px;
  gap: 6px;
}

body[data-page="scientific-plotting"] .plotstudio-saved-task {
  display: grid;
  min-width: 0;
  padding: 8px 9px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  background: #fbfcf9;
  border: 1px solid var(--studio-line);
  border-radius: 6px;
}

body[data-page="scientific-plotting"] .plotstudio-saved-task > div:first-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

body[data-page="scientific-plotting"] .plotstudio-saved-task strong,
body[data-page="scientific-plotting"] .plotstudio-saved-task small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-page="scientific-plotting"] .plotstudio-saved-task strong {
  color: var(--studio-copy);
  font-size: 9px;
}

body[data-page="scientific-plotting"] .plotstudio-saved-task small,
body[data-page="scientific-plotting"] .plotstudio-saved-empty {
  color: var(--studio-muted);
  font-size: 8px;
}

body[data-page="scientific-plotting"] .plotstudio-saved-empty {
  margin: 0;
  padding: 9px;
  line-height: 1.55;
  background: #fbfcf9;
  border: 1px dashed var(--studio-line-dark);
  border-radius: 6px;
}

body[data-page="scientific-plotting"] .plotstudio-saved-task > div:last-child {
  display: flex;
  gap: 4px;
}

body[data-page="scientific-plotting"] .plotstudio-saved-task button {
  min-height: 30px;
  padding: 0 8px;
  color: var(--studio-green);
  font: inherit;
  font-size: 8px;
  background: #fff;
  border: 1px solid var(--studio-line-dark);
  border-radius: 4px;
  cursor: pointer;
}

@media (min-width: 1121px) {
  body[data-page="scientific-plotting"] .plotwb-form-grid > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

body[data-page="scientific-plotting"] .plotstudio-saved-task button.is-danger {
  color: #a5473f;
}

.plotstudio-data-help p {
  color: var(--studio-copy);
  font-size: 10px;
  line-height: 1.7;
}

body[data-page="scientific-plotting"] :is(button, input, select, textarea, a):focus-visible {
  outline: 2px solid #2a76b8;
  outline-offset: 2px;
}

/* Full method library: large choice set without crowding the drawing canvas. */
.plotstudio-library {
  width: min(1240px, calc(100vw - 32px));
  height: min(850px, calc(100vh - 32px));
  height: min(850px, calc(100dvh - 32px));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  color: var(--studio-ink);
  background: var(--studio-paper);
  border: 1px solid var(--studio-line-dark);
  border-radius: 12px;
  box-shadow: 0 30px 90px rgba(15, 35, 27, .3);
  overflow: hidden;
  overscroll-behavior: contain;
}

.plotstudio-library::backdrop {
  background: rgba(16, 29, 24, .58);
  backdrop-filter: blur(7px);
}

.plotstudio-library:not([open]) {
  display: none;
}

.plotstudio-library-frame {
  display: grid;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 100%;
  grid-template-rows: auto auto minmax(0, 1fr);
  background: var(--studio-paper);
  overflow: hidden;
}

.plotstudio-library-head {
  display: grid;
  min-height: 104px;
  padding: 18px 20px;
  grid-template-columns: minmax(0, 1fr) auto 38px;
  align-items: center;
  gap: 22px;
  background:
    linear-gradient(90deg, rgba(232, 241, 235, .84), rgba(255, 254, 250, .45) 58%),
    var(--studio-paper);
  border-bottom: 1px solid var(--studio-line);
}

.plotstudio-library-head > div:first-child {
  min-width: 0;
}

.plotstudio-library-head > div:first-child > span {
  color: var(--studio-green);
  font-size: 9px;
  font-weight: 760;
  letter-spacing: .15em;
}

.plotstudio-library-head h2 {
  margin: 3px 0 0;
  color: var(--studio-ink);
  font-size: 25px;
  font-weight: 760;
  line-height: 1.16;
  letter-spacing: -.025em;
}

.plotstudio-library-head p {
  max-width: 690px;
  margin: 6px 0 0;
  color: var(--studio-copy);
  font-size: 11px;
  line-height: 1.55;
}

.plotstudio-library-head dl {
  display: grid;
  margin: 0;
  grid-template-columns: repeat(3, auto);
  gap: 0;
  border: 1px solid var(--studio-line);
  border-radius: 6px;
  background: rgba(255, 255, 255, .76);
}

.plotstudio-library-head dl div {
  min-width: 84px;
  padding: 10px 12px;
  text-align: center;
  border-right: 1px solid var(--studio-line);
}

.plotstudio-library-head dl div:last-child {
  border-right: 0;
}

.plotstudio-library-head dt {
  color: var(--studio-muted);
  font-size: 8px;
}

.plotstudio-library-head dd {
  margin: 2px 0 0;
  color: var(--studio-ink);
  font-size: 17px;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}

.plotstudio-library-close {
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  background: #fff;
  border: 1px solid var(--studio-line-dark);
  border-radius: 50%;
  cursor: pointer;
}

.plotstudio-library-close img {
  width: 16px;
  height: 16px;
}

.plotstudio-library-close:hover,
.plotstudio-library-close:focus-visible {
  background: var(--studio-green-soft);
  border-color: var(--studio-green);
}

.plotstudio-library-toolbar {
  display: grid;
  min-height: 66px;
  padding: 12px 16px;
  grid-template-columns: minmax(300px, 1fr) auto;
  align-items: center;
  gap: 16px;
  background: #fbfbf7;
  border-bottom: 1px solid var(--studio-line);
}

.plotstudio-library-search {
  display: grid;
  min-height: 40px;
  padding: 0 11px;
  grid-template-columns: 17px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--studio-line-dark);
  border-radius: 5px;
}

.plotstudio-library-search:focus-within {
  border-color: var(--studio-green);
  box-shadow: 0 0 0 3px rgba(23, 102, 76, .1);
}

.plotstudio-library-search img {
  width: 17px;
  height: 17px;
  opacity: .68;
}

.plotstudio-library-search input {
  width: 100%;
  height: 38px;
  padding: 0;
  color: var(--studio-ink);
  font: inherit;
  font-size: 12px;
  background: transparent;
  border: 0;
  outline: 0;
}

.plotstudio-library-search input::placeholder {
  color: #88958f;
}

.plotstudio-library-search input::-webkit-search-cancel-button {
  display: none;
  -webkit-appearance: none;
}

.plotstudio-library-search kbd {
  min-width: 23px;
  padding: 3px 6px;
  color: var(--studio-muted);
  font: 9px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: center;
  background: #f2f3ef;
  border: 1px solid var(--studio-line);
  border-radius: 3px;
}

.plotstudio-library-search button {
  display: grid;
  width: 24px;
  height: 24px;
  padding: 0;
  place-items: center;
  background: transparent;
  border: 0;
  border-radius: 3px;
  cursor: pointer;
}

.plotstudio-library-search button[hidden] {
  display: none;
}

.plotstudio-library-search button:hover,
.plotstudio-library-search button:focus-visible {
  background: var(--studio-green-soft);
}

.plotstudio-library-search button img {
  width: 13px;
  height: 13px;
}

.plotstudio-library-status {
  display: flex;
  padding: 3px;
  background: #eef1ec;
  border: 1px solid var(--studio-line);
  border-radius: 5px;
}

.plotstudio-library-status button {
  min-height: 32px;
  padding: 0 11px;
  color: var(--studio-muted);
  font: inherit;
  font-size: 10px;
  font-weight: 650;
  background: transparent;
  border: 0;
  border-radius: 3px;
  cursor: pointer;
}

.plotstudio-library-status button[aria-pressed="true"] {
  color: var(--studio-green);
  background: #fff;
  box-shadow: 0 1px 4px rgba(22, 43, 34, .08);
}

.plotstudio-library-body {
  display: grid;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  grid-template-columns: 218px minmax(0, 1fr);
  overflow: hidden;
}

.plotstudio-library-body > aside {
  min-height: 0;
  padding: 13px 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #f7f8f4;
  border-right: 1px solid var(--studio-line);
  scrollbar-width: thin;
}

.plotstudio-library-body > aside > button,
#plotLibraryCategories button {
  display: grid;
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  color: var(--studio-copy);
  font: inherit;
  font-size: 10px;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}

#plotLibraryCategories {
  display: grid;
  gap: 2px;
}

.plotstudio-library-body > aside > button:hover,
#plotLibraryCategories button:hover,
.plotstudio-library-body > aside > button.is-active,
#plotLibraryCategories button.is-active {
  color: var(--studio-green);
  background: var(--studio-green-soft);
}

.plotstudio-library-body > aside button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plotstudio-library-body > aside button b {
  color: var(--studio-muted);
  font-size: 9px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.plotstudio-library-body > aside button.is-active b {
  color: var(--studio-green);
}

.plotstudio-library-body > aside > section {
  margin: 15px 5px 0;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--studio-line);
  border-radius: 5px;
}

.plotstudio-library-body > aside > section strong {
  color: var(--studio-ink);
  font-size: 10px;
}

.plotstudio-library-body > aside > section p {
  margin: 6px 0 0;
  color: var(--studio-muted);
  font-size: 9px;
  line-height: 1.62;
}

.plotstudio-library-results {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: 48px minmax(0, 1fr) 52px;
  background: var(--studio-paper);
}

.plotstudio-library-results > header {
  display: flex;
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--studio-line);
}

.plotstudio-library-results > header > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.plotstudio-library-results > header strong {
  color: var(--studio-ink);
  font-size: 13px;
}

.plotstudio-library-results > header span,
.plotstudio-library-results > header p {
  color: var(--studio-muted);
  font-size: 9px;
}

.plotstudio-library-results > header p {
  margin: 0;
}

.plotstudio-library-grid {
  display: grid;
  min-height: 0;
  padding: 12px 14px 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start;
  gap: 9px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #b6c0b8 transparent;
}

.plotstudio-library-card {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 116px;
  padding: 8px;
  grid-template-columns: 104px minmax(0, 1fr);
  align-items: stretch;
  gap: 10px;
  color: inherit;
  font: inherit;
  text-align: left;
  background: #fff;
  border: 1px solid var(--studio-line);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease;
}

.plotstudio-library-card:hover,
.plotstudio-library-card:focus-visible {
  border-color: #89a897;
  box-shadow: 0 8px 20px rgba(25, 48, 39, .09);
  transform: translateY(-1px);
}

.plotstudio-library-card.is-selected {
  background: #f4f8f4;
  border-color: var(--studio-green);
}

.plotstudio-library-card canvas {
  display: block;
  width: 104px;
  height: 78px;
  align-self: center;
  background: #fbfcfa;
  border: 1px solid #e0e5df;
  border-radius: 4px;
}

.plotstudio-library-card > span {
  display: flex;
  min-width: 0;
  padding: 3px 0;
  flex-direction: column;
}

.plotstudio-library-card small:first-child {
  overflow: hidden;
  color: var(--studio-green);
  font-size: 8px;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plotstudio-library-card strong {
  display: -webkit-box;
  margin-top: 4px;
  overflow: hidden;
  color: var(--studio-ink);
  font-size: 12px;
  font-weight: 720;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.plotstudio-library-card em {
  display: -webkit-box;
  margin-top: 5px;
  overflow: hidden;
  color: var(--studio-muted);
  font-size: 8px;
  font-style: normal;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.plotstudio-library-card small:last-child {
  margin-top: auto;
  padding-top: 5px;
  color: #8a6a31;
  font-size: 8px;
  font-weight: 650;
}

.plotstudio-library-card[data-maturity="verified"] small:last-child {
  color: var(--studio-green);
}

.plotstudio-library-empty {
  display: grid;
  min-height: 280px;
  grid-column: 1 / -1;
  place-items: center;
  align-content: center;
  gap: 7px;
  text-align: center;
}

.plotstudio-library-empty img {
  width: 28px;
  height: 28px;
  opacity: .55;
}

.plotstudio-library-empty strong {
  font-size: 13px;
}

.plotstudio-library-empty p {
  margin: 0;
  color: var(--studio-muted);
  font-size: 10px;
}

.plotstudio-library-pagination {
  display: flex;
  min-height: 52px;
  padding: 8px 14px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: #fbfbf7;
  border-top: 1px solid var(--studio-line);
}

.plotstudio-library-pagination button,
.plotstudio-library-pagination span {
  display: grid;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  place-items: center;
  color: var(--studio-copy);
  font: inherit;
  font-size: 9px;
  background: #fff;
  border: 1px solid var(--studio-line);
  border-radius: 4px;
}

.plotstudio-library-pagination button {
  cursor: pointer;
}

.plotstudio-library-pagination button.is-active {
  color: #fff;
  background: var(--studio-green);
  border-color: var(--studio-green);
}

.plotstudio-library-pagination button:disabled {
  cursor: not-allowed;
  opacity: .42;
}

body.plotlibrary-open .site-smooth-content {
  pointer-events: none;
}

body.plotlibrary-open .plotstudio-library {
  pointer-events: auto;
}

@media (max-width: 1120px) {
  body[data-page="scientific-plotting"] .plotrun-dialog {
    width: min(calc(100% - 28px), 1000px);
  }

  body[data-page="scientific-plotting"] .plotrun-body {
    grid-template:
      "project stage" clamp(500px, 58vw, 600px)
      "controls controls" auto
      "drawer drawer" auto
      "utility utility" auto /
      210px minmax(0, 1fr);
  }

  body[data-page="scientific-plotting"] .plotrun-stage {
    min-height: 0;
    border-right: 0;
  }

  body[data-page="scientific-plotting"] .plotwb-canvas-viewport {
    min-height: 0;
    padding: 16px 12px 36px;
  }

  body[data-page="scientific-plotting"] .plotrun-data {
    min-height: 0;
    border-top: 1px solid var(--studio-line-dark);
  }

  body[data-page="scientific-plotting"] .plotrun-scroll {
    overflow: visible;
  }

  body[data-page="scientific-plotting"] .plotwb-form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .plotstudio-library-head {
    grid-template-columns: minmax(0, 1fr) 38px;
  }

  .plotstudio-library-head dl {
    display: none;
  }

  .plotstudio-library-body {
    grid-template-columns: 192px minmax(0, 1fr);
  }

  .plotstudio-library-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  body[data-page="scientific-plotting"] .plotrun-layer {
    padding: 10px 0 24px;
  }

  body[data-page="scientific-plotting"] .plotrun-dialog {
    width: calc(100% - 14px);
    border-radius: 7px;
  }

  body[data-page="scientific-plotting"] .plotrun-head {
    min-height: 62px;
    padding: 10px;
    gap: 8px;
  }

  .plotstudio-heading {
    display: grid;
    gap: 4px;
  }

  .plotstudio-heading h1 {
    padding: 0;
    font-size: 17px;
    border: 0;
  }

  .plotstudio-heading p {
    max-width: 190px;
    gap: 5px;
    font-size: 9px;
  }

  .plotstudio-heading p strong {
    max-width: 96px;
  }

  .plotstudio-save {
    display: none;
  }

  .plotstudio-head-actions > button,
  .plotstudio-export {
    min-height: 34px;
    padding: 0 10px;
    font-size: 11px;
  }

  body[data-page="scientific-plotting"] .plotstudio-stepper {
    height: 66px;
    padding: 7px 8px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }

  body[data-page="scientific-plotting"] .plotstudio-stepper::-webkit-scrollbar {
    display: none;
  }

  body[data-page="scientific-plotting"] .plotstudio-stepper::before {
    top: 22px;
    right: 10%;
    left: 10%;
  }

  body[data-page="scientific-plotting"] .plotstudio-stepper button span {
    width: 29px;
    height: 29px;
    font-size: 10px;
  }

  body[data-page="scientific-plotting"] .plotstudio-stepper button strong {
    font-size: 8px;
  }

  body[data-page="scientific-plotting"] .plotrun-body {
    display: flex;
    min-height: 0;
    flex-direction: column;
  }

  .plotstudio-project,
  body[data-page="scientific-plotting"] .plotrun-stage,
  body[data-page="scientific-plotting"] .plotrun-data,
  .plotstudio-data-drawer,
  .plotstudio-utility {
    width: 100%;
  }

  .plotstudio-project {
    padding: 0 10px 10px;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--studio-line-dark);
  }

  .plotstudio-project > header {
    height: 44px;
  }

  .plotstudio-project section {
    padding: 10px 0;
  }

  .plotstudio-dataset .plotstudio-section-label {
    margin-bottom: 7px;
  }

  body[data-page="scientific-plotting"] .plotstudio-dataset .plotwb-dropzone {
    min-height: 62px;
    padding: 9px 11px;
    grid-template-columns: 24px minmax(0, 1fr);
    grid-template-rows: auto auto;
    place-items: center start;
    column-gap: 9px;
    row-gap: 1px;
    text-align: left;
  }

  body[data-page="scientific-plotting"] .plotstudio-dataset .plotwb-dropzone img {
    grid-row: 1 / 3;
  }

  body[data-page="scientific-plotting"] .plotstudio-dataset .plotwb-dropzone strong {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .plotstudio-chart-picker .plotstudio-section-label {
    margin-bottom: 7px;
  }

  .plotstudio-chart-grid {
    display: flex;
    padding: 1px 1px 5px;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    scrollbar-color: #8fa99b transparent;
  }

  .plotstudio-chart-grid::-webkit-scrollbar {
    height: 4px;
  }

  .plotstudio-chart-grid::-webkit-scrollbar-track {
    background: transparent;
  }

  .plotstudio-chart-grid::-webkit-scrollbar-thumb {
    background: #8fa99b;
    border-radius: 999px;
  }

  .plotstudio-chart-grid > button {
    flex: 0 0 108px;
    scroll-snap-align: start;
  }

  .plotstudio-recent {
    display: none;
  }

  body[data-page="scientific-plotting"] .plotrun-stage {
    min-height: 0;
  }

  body[data-page="scientific-plotting"] .plotwb-canvas-viewport {
    height: clamp(250px, 68vw, 360px);
    min-height: 0;
    padding: 0;
    flex: 0 0 auto;
  }

  body[data-page="scientific-plotting"] #plotCanvas {
    width: calc(100% - 16px);
    height: calc(100% - 52px);
    max-height: none;
    inset: 10px 8px 42px;
  }

  .plotstudio-direct-hint {
    top: 5px;
    max-width: calc(100% - 16px);
    font-size: 9px;
  }

  .plotstudio-direct-item {
    min-width: 32px;
    min-height: 28px;
    padding: 5px 7px;
  }

  body[data-page="scientific-plotting"] .plotwb-stage-summary dl,
  body[data-page="scientific-plotting"] .plotwb-form-grid {
    grid-template-columns: 1fr;
  }

  body[data-page="scientific-plotting"] .plotwb-stage-summary dl > div {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body[data-page="scientific-plotting"] .plotwb-stage-summary dt {
    grid-column: 1 / -1;
    border: 0;
  }

  .plotstudio-data-drawer > header {
    padding: 0 10px;
  }

  #plotFocusSearch {
    display: none;
  }

  .plotstudio-utility {
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
  }

  .plotstudio-library {
    width: calc(100vw - 12px);
    height: calc(100vh - 12px);
    height: calc(100dvh - 12px);
    border-radius: 8px;
  }

  .plotstudio-library-head {
    min-height: 90px;
    padding: 13px 12px;
    gap: 8px;
  }

  .plotstudio-library-head h2 {
    font-size: 20px;
  }

  .plotstudio-library-head p {
    display: -webkit-box;
    overflow: hidden;
    font-size: 9px;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .plotstudio-library-toolbar {
    display: grid;
    padding: 8px;
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .plotstudio-library-status {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .plotstudio-library-status button {
    padding: 0 5px;
    font-size: 9px;
  }

  .plotstudio-library-body {
    display: flex;
    min-height: 0;
    flex-direction: column;
  }

  .plotstudio-library-body > aside {
    display: flex;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 49px;
    padding: 6px 8px;
    flex: 0 0 auto;
    gap: 5px;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--studio-line);
    scrollbar-width: none;
  }

  .plotstudio-library-body > aside > button,
  #plotLibraryCategories button {
    width: auto;
    min-width: max-content;
    min-height: 35px;
    padding: 0 9px;
    grid-template-columns: auto auto;
  }

  #plotLibraryCategories {
    display: flex;
    width: max-content;
    gap: 5px;
  }

  .plotstudio-library-body > aside > section {
    display: none;
  }

  .plotstudio-library-results {
    min-height: 0;
    flex: 1 1 auto;
    grid-template-rows: 44px minmax(0, 1fr) 48px;
  }

  .plotstudio-library-results > header {
    padding: 0 10px;
  }

  .plotstudio-library-results > header p {
    display: none;
  }

  .plotstudio-library-grid {
    padding: 8px;
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .plotstudio-library-card {
    min-height: 104px;
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .plotstudio-library-card canvas {
    width: 96px;
    height: 70px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-page="scientific-plotting"] *,
  body[data-page="scientific-plotting"] *::before,
  body[data-page="scientific-plotting"] *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Mobile interaction pass: preserve the compact studio density while making
   the project, data-source and canvas utility actions reliable touch targets. */
@media (max-width: 720px) {
  .plotstudio-project .plotstudio-library-trigger,
  body[data-page="scientific-plotting"] .plotwb-tabs button,
  body[data-page="scientific-plotting"] .plotrun-section-head button {
    min-height: 36px;
  }

  .plotstudio-canvas-tools button {
    min-width: 36px;
    height: 36px;
    padding: 0 4px;
    gap: 3px;
    font-size: 9px;
  }

  .plotstudio-canvas-tools {
    right: 6px;
    bottom: 6px;
  }

  .plotstudio-canvas-tools output {
    min-width: 42px;
    padding: 0 3px;
  }

  .plotstudio-canvas-tools :is(#plotMoveGraphic, #plotEditShapes) {
    min-width: 48px;
  }

  .plotstudio-canvas-tools :is(#plotDeleteShape, #plotFullscreen) span {
    display: none;
  }

  body[data-page="scientific-plotting"] .plotwb-palette-row button {
    height: 36px;
    border-width: 4px;
  }

  body[data-page="scientific-plotting"] .plotwb-form-grid input[type="range"] {
    min-height: 32px;
  }

  body[data-page="scientific-plotting"] .plotwb-toggle-control input[type="checkbox"] {
    width: 48px;
    min-width: 48px;
    height: 30px;
  }

  body[data-page="scientific-plotting"] .plotwb-toggle-control input[type="checkbox"]::after {
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
  }

  body[data-page="scientific-plotting"] .plotwb-toggle-control input[type="checkbox"]:checked::after {
    transform: translateX(18px);
  }

  .plotstudio-data-drawer > header button,
  body[data-page="scientific-plotting"] .plotrun-auto label,
  .plotstudio-utility label,
  .plotstudio-utility .plot-font-control button {
    min-height: 36px;
  }

  body[data-page="scientific-plotting"] .plotrun-auto label,
  .plotstudio-utility label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .plotstudio-utility .plot-font-control button {
    min-width: 36px;
    padding-inline: 8px;
  }
}
