/*
 * Research Editorial UI — shared visual system for data analysis and plotting.
 * The frame follows the selected editorial scientific-studio reference:
 * index on the left, uninterrupted working canvas, properties on the edge.
 */

:where(body[data-studio="analysis"], body[data-studio="plotting"]) {
  --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;
  --re-width: 1340px;
  --re-ease: cubic-bezier(.22, 1, .36, 1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

html[data-theme="dark"] :where(body[data-studio="analysis"], body[data-studio="plotting"]) {
  --re-paper: #101713;
  --re-surface: #17201b;
  --re-surface-soft: #1c2821;
  --re-ink: #eef4ef;
  --re-text: #c6d1ca;
  --re-muted: #8f9e95;
  --re-line: #314037;
  --re-line-strong: #46574d;
  --re-green: #8cbea2;
  --re-green-soft: #24372b;
  --re-blue: #88a6d1;
  --re-red: #df8a8c;
}

.research-mode-switch {
  display: flex;
  align-items: center;
  align-self: center;
  gap: 30px;
  min-width: max-content;
}

.research-mode-switch a {
  position: relative;
  display: grid;
  min-height: 48px;
  place-items: center;
  color: var(--re-muted);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
  transition: color .2s var(--re-ease);
}

.research-mode-switch a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--re-green);
  opacity: 0;
  transform: scaleX(.4);
  transition: opacity .2s var(--re-ease), transform .28s var(--re-ease);
}

.research-mode-switch a:hover,
.research-mode-switch a:focus-visible,
.research-mode-switch a[aria-current="page"] { color: var(--re-ink); }
.research-mode-switch a[aria-current="page"]::after { opacity: 1; transform: scaleX(1); }

/* -------------------------------------------------------------------------- */
/* Data analysis — editorial canvas                                            */
/* -------------------------------------------------------------------------- */

body[data-page="data-analysis"] .analysis-lab-section {
  padding: 30px 0 90px;
  border-top: 1px solid var(--re-line);
  background: var(--re-paper);
}

body[data-page="data-analysis"] .analysis-lab-section > .container,
body[data-page="data-analysis"] .map-analysis-section > .container {
  width: min(calc(100% - 72px), var(--re-width)) !important;
  max-width: none !important;
}

body[data-page="data-analysis"] .analysis-lab-heading {
  display: grid;
  grid-template-columns: minmax(270px, 1fr) auto auto;
  align-items: center;
  gap: 36px;
  min-height: 92px;
  border: 1px solid var(--re-line-strong);
  border-radius: 0;
  padding: 15px 24px;
  color: var(--re-ink);
  background: var(--re-surface);
  box-shadow: none;
}

body[data-page="data-analysis"] .analysis-lab-title > p {
  margin: 0;
  color: var(--re-green);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .16em;
}

body[data-page="data-analysis"] .analysis-lab-title h2 {
  margin: 5px 0 0;
  color: var(--re-ink);
  font-size: clamp(25px, 2.4vw, 34px);
  font-weight: 760;
  line-height: 1.12;
  letter-spacing: -.04em;
}

body[data-page="data-analysis"] .analysis-lab-title > span { display: none; }
body[data-page="data-analysis"] .analysis-lab-heading-meta { gap: 12px; }
body[data-page="data-analysis"] .analysis-lab-heading-meta span { color: var(--re-muted); font-size: 12px; }
body[data-page="data-analysis"] .analysis-lab-heading-meta strong { color: var(--re-ink); font-size: 13px; }
body[data-page="data-analysis"] .analysis-lab-heading-meta i { background: var(--re-line); }

body[data-page="data-analysis"] .analysis-studio-shell {
  display: grid;
  grid-template-columns: 318px minmax(0, 1fr);
  min-height: 820px;
  margin: 0;
  border: 1px solid var(--re-line-strong);
  border-top: 0;
  border-radius: 0;
  overflow: hidden;
  background: var(--re-surface);
  box-shadow: none;
}

body[data-page="data-analysis"] .analysis-inspector {
  height: 820px;
  border-right: 1px solid var(--re-line-strong);
  overflow-y: auto;
  color: var(--re-text);
  background: var(--re-surface);
  scrollbar-width: thin;
  scrollbar-color: var(--re-line-strong) transparent;
}

body[data-page="data-analysis"] .analysis-setup-block {
  border-bottom: 1px solid var(--re-line);
  padding: 18px 20px 20px;
}

body[data-page="data-analysis"] .analysis-setup-heading {
  align-items: center;
  margin-bottom: 14px;
}

body[data-page="data-analysis"] .analysis-setup-heading > div { gap: 8px; }
body[data-page="data-analysis"] .analysis-setup-heading > div > b {
  display: none;
}
body[data-page="data-analysis"] .analysis-setup-heading h3 {
  color: var(--re-ink);
  font-size: 14px;
  font-weight: 730;
}
body[data-page="data-analysis"] .analysis-setup-heading > span {
  color: var(--re-muted);
  font-size: 11px;
}

body[data-page="data-analysis"] .analysis-method-search {
  min-height: 43px;
  border: 1px solid var(--re-line-strong);
  border-radius: 3px;
  padding: 0 12px;
  background: var(--re-surface);
  transition: border-color .18s var(--re-ease), box-shadow .18s var(--re-ease);
}
body[data-page="data-analysis"] .analysis-method-search input { color: var(--re-text); font-size: 13px; }
body[data-page="data-analysis"] .analysis-method-search:focus-within {
  border-color: var(--re-green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--re-green) 10%, transparent);
}

body[data-page="data-analysis"] .analysis-category-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin: 11px 0 14px;
}

body[data-page="data-analysis"] .analysis-category-tabs button {
  min-height: 38px;
  border: 1px solid var(--re-line);
  border-radius: 2px;
  padding: 0 8px;
  color: var(--re-muted);
  background: transparent;
  font-size: 11px;
  transition: border-color .18s var(--re-ease), color .18s var(--re-ease), background-color .18s var(--re-ease);
}

body[data-page="data-analysis"] .analysis-category-tabs button:hover { border-color: var(--re-line-strong); color: var(--re-ink); }
body[data-page="data-analysis"] .analysis-category-tabs button[aria-selected="true"] {
  border-color: var(--re-green);
  color: var(--re-green);
  background: var(--re-green-soft);
}

body[data-page="data-analysis"] .analysis-method-strip {
  display: grid;
  gap: 0;
  max-height: 182px;
  border-top: 1px solid var(--re-line);
  overflow-y: auto;
}

body[data-page="data-analysis"] .analysis-method-strip > button {
  min-height: 56px;
  border: 0;
  border-bottom: 1px solid var(--re-line);
  border-radius: 0;
  padding: 10px 25px 10px 10px;
  color: var(--re-ink);
  background: transparent;
  transition: color .18s var(--re-ease), background-color .18s var(--re-ease), padding-left .25s var(--re-ease);
}
body[data-page="data-analysis"] .analysis-method-strip > button::before { display: none; }
body[data-page="data-analysis"] .analysis-method-strip > button::after {
  right: 8px;
  color: var(--re-muted);
}
body[data-page="data-analysis"] .analysis-method-strip > button span { font-size: 13px; }
body[data-page="data-analysis"] .analysis-method-strip > button small { margin-top: 3px; color: var(--re-muted); font-size: 10px; }
body[data-page="data-analysis"] .analysis-method-strip > button:hover { color: var(--re-green); background: var(--re-surface-soft); padding-left: 14px; }
body[data-page="data-analysis"] .analysis-method-strip > button[aria-pressed="true"] {
  border-left: 3px solid var(--re-green);
  color: var(--re-green);
  background: var(--re-green-soft);
  box-shadow: none;
  padding-left: 11px;
}

body[data-page="data-analysis"] .analysis-data-actions { gap: 8px; margin-bottom: 12px; }
body[data-page="data-analysis"] .analysis-data-actions :where(label, button) {
  min-height: 39px;
  border: 1px solid var(--re-line-strong);
  border-radius: 2px;
  color: var(--re-ink);
  background: transparent;
  font-size: 12px;
  transition: color .18s var(--re-ease), border-color .18s var(--re-ease), background-color .18s var(--re-ease);
}
body[data-page="data-analysis"] .analysis-data-actions :where(label, button):hover { border-color: var(--re-green); color: var(--re-green); background: var(--re-green-soft); }

body[data-page="data-analysis"] .analysis-method-summary {
  margin: 0 0 14px;
  border-left: 2px solid var(--re-green);
  padding-left: 10px;
  color: var(--re-muted);
  font-size: 12px;
  line-height: 1.65;
}

body[data-page="data-analysis"] .analysis-lab-field-grid { gap: 12px 9px; }
body[data-page="data-analysis"] .analysis-lab-field > span { color: var(--re-text); font-size: 12px; }
body[data-page="data-analysis"] .analysis-lab-field :where(select, input, textarea) {
  min-height: 41px;
  border: 1px solid var(--re-line-strong);
  border-radius: 2px;
  color: var(--re-text);
  background: var(--re-surface);
  font-size: 12px;
  transition: border-color .18s var(--re-ease), box-shadow .18s var(--re-ease);
}
body[data-page="data-analysis"] .analysis-lab-field textarea { min-height: 92px; max-height: 138px; font-size: 10px; }
body[data-page="data-analysis"] .analysis-lab-field :where(select, input, textarea):focus {
  border-color: var(--re-green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--re-green) 9%, transparent);
}

body[data-page="data-analysis"] .analysis-inspector-disclosure { border-bottom: 1px solid var(--re-line); }
body[data-page="data-analysis"] .analysis-inspector-disclosure summary {
  min-height: 52px;
  padding: 0 20px;
  color: var(--re-ink);
  font-size: 12px;
}
body[data-page="data-analysis"] .analysis-inspector-disclosure[open] summary { color: var(--re-green); background: var(--re-green-soft); }
body[data-page="data-analysis"] .analysis-disclosure-body { border-top: 1px solid var(--re-line); padding: 17px 20px 20px; }

body[data-page="data-analysis"] .analysis-inspector-footer {
  grid-template-columns: minmax(0, 1fr) 128px;
  min-height: 68px;
  border-top: 1px solid var(--re-line-strong);
  padding: 11px 20px;
  background: var(--re-surface);
  backdrop-filter: none;
}
body[data-page="data-analysis"] .analysis-inspector-footer p { color: var(--re-muted); font-size: 10px; }
body[data-page="data-analysis"] .analysis-inspector-footer .button {
  min-height: 42px;
  border: 1px solid var(--re-green);
  border-radius: 2px;
  color: #fff;
  background: var(--re-green);
  box-shadow: none;
  font-size: 12px;
  transition: background-color .18s var(--re-ease), transform .18s var(--re-ease);
}
body[data-page="data-analysis"] .analysis-inspector-footer .button:hover { background: color-mix(in srgb, var(--re-green) 88%, #000); transform: translateY(-1px); }

body[data-page="data-analysis"] .analysis-result-canvas {
  min-width: 0;
  background: var(--re-surface);
}
body[data-page="data-analysis"] .analysis-result-toolbar {
  min-height: 90px;
  border-bottom: 1px solid var(--re-line);
  padding: 15px 24px 14px 27px;
}
body[data-page="data-analysis"] .analysis-result-title > span { color: var(--re-green); }
body[data-page="data-analysis"] .analysis-result-title h3 {
  margin-top: 7px;
  color: var(--re-ink);
  font-size: clamp(25px, 2.4vw, 34px);
  font-weight: 760;
}
body[data-page="data-analysis"] .analysis-result-status { gap: 13px; color: var(--re-muted); font-size: 11px; }
body[data-page="data-analysis"] .analysis-result-status b { color: var(--re-ink); font-size: 11px; }
body[data-page="data-analysis"] .analysis-quality-badge {
  border: 0;
  border-radius: 0;
  padding: 0;
  color: var(--re-green) !important;
  background: transparent;
}
body[data-page="data-analysis"] .analysis-quality-badge i { box-shadow: none; }
body[data-page="data-analysis"] .analysis-result-status button {
  min-height: 38px;
  border: 1px solid var(--re-line-strong);
  border-radius: 2px;
  padding: 0 13px;
  color: var(--re-ink);
  background: transparent;
  font-size: 12px;
  transition: color .18s var(--re-ease), border-color .18s var(--re-ease), background-color .18s var(--re-ease);
}
body[data-page="data-analysis"] .analysis-result-status button:hover { border-color: var(--re-green); color: var(--re-green); background: var(--re-green-soft); }

body[data-page="data-analysis"] .analysis-result-tabs {
  gap: 34px;
  min-height: 51px;
  border-bottom: 1px solid var(--re-line);
  padding: 0 27px;
}
body[data-page="data-analysis"] .analysis-result-tabs button { color: var(--re-muted); font-size: 13px; }
body[data-page="data-analysis"] .analysis-result-tabs button[aria-selected="true"] { color: var(--re-green); }
body[data-page="data-analysis"] .analysis-result-tabs button[aria-selected="true"]::after { background: var(--re-green); }

body[data-page="data-analysis"] .analysis-result-panel {
  min-height: 678px;
  padding: 20px 22px 18px 27px;
  background: var(--re-surface);
  animation: re-panel-in .28s var(--re-ease) both;
}

@keyframes re-panel-in {
  from { opacity: .3; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

body[data-page="data-analysis"] .analysis-figure-heading { margin-bottom: 15px; }
body[data-page="data-analysis"] .analysis-figure-heading h4 { color: var(--re-ink); font-size: 16px; }
body[data-page="data-analysis"] .analysis-figure-heading > span { color: var(--re-muted); font-size: 11px; }
body[data-page="data-analysis"] .analysis-chart-layout { grid-template-columns: minmax(0, 1fr) 214px; gap: 0; border-top: 1px solid var(--re-line); border-bottom: 1px solid var(--re-line); }
body[data-page="data-analysis"] .analysis-chart {
  min-height: 374px;
  border: 0;
  border-right: 1px solid var(--re-line);
  border-radius: 0;
  background: var(--re-surface);
}
body[data-page="data-analysis"] .analysis-chart svg { max-height: 390px; }
body[data-page="data-analysis"] .analysis-chart-guide {
  border: 0;
  border-radius: 0;
  padding: 22px 18px;
  background: var(--re-surface-soft);
}
body[data-page="data-analysis"] .analysis-chart-guide span { color: var(--re-ink); font-size: 12px; }
body[data-page="data-analysis"] .analysis-chart-guide p { color: var(--re-muted); font-size: 11px; line-height: 1.75; }

body[data-page="data-analysis"] .analysis-lab-metrics {
  margin-top: 0;
  border: 0;
  border-bottom: 1px solid var(--re-line);
  border-radius: 0;
  background: transparent;
}
body[data-page="data-analysis"] .analysis-lab-metrics article {
  min-height: 78px;
  border-right: 1px solid var(--re-line);
  padding: 14px 15px;
}
body[data-page="data-analysis"] .analysis-lab-metrics span { color: var(--re-muted); font-size: 10px; }
body[data-page="data-analysis"] .analysis-lab-metrics strong { color: var(--re-ink); font-size: 18px; }
body[data-page="data-analysis"] .analysis-lab-metrics small { color: var(--re-muted); font-size: 9px; }

body[data-page="data-analysis"] .analysis-insight-preview {
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 22px;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--re-line);
  border-radius: 0;
  padding: 17px 16px;
  background: transparent;
}
body[data-page="data-analysis"] .analysis-insight-preview h4 { color: var(--re-ink); font-size: 13px; }
body[data-page="data-analysis"] .analysis-insight-preview > p { color: var(--re-text); font-size: 12px; line-height: 1.7; }

body[data-page="data-analysis"] .analysis-table-wrap,
body[data-page="data-analysis"] .analysis-interpretation,
body[data-page="data-analysis"] .analysis-report-head,
body[data-page="data-analysis"] .analysis-report {
  border-color: var(--re-line);
  border-radius: 0;
}
body[data-page="data-analysis"] .analysis-table-wrap table { font-size: 12px; }
body[data-page="data-analysis"] .analysis-interpretation { background: var(--re-surface-soft); }

body[data-page="data-analysis"] #analysisLab.is-updating .analysis-result-canvas {
  opacity: .72;
  transform: translateY(2px);
}
body[data-page="data-analysis"] .analysis-result-canvas {
  transition: opacity .18s var(--re-ease), transform .22s var(--re-ease);
}

/* Spatial mode follows the same square, editorial frame. */
body[data-page="data-analysis"] .map-analysis-section { padding-top: 18px !important; background: var(--re-paper) !important; }
body[data-page="data-analysis"] .map-mode-tabs { border-color: var(--re-line-strong) !important; border-radius: 0; }
body[data-page="data-analysis"] .map-workbench { border-color: var(--re-line-strong) !important; border-radius: 0; }
body[data-page="data-analysis"] .map-control-panel { border-color: var(--re-line-strong); background: var(--re-surface); }

/* -------------------------------------------------------------------------- */
/* Scientific plotting — chart index + large artboard                         */
/* -------------------------------------------------------------------------- */

body[data-page="scientific-plotting"] {
  --pc-bg: var(--re-paper);
  --pc-surface: var(--re-surface);
  --pc-surface-2: var(--re-surface-soft);
  --pc-ink: var(--re-ink);
  --pc-muted: var(--re-text);
  --pc-faint: var(--re-muted);
  --pc-line: var(--re-line);
  --pc-line-strong: var(--re-line-strong);
  --pc-brand: var(--re-green);
  --pc-brand-2: var(--re-green);
  --pc-soft: var(--re-green-soft);
  --pc-width: var(--re-width);
}

body[data-page="scientific-plotting"] .plotcat-page { padding-bottom: 54px; background: var(--re-paper); }
body[data-page="scientific-plotting"] .plotcat-banner { height: clamp(190px, 18vw, 258px); }
body[data-page="scientific-plotting"] .plotcat-heading,
body[data-page="scientific-plotting"] .plotcat-shell,
body[data-page="scientific-plotting"] .plotcat-status {
  width: min(calc(100% - 72px), var(--re-width));
}

body[data-page="scientific-plotting"] .plotcat-heading {
  display: grid;
  grid-template-columns: minmax(330px, 1fr) auto minmax(360px, .9fr);
  align-items: center;
  gap: 34px;
  padding: 24px 0 20px;
}
body[data-page="scientific-plotting"] .plotcat-title-block { gap: 16px; }
body[data-page="scientific-plotting"] .plotcat-title-icon {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 0;
  background: transparent;
}
body[data-page="scientific-plotting"] .plotcat-title-icon img { width: 30px; height: 30px; }
body[data-page="scientific-plotting"] .plotcat-title-block h1 {
  color: var(--re-ink);
  font-family: inherit;
  font-size: clamp(30px, 2.7vw, 42px);
  font-weight: 760;
  letter-spacing: -.04em;
}
body[data-page="scientific-plotting"] .plotcat-title-block p { max-width: 540px; margin-top: 6px; color: var(--re-muted); font-size: 14px; }
body[data-page="scientific-plotting"] .plotcat-search {
  grid-template-columns: 28px minmax(0, 1fr) 74px;
  min-height: 48px;
  border: 1px solid var(--re-line-strong);
  border-radius: 3px;
  background: var(--re-surface);
  box-shadow: none;
}
body[data-page="scientific-plotting"] .plotcat-search input { height: 46px; color: var(--re-text); font-size: 13px; }
body[data-page="scientific-plotting"] .plotcat-search button {
  border: 5px solid var(--re-surface);
  border-radius: 1px;
  background: var(--re-green);
  font-size: 12px;
}

body[data-page="scientific-plotting"] .plotcat-shell {
  display: grid;
  grid-template-columns: 178px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: 820px;
  min-height: 720px;
  border: 1px solid var(--re-line-strong);
  border-radius: 0;
  overflow: hidden;
  background: var(--re-surface);
  box-shadow: none;
}

body[data-page="scientific-plotting"] .plotcat-map {
  grid-column: 1;
  min-height: 0;
  border-right: 1px solid var(--re-line-strong);
  padding: 14px 0 12px;
  background: var(--re-surface);
}
body[data-page="scientific-plotting"] .plotcat-map-head {
  grid-template-columns: 1fr;
  padding: 6px 14px 16px;
  gap: 7px;
}
body[data-page="scientific-plotting"] .plotcat-map-head > span {
  display: inline;
  width: auto;
  height: auto;
  color: var(--re-green);
  background: transparent;
  font-size: 11px;
  text-align: left;
}
body[data-page="scientific-plotting"] .plotcat-map h2 { color: var(--re-ink); font-size: 15px; }
body[data-page="scientific-plotting"] .plotcat-map-head p { color: var(--re-muted); font-size: 10px; }
body[data-page="scientific-plotting"] .plotcat-map h3 { margin: 16px 14px 7px; color: var(--re-muted); font-size: 10px; letter-spacing: .1em; }
body[data-page="scientific-plotting"] .plotcat-view-stack {
  margin: 0;
  border-color: var(--re-line);
  padding: 8px 7px;
  gap: 0;
}
body[data-page="scientific-plotting"] .plotcat-view-stack button {
  min-height: 40px;
  border-radius: 0;
  padding: 6px 9px;
  color: var(--re-muted);
  font-size: 11px;
  transition: color .18s var(--re-ease), background-color .18s var(--re-ease), padding-left .22s var(--re-ease);
}
body[data-page="scientific-plotting"] .plotcat-view-stack button:hover { color: var(--re-ink); padding-left: 12px; }
body[data-page="scientific-plotting"] .plotcat-view-stack button[aria-pressed="true"] { color: var(--re-green); background: var(--re-green-soft); }
body[data-page="scientific-plotting"] .plotcat-view-stack button strong { font-size: 12px; }
body[data-page="scientific-plotting"] .plotcat-view-stack button span { font-size: 9px; }
body[data-page="scientific-plotting"] .plotcat-map nav {
  height: calc(100% - 260px);
  overflow-y: auto;
  padding: 0 6px 10px;
}
body[data-page="scientific-plotting"] .plotcat-map nav button {
  grid-template-columns: 24px minmax(0, 1fr) auto;
  min-height: 43px;
  border-radius: 0;
  padding: 6px 8px;
  color: var(--re-muted);
  transition: color .18s var(--re-ease), background-color .18s var(--re-ease), transform .22s var(--re-ease);
}
body[data-page="scientific-plotting"] .plotcat-map nav button:hover { color: var(--re-ink); background: var(--re-surface-soft); transform: translateX(2px); }
body[data-page="scientific-plotting"] .plotcat-map nav button[aria-pressed="true"] { color: var(--re-green); background: var(--re-green-soft); }
body[data-page="scientific-plotting"] .plotcat-map nav img { width: 18px; height: 18px; }
body[data-page="scientific-plotting"] .plotcat-map nav span { font-size: 11px; }

body[data-page="scientific-plotting"] .plotcat-results {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  grid-template-rows: 60px 42px minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: var(--re-surface);
}
body[data-page="scientific-plotting"] .plotcat-toolbar {
  grid-column: 1 / -1;
  grid-row: 1;
  min-height: 60px;
  border-bottom: 1px solid var(--re-line);
  padding: 0 18px;
}
body[data-page="scientific-plotting"] .plotcat-toolbar > div:first-child strong { color: var(--re-ink); font-size: 16px; }
body[data-page="scientific-plotting"] .plotcat-toolbar > div:first-child span { color: var(--re-muted); font-size: 11px; }
body[data-page="scientific-plotting"] .plotcat-toolbar-meta { color: var(--re-muted); }
body[data-page="scientific-plotting"] .plotcat-self-check {
  border-radius: 0;
  color: var(--re-green);
  background: transparent;
  font-size: 10px;
}
body[data-page="scientific-plotting"] .plotcat-toolbar-meta select,
body[data-page="scientific-plotting"] .plotcat-toolbar-meta button {
  height: 34px;
  border: 1px solid var(--re-line);
  border-radius: 2px;
  color: var(--re-muted);
  background: var(--re-surface);
}
body[data-page="scientific-plotting"] .plotcat-toolbar-meta button.is-active { border-color: var(--re-green); color: var(--re-green); background: var(--re-green-soft); }

body[data-page="scientific-plotting"] .plotcat-list-head {
  grid-column: 1;
  grid-row: 2;
  min-height: 42px;
  border-right: 1px solid var(--re-line);
  border-bottom: 1px solid var(--re-line);
  padding: 0 14px;
  background: var(--re-surface-soft);
}
body[data-page="scientific-plotting"] .plotcat-list-head strong { color: var(--re-ink); font-size: 12px; }

body[data-page="scientific-plotting"] .plotcat-tool-list {
  grid-column: 1;
  grid-row: 3;
  min-height: 0;
  border-right: 1px solid var(--re-line);
  overflow-y: auto;
  padding: 0;
}
body[data-page="scientific-plotting"] .plotcat-tool-row,
body[data-page="scientific-plotting"] .plotcat-tool-list.is-grid .plotcat-tool-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 30px;
  min-height: 70px;
  border: 0;
  border-bottom: 1px solid var(--re-line);
  border-radius: 0;
  padding: 8px 9px;
  align-items: center;
  gap: 10px;
  color: var(--re-ink);
  background: transparent;
  box-shadow: none;
  transform: none;
  transition: color .18s var(--re-ease), background-color .18s var(--re-ease), padding-left .24s var(--re-ease);
}
body[data-page="scientific-plotting"] .plotcat-tool-row:hover { border-bottom-color: var(--re-line); background: var(--re-surface-soft); padding-left: 12px; transform: none; }
body[data-page="scientific-plotting"] .plotcat-tool-row[aria-current="true"] {
  border-left: 3px solid var(--re-green);
  border-bottom-color: var(--re-line);
  padding-left: 9px;
  background: var(--re-green-soft);
}
body[data-page="scientific-plotting"] .plotcat-thumb,
body[data-page="scientific-plotting"] .plotcat-tool-list.is-grid .plotcat-thumb {
  display: block;
  width: 54px;
  height: 42px;
  border: 0;
  border-radius: 0;
  background: var(--re-surface);
}
body[data-page="scientific-plotting"] .plotcat-tool-copy strong { color: var(--re-ink); font-size: 13px; font-weight: 700; }
body[data-page="scientific-plotting"] .plotcat-tool-copy p { margin-top: 3px; color: var(--re-muted); font-size: 9px; line-height: 1.4; }
body[data-page="scientific-plotting"] .plotcat-badge,
body[data-page="scientific-plotting"] .plotcat-card-meta,
body[data-page="scientific-plotting"] .plotcat-card-action { display: none !important; }
body[data-page="scientific-plotting"] .plotcat-favorite {
  width: 30px;
  height: 30px;
  border-radius: 0;
  color: var(--re-muted);
  font-size: 9px;
}
body[data-page="scientific-plotting"] .plotcat-favorite:hover,
body[data-page="scientific-plotting"] .plotcat-favorite[aria-pressed="true"] { color: var(--re-green); background: var(--re-green-soft); }
body[data-page="scientific-plotting"] .plotcat-tool-list.is-grid { display: block; padding: 0; }

body[data-page="scientific-plotting"] .plotcat-detail {
  grid-column: 2;
  grid-row: 2 / 4;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  border: 0;
  padding: 17px 22px 15px;
  align-items: start;
  gap: 13px;
  overflow: hidden;
  background: var(--re-surface);
}
body[data-page="scientific-plotting"] .plotcat-detail-copy { display: block; grid-row: 1; min-width: 0; }
body[data-page="scientific-plotting"] .plotcat-detail-copy > span { color: var(--re-green); font-size: 10px; letter-spacing: .12em; }
body[data-page="scientific-plotting"] .plotcat-detail-copy header { margin-top: 3px; }
body[data-page="scientific-plotting"] .plotcat-detail h2 { color: var(--re-ink); font-size: clamp(25px, 2.2vw, 34px); font-weight: 760; }
body[data-page="scientific-plotting"] .plotcat-detail-copy header button {
  border: 0;
  border-radius: 0;
  color: var(--re-green);
  background: transparent;
  font-size: 11px;
}
body[data-page="scientific-plotting"] .plotcat-detail-copy > p { margin: 6px 0 10px; color: var(--re-muted); font-size: 12px; }
body[data-page="scientific-plotting"] .plotcat-detail dl { display: flex; gap: 28px; margin: 0; }
body[data-page="scientific-plotting"] .plotcat-detail dl div { border-left: 1px solid var(--re-line); padding-left: 10px; }
body[data-page="scientific-plotting"] .plotcat-detail dt { color: var(--re-muted); font-size: 9px; }
body[data-page="scientific-plotting"] .plotcat-detail dd { color: var(--re-text); font-size: 10px; }
body[data-page="scientific-plotting"] #plotDetailCanvas {
  grid-row: 2;
  display: block;
  width: 100% !important;
  height: 100% !important;
  min-height: 0;
  border: 0;
  border-radius: 0;
  object-fit: contain;
  align-self: stretch !important;
  background: #fff;
  box-shadow: none;
  transition: opacity .18s var(--re-ease), transform .28s var(--re-ease);
}
body[data-page="scientific-plotting"] .plotcat-detail.is-refreshing #plotDetailCanvas { opacity: .55; transform: translateY(3px); }
body[data-page="scientific-plotting"] .plotcat-detail-actions {
  grid-row: 3;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--re-line);
  padding-top: 13px;
}
body[data-page="scientific-plotting"] .plotcat-detail-actions > p { margin: 0 auto 0 0; color: var(--re-muted); font-size: 10px; }
body[data-page="scientific-plotting"] .plotcat-detail-actions button {
  min-height: 39px;
  border-radius: 2px;
  padding: 0 17px;
  font-size: 12px;
}
body[data-page="scientific-plotting"] .plotcat-use { background: var(--re-green); }
body[data-page="scientific-plotting"] .plotcat-save { border: 1px solid var(--re-line-strong); color: var(--re-green); background: transparent; }
body[data-page="scientific-plotting"] .plotcat-detail-actions small { display: none; }
body[data-page="scientific-plotting"] .plotcat-status { margin-top: 10px; color: var(--re-muted); font-size: 11px; }

/* Full plotting studio: a full-window artboard rather than a nested modal card. */
body[data-page="scientific-plotting"] .plotrun-layer {
  padding: 0;
  place-items: stretch;
}
body[data-page="scientific-plotting"] .plotrun-backdrop { background: var(--re-paper); backdrop-filter: none; }
body[data-page="scientific-plotting"] .plotrun-dialog {
  width: 100vw;
  height: 100vh;
  border: 0;
  border-radius: 0;
  color: var(--re-ink);
  background: var(--re-surface);
  box-shadow: none;
  animation: re-studio-in .34s var(--re-ease) both;
}
@keyframes re-studio-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
body[data-page="scientific-plotting"] .plotrun-head {
  grid-template-columns: minmax(260px, 1fr) auto 42px;
  min-height: 74px;
  flex-basis: 74px;
  border-bottom: 1px solid var(--re-line-strong);
  padding: 9px 18px 8px 24px;
  background: var(--re-surface);
}
body[data-page="scientific-plotting"] .plotrun-head > div:first-child > span { color: var(--re-green); font-size: 10px; }
body[data-page="scientific-plotting"] .plotrun-head h2 { color: var(--re-ink); font-size: 23px; }
body[data-page="scientific-plotting"] .plotrun-head p { color: var(--re-muted); font-size: 10px; }
body[data-page="scientific-plotting"] .plotrun-mode-tabs button {
  min-height: 40px;
  border-radius: 0;
  color: var(--re-muted);
  font-size: 12px;
}
body[data-page="scientific-plotting"] .plotrun-mode-tabs button[aria-pressed="true"] { border-color: transparent; border-bottom-color: var(--re-green); color: var(--re-green); background: transparent; }
body[data-page="scientific-plotting"] .plotrun-close {
  width: 38px;
  height: 38px;
  border: 1px solid var(--re-line);
  border-radius: 0;
  color: var(--re-ink);
  background: transparent;
}

body[data-page="scientific-plotting"] .plotrun-body {
  grid-template-columns: 342px minmax(0, 1fr);
  grid-template-areas: "controls stage";
}
body[data-page="scientific-plotting"] .plotrun-data {
  border-right: 1px solid var(--re-line-strong);
  border-left: 0;
  background: var(--re-surface);
}
body[data-page="scientific-plotting"] .plotrun-stage { background: var(--re-surface); }
body[data-page="scientific-plotting"] .plotrun-section-head {
  min-height: 55px;
  flex-basis: 55px;
  border-bottom: 1px solid var(--re-line);
  padding: 0 17px;
}
body[data-page="scientific-plotting"] .plotrun-section-head > span { display: none; }
body[data-page="scientific-plotting"] .plotrun-section-head h3 { color: var(--re-ink); font-size: 15px; }
body[data-page="scientific-plotting"] .plotrun-section-head small { color: var(--re-muted); font-size: 10px; }
body[data-page="scientific-plotting"] .plotwb-control-tabs {
  min-height: 45px;
  flex-basis: 45px;
  border-bottom: 1px solid var(--re-line);
  padding: 0 7px;
  background: var(--re-surface);
}
body[data-page="scientific-plotting"] .plotwb-control-tabs button { color: var(--re-muted); font-size: 11px; }
body[data-page="scientific-plotting"] .plotwb-control-tabs button[aria-selected="true"] { color: var(--re-green); background: transparent; }
body[data-page="scientific-plotting"] .plotwb-control-tabs button::after { background: var(--re-green); }
body[data-page="scientific-plotting"] .plotrun-scroll { padding: 0 17px 16px; }
body[data-page="scientific-plotting"] .plotwb-setting-section { border-bottom: 1px solid var(--re-line); padding: 17px 0; }
body[data-page="scientific-plotting"] .plotwb-section-title h4 { color: var(--re-ink); font-size: 13px; }
body[data-page="scientific-plotting"] .plotwb-section-title span { color: var(--re-muted); font-size: 10px; }
body[data-page="scientific-plotting"] .plotwb-tabs button,
body[data-page="scientific-plotting"] .plotwb-param-actions button,
body[data-page="scientific-plotting"] .plotrun-secondary {
  border-radius: 2px;
  color: var(--re-muted);
  background: transparent;
}
body[data-page="scientific-plotting"] .plotwb-tabs button[aria-selected="true"] { border-color: var(--re-green); color: var(--re-green); background: var(--re-green-soft); }
body[data-page="scientific-plotting"] .plotwb-dropzone,
body[data-page="scientific-plotting"] .plotwb-file-chip,
body[data-page="scientific-plotting"] .plotwb-data-table-wrap,
body[data-page="scientific-plotting"] .plotwb-toggle-field,
body[data-page="scientific-plotting"] .plotwb-radio-options label {
  border-radius: 2px;
  border-color: var(--re-line);
  background: var(--re-surface-soft);
}
body[data-page="scientific-plotting"] .plotwb-form-grid label > span,
body[data-page="scientific-plotting"] .plotwb-task-name > span { color: var(--re-text); font-size: 11px; }
body[data-page="scientific-plotting"] .plotwb-form-grid :where(select, input[type="number"], input[type="text"], input[type="color"]),
body[data-page="scientific-plotting"] .plotwb-task-name input {
  height: 40px;
  border-color: var(--re-line-strong);
  border-radius: 2px;
  color: var(--re-text);
  background: var(--re-surface);
  font-size: 11px;
}
body[data-page="scientific-plotting"] .plotrun-submit {
  min-height: 76px;
  flex-basis: 76px;
  border-top: 1px solid var(--re-line-strong);
  padding: 8px 17px;
  background: var(--re-surface);
  box-shadow: none;
}
body[data-page="scientific-plotting"] .plotrun-submit button {
  min-height: 42px;
  border-radius: 2px;
  background: var(--re-green);
  font-size: 13px;
}

body[data-page="scientific-plotting"] .plotrun-stagebar {
  min-height: 58px;
  flex-basis: 58px;
  border-bottom: 1px solid var(--re-line);
  padding: 8px 20px;
  background: var(--re-surface);
}
body[data-page="scientific-plotting"] .plotrun-stagebar strong { color: var(--re-ink); font-size: 14px; }
body[data-page="scientific-plotting"] .plotrun-stagebar span { color: var(--re-muted); font-size: 10px; }
body[data-page="scientific-plotting"] .plotrun-stagebar button {
  height: 35px;
  border-color: var(--re-line);
  border-radius: 2px;
  color: var(--re-muted);
  background: transparent;
  transition: color .18s var(--re-ease), border-color .18s var(--re-ease), background-color .18s var(--re-ease);
}
body[data-page="scientific-plotting"] .plotrun-stagebar button:hover { border-color: var(--re-green); color: var(--re-green); background: var(--re-green-soft); }
body[data-page="scientific-plotting"] .plotwb-canvas-viewport {
  padding: 18px;
  background: var(--re-surface);
  place-items: center;
}
body[data-page="scientific-plotting"] #plotCanvas {
  width: calc(100% - 36px);
  height: calc(100% - 36px);
  inset: 18px;
  background: #fff;
  transition: transform .3s var(--re-ease), opacity .18s var(--re-ease);
}
body[data-page="scientific-plotting"] .plotrun-loading {
  inset: 18px;
  border: 0;
  border-radius: 0;
  background: color-mix(in srgb, var(--re-surface) 94%, transparent);
}
body[data-page="scientific-plotting"] .plotwb-stage-summary {
  min-height: 108px;
  flex-basis: 108px;
  border-top: 1px solid var(--re-line-strong);
  padding: 13px 20px;
  background: var(--re-surface-soft);
}
body[data-page="scientific-plotting"] .plotwb-stage-summary dl { gap: 28px; }
body[data-page="scientific-plotting"] .plotwb-stage-summary dl > div { grid-template-columns: 78px repeat(3, minmax(0, 1fr)); }
body[data-page="scientific-plotting"] .plotwb-stage-summary dt { color: var(--re-ink); }
body[data-page="scientific-plotting"] .plotwb-stage-summary dd span { color: var(--re-muted); font-size: 9px; }
body[data-page="scientific-plotting"] .plotwb-stage-summary dd strong { color: var(--re-text); font-size: 11px; }
body[data-page="scientific-plotting"] .plotrun-info { background: var(--re-surface); }

@media (max-width: 1180px) {
  body[data-page="data-analysis"] .analysis-lab-heading { grid-template-columns: minmax(240px, 1fr) auto; }
  body[data-page="data-analysis"] .analysis-lab-heading-meta { display: none; }
  body[data-page="data-analysis"] .analysis-studio-shell { grid-template-columns: 300px minmax(0, 1fr); }
  body[data-page="scientific-plotting"] .plotcat-heading { grid-template-columns: minmax(300px, 1fr) auto; }
  body[data-page="scientific-plotting"] .plotcat-heading .plotcat-search { grid-column: 1 / -1; }
  body[data-page="scientific-plotting"] .plotcat-shell { grid-template-columns: 160px minmax(0, 1fr); }
  body[data-page="scientific-plotting"] .plotcat-results { grid-template-columns: 270px minmax(0, 1fr); }
}

@media (max-width: 920px) {
  body[data-page="data-analysis"] .analysis-lab-section > .container,
  body[data-page="data-analysis"] .map-analysis-section > .container,
  body[data-page="scientific-plotting"] .plotcat-heading,
  body[data-page="scientific-plotting"] .plotcat-shell,
  body[data-page="scientific-plotting"] .plotcat-status {
    width: min(calc(100% - 36px), var(--re-width)) !important;
  }
  body[data-page="data-analysis"] .analysis-lab-heading { grid-template-columns: 1fr auto; }
  body[data-page="data-analysis"] .analysis-studio-shell { grid-template-columns: 1fr; }
  body[data-page="data-analysis"] .analysis-inspector { height: auto; max-height: none; border-right: 0; border-bottom: 1px solid var(--re-line-strong); overflow: visible; }
  body[data-page="data-analysis"] .analysis-inspector-footer { position: static; }
  body[data-page="scientific-plotting"] .plotcat-shell { display: flex; height: auto; flex-direction: column; }
  body[data-page="scientific-plotting"] .plotcat-map { border-right: 0; border-bottom: 1px solid var(--re-line-strong); }
  body[data-page="scientific-plotting"] .plotcat-map nav { display: flex; height: auto; overflow-x: auto; }
  body[data-page="scientific-plotting"] .plotcat-map nav button { min-width: 170px; }
  body[data-page="scientific-plotting"] .plotcat-view-stack { display: flex; overflow-x: auto; }
  body[data-page="scientific-plotting"] .plotcat-view-stack button { min-width: 150px; }
  body[data-page="scientific-plotting"] .plotcat-results { grid-template-columns: 250px minmax(0, 1fr); min-height: 760px; }
  body[data-page="scientific-plotting"] .plotrun-body { grid-template-columns: 1fr; grid-template-areas: "stage" "controls"; overflow-y: auto; }
  body[data-page="scientific-plotting"] .plotrun-stage { min-height: 620px; }
  body[data-page="scientific-plotting"] .plotrun-data { min-height: 700px; border-top: 1px solid var(--re-line-strong); border-right: 0; }
}

@media (max-width: 680px) {
  body[data-page="data-analysis"] .analysis-lab-section > .container,
  body[data-page="data-analysis"] .map-analysis-section > .container,
  body[data-page="scientific-plotting"] .plotcat-heading,
  body[data-page="scientific-plotting"] .plotcat-shell,
  body[data-page="scientific-plotting"] .plotcat-status {
    width: min(calc(100% - 24px), var(--re-width)) !important;
  }
  .research-mode-switch { gap: 18px; }
  .research-mode-switch a { min-height: 40px; font-size: 12px; }
  body[data-page="data-analysis"] .analysis-lab-heading { display: block; min-height: 0; padding: 17px; }
  body[data-page="data-analysis"] .analysis-lab-heading .research-mode-switch { justify-content: flex-start; margin-top: 14px; }
  body[data-page="data-analysis"] .analysis-result-toolbar { align-items: flex-start; padding: 17px; }
  body[data-page="data-analysis"] .analysis-result-tabs { gap: 0; padding-inline: 0; overflow-x: hidden; }
  body[data-page="data-analysis"] .analysis-result-tabs button { min-width: 0; flex: 1 1 25%; padding-inline: 3px; }
  body[data-page="data-analysis"] .analysis-result-panel { padding: 15px 11px; }
  body[data-page="data-analysis"] .analysis-chart-layout { grid-template-columns: 1fr; }
  body[data-page="data-analysis"] .analysis-chart { border-right: 0; border-bottom: 1px solid var(--re-line); overflow-x: auto; }
  body[data-page="data-analysis"] .analysis-chart svg { min-width: 650px; }
  body[data-page="data-analysis"] .analysis-chart-guide { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  body[data-page="scientific-plotting"] .plotcat-heading { display: block; }
  body[data-page="scientific-plotting"] .plotcat-heading .research-mode-switch { justify-content: flex-start; margin: 13px 0; }
  body[data-page="scientific-plotting"] .plotcat-title-block p { font-size: 12px; }
  body[data-page="scientific-plotting"] .plotcat-results { display: flex; min-height: 0; flex-direction: column; }
  body[data-page="scientific-plotting"] .plotcat-toolbar { order: 1; }
  body[data-page="scientific-plotting"] .plotcat-detail { order: 2; min-height: 540px; }
  body[data-page="scientific-plotting"] .plotcat-list-head { order: 3; }
  body[data-page="scientific-plotting"] .plotcat-tool-list { order: 4; max-height: 620px; border-right: 0; }
  body[data-page="scientific-plotting"] .plotcat-detail dl { display: none; }
  body[data-page="scientific-plotting"] .plotcat-detail-actions { flex-wrap: wrap; }
  body[data-page="scientific-plotting"] .plotcat-detail-actions > p { width: 100%; }
  body[data-page="scientific-plotting"] .plotrun-head { min-height: 112px; grid-template-columns: 1fr 38px; }
  body[data-page="scientific-plotting"] .plotrun-mode-tabs { grid-column: 1 / -1; grid-row: 2; overflow-x: auto; }
  body[data-page="scientific-plotting"] .plotrun-stagebar {
    min-height: 100px;
    flex-basis: 100px;
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
    overflow: hidden;
  }
  body[data-page="scientific-plotting"] .plotrun-stagebar > div:last-child {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  body[data-page="scientific-plotting"] .plotrun-stagebar > div:last-child::-webkit-scrollbar { display: none; }
  body[data-page="scientific-plotting"] .plotwb-stage-summary { min-height: 150px; flex-basis: 150px; }
  body[data-page="scientific-plotting"] .plotwb-stage-summary dl { grid-template-columns: 1fr; }
}

@media (max-width: 440px) {
  body[data-page="data-analysis"] .analysis-category-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body[data-page="data-analysis"] .analysis-lab-metrics { grid-template-columns: 1fr 1fr; }
  body[data-page="data-analysis"] .analysis-insight-preview { grid-template-columns: 1fr; }
  body[data-page="data-analysis"] .analysis-chart-guide { grid-template-columns: 1fr; }
  body[data-page="scientific-plotting"] .plotcat-detail { min-height: 480px; padding-inline: 14px; }
}

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