/* Task-specific browser tools: analysis, plotting and document processing. */
body[data-studio] {
  --studio-accent: #4868c8;
  --studio-accent-rgb: 72, 104, 200;
  --studio-soft: #edf1ff;
  --studio-ink: var(--heading);
  background: var(--paper);
}

body[data-studio="plotting"] {
  --studio-accent: #d7683e;
  --studio-accent-rgb: 215, 104, 62;
  --studio-soft: #fff0e8;
}

body[data-studio="document"] {
  --studio-accent: #28765c;
  --studio-accent-rgb: 40, 118, 92;
  --studio-soft: #e7f5ee;
}

html[data-theme="dark"] body[data-studio] {
  --studio-soft: rgba(var(--studio-accent-rgb), .16);
}

.studio-page {
  min-height: 70vh;
  color: var(--text);
  font-size: 16px;
}

.studio-page :where(p, li, label, input, textarea, select, button, table, small, output) {
  font-size: 14px;
}

.studio-page [hidden] {
  display: none !important;
}

.studio-masthead {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line-strong);
  background: var(--surface-soft);
}

.studio-hero-copy {
  position: relative;
  z-index: 1;
}

.studio-kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .12em;
}

.studio-kicker span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 10px;
  border: 1px solid rgba(var(--studio-accent-rgb), .36);
  color: var(--studio-accent);
  background: rgba(var(--studio-accent-rgb), .08);
  letter-spacing: .08em;
}

.studio-hero-copy h1 {
  max-width: 850px;
  margin: 0;
  color: var(--heading);
  font-size: clamp(36px, 4.3vw, 48px);
  font-weight: 650;
  letter-spacing: -.055em;
  line-height: 1.12;
}

.studio-hero-copy > p:not(.studio-kicker) {
  max-width: 690px;
  margin: 25px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.82;
}

.studio-primary-link {
  display: inline-flex;
  align-items: center;
  gap: 30px;
  min-height: 46px;
  margin-top: 30px;
  padding: 0 2px 7px;
  border-bottom: 2px solid var(--studio-accent);
  color: var(--heading);
  font-size: 15px;
  font-weight: 700;
}

.studio-primary-link span {
  color: var(--studio-accent);
  transition: transform var(--motion-fast) ease;
}

.studio-primary-link:hover span,
.studio-primary-link:focus-visible span {
  transform: translateY(3px);
}

.studio-switcher {
  position: relative;
  z-index: 3;
  border-bottom: 1px solid var(--line-strong);
  background: var(--surface);
}

.studio-switcher > .container {
  display: grid;
  grid-template-columns: 150px 1fr auto;
  align-items: center;
  min-height: 62px;
}

.studio-switcher > .container > span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: .1em;
}

.studio-switcher > .container > div {
  display: flex;
  align-self: stretch;
}

.studio-switcher > .container > div a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 108px;
  justify-content: center;
  padding: 0 20px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 650;
}

.studio-switcher > .container > div a::after {
  position: absolute;
  right: 20px;
  bottom: -1px;
  left: 20px;
  height: 3px;
  background: var(--studio-accent);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform var(--motion-fast) ease;
  content: "";
}

.studio-switcher > .container > div a:hover,
.studio-switcher > .container > div a:focus-visible,
.studio-switcher > .container > div a[aria-current="page"] {
  color: var(--heading);
}

.studio-switcher > .container > div a[aria-current="page"]::after {
  transform: scaleX(1);
}

.studio-switcher > .container > a {
  color: var(--studio-accent);
  font-size: 14px;
  font-weight: 700;
}

.studio-section-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 470px);
  align-items: end;
  gap: 56px;
  margin-bottom: 28px;
}

.studio-section-heading > div > p {
  margin-bottom: 9px;
  color: var(--studio-accent);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: .13em;
}

.studio-section-heading h2 {
  margin: 0;
  color: var(--heading);
  font-size: clamp(27px, 3vw, 38px);
  font-weight: 650;
  letter-spacing: -.04em;
  line-height: 1.2;
}

.studio-section-heading > p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
}

.studio-panel {
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
}

.studio-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 17px 18px;
  border-bottom: 1px solid var(--line);
}

.studio-panel-head span,
.analysis-board-head span,
.analysis-card-heading span,
.plot-stage-head span,
.document-pane header span,
.document-transform-head span,
.identifier-card header span,
.identifier-ledger-head span,
.analysis-method-note > span,
.plot-export-note span {
  display: block;
  margin-bottom: 3px;
  color: var(--studio-accent);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: .11em;
}

.studio-panel-head h3,
.analysis-board-head h3,
.plot-stage-head h3,
.document-pane header h3,
.document-transform-head h3,
.identifier-card h3,
.analysis-method-note h3,
.plot-export-note h3 {
  margin: 0;
  color: var(--heading);
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -.025em;
}

.studio-panel-head > b {
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.studio-field {
  display: grid;
  gap: 8px;
  color: var(--heading);
  font-weight: 650;
}

.studio-field > span {
  font-size: 14px;
}

.studio-field :where(input:not([type="color"]), textarea, select) {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  padding: 11px 13px;
  color: var(--text);
  background: var(--surface-soft);
  font-weight: 500;
  outline: 0;
  transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease, background var(--motion-fast) ease;
}

.studio-field textarea {
  min-height: 180px;
  resize: vertical;
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  line-height: 1.65;
  tab-size: 2;
}

.studio-field :where(input, textarea, select):focus {
  border-color: rgba(var(--studio-accent-rgb), .75);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(var(--studio-accent-rgb), .12);
}

.studio-field :where(input, textarea)[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px rgba(182, 77, 63, .10);
}

.studio-field small {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.55;
}

.studio-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.studio-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.studio-actions .button,
.plot-stage-head .button,
.document-run {
  min-height: 46px;
  border-radius: 3px;
  font-size: 14px;
}

.studio-actions .button:first-child,
.document-run {
  border-color: var(--studio-accent);
  color: #fff;
  background: var(--studio-accent);
}

.studio-actions .button:first-child:hover,
.studio-actions .button:first-child:focus-visible,
.document-run:hover,
.document-run:focus-visible {
  filter: brightness(.92);
}

.studio-message {
  min-height: 24px;
  margin: 4px 0 0;
  color: var(--danger);
  font-size: 14px;
  line-height: 1.55;
}

.studio-message[data-status="success"] { color: var(--success); }
.studio-message[data-status="notice"] { color: var(--muted); }

.studio-copy-button,
.studio-text-action {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  padding: 7px 12px;
  color: var(--heading);
  background: var(--surface);
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  transition: color var(--motion-fast) ease, border-color var(--motion-fast) ease, background var(--motion-fast) ease;
}

.studio-copy-button:hover:not(:disabled),
.studio-copy-button:focus-visible:not(:disabled),
.studio-text-action:hover:not(:disabled),
.studio-text-action:focus-visible:not(:disabled) {
  border-color: var(--studio-accent);
  color: var(--studio-accent);
  background: var(--studio-soft);
}

.studio-copy-button:disabled,
.studio-text-action:disabled,
.studio-page button:disabled {
  cursor: not-allowed;
  opacity: .48;
}

.studio-table-wrap {
  overflow: auto;
}

.studio-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.studio-table-wrap th,
.studio-table-wrap td {
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  vertical-align: top;
}

.studio-table-wrap th {
  color: var(--muted);
  background: var(--surface-soft);
  font-weight: 700;
}

.studio-table-wrap td {
  color: var(--text);
}

.studio-table-wrap tbody tr:last-child td {
  border-bottom: 0;
}

.studio-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  color: var(--text);
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
}

.studio-check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--studio-accent);
}

/* Data analysis */
.analysis-masthead {
  padding: 58px 0 54px;
  background:
    linear-gradient(90deg, transparent 0 58%, rgba(var(--studio-accent-rgb), .055) 58% 100%),
    repeating-linear-gradient(0deg, transparent 0 47px, rgba(var(--studio-accent-rgb), .055) 47px 48px),
    var(--surface-soft);
}

.analysis-hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(310px, .65fr);
  align-items: center;
  gap: 72px;
}

.analysis-snapshot {
  border: 1px solid rgba(var(--studio-accent-rgb), .34);
  border-radius: 4px;
  padding: 0 20px 16px;
  background: var(--surface);
}

.analysis-snapshot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  border-bottom: 1px solid var(--line);
  color: var(--studio-accent);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: .11em;
}

.analysis-snapshot-head b {
  font-size: 20px;
}

.analysis-snapshot dl {
  margin: 0;
}

.analysis-snapshot dl div {
  display: grid;
  grid-template-columns: 105px 1fr;
  gap: 16px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.analysis-snapshot dt {
  color: var(--heading);
  font-size: 14px;
  font-weight: 700;
}

.analysis-snapshot dd {
  color: var(--muted);
  font-size: 14px;
}

.analysis-snapshot > p {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 17px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .08em;
}

.analysis-snapshot > p i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(47, 119, 84, .12);
}

.analysis-section,
.plotting-section,
.document-section {
  padding: 56px 0 72px;
}

.analysis-workspace {
  display: grid;
  grid-template-columns: minmax(330px, .72fr) minmax(0, 1.28fr);
  gap: 12px;
  align-items: start;
}

.analysis-input-panel {
  overflow: hidden;
}

.analysis-input-panel > .studio-field,
.analysis-input-panel > .studio-form-grid,
.analysis-input-panel > .studio-actions,
.analysis-input-panel > .studio-message {
  margin-right: 22px;
  margin-left: 22px;
}

.analysis-input-panel > .studio-field {
  margin-top: 20px;
}

.analysis-input-panel > .studio-form-grid,
.analysis-input-panel > .studio-actions {
  margin-top: 18px;
}

.analysis-input-panel > .studio-message {
  margin-top: 8px;
  margin-bottom: 15px;
}

.analysis-input-panel .studio-form-grid {
  grid-template-columns: 1fr 1fr;
}

.analysis-input-panel .studio-form-grid .studio-field:last-child {
  grid-column: 1 / -1;
}

.analysis-board {
  overflow: hidden;
  min-height: 580px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
}

.analysis-board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 17px 19px;
  border-bottom: 1px solid var(--line);
}

.analysis-empty {
  display: grid;
  min-height: 474px;
  place-content: center;
  padding: 30px;
  text-align: center;
  background:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 44px 44px;
}

.analysis-empty span {
  color: var(--heading);
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -.03em;
}

.analysis-empty p {
  max-width: 360px;
  margin: 10px auto 0;
  color: var(--muted);
  font-size: 14px;
}

.analysis-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.analysis-metrics article {
  min-height: 128px;
  padding: 18px 20px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.analysis-metrics article:nth-child(3n) {
  border-right: 0;
}

.analysis-metrics span {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.analysis-metrics strong {
  display: block;
  margin: 8px 0 4px;
  color: var(--heading);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: clamp(24px, 2.4vw, 34px);
  font-weight: 650;
  line-height: 1.15;
}

.analysis-metrics small {
  color: var(--muted-2);
  font-size: 14px;
}

.iqr-card,
.regression-card {
  margin: 16px;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 16px;
  background: var(--surface-soft);
}

.analysis-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.analysis-card-heading h4,
.plot-data-preview h4 {
  margin: 0;
  color: var(--heading);
  font-size: 17px;
}

.analysis-card-heading > b {
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--studio-accent);
  background: var(--studio-soft);
  font-size: 14px;
  font-weight: 700;
}

.iqr-readout {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 18px 0 14px;
  border: 1px solid var(--line);
  background: var(--line);
}

.iqr-readout span {
  padding: 8px 10px;
  color: var(--muted);
  background: var(--surface);
  text-align: center;
}

.iqr-readout b {
  margin-left: 6px;
  color: var(--heading);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

.iqr-plot {
  position: relative;
  height: 38px;
  margin: 4px 6px 0;
}

.iqr-plot::before {
  position: absolute;
  top: 18px;
  right: 0;
  left: 0;
  height: 1px;
  background: var(--line-strong);
  content: "";
}

.iqr-whisker,
.iqr-box,
.iqr-median {
  position: absolute;
  display: block;
}

.iqr-whisker {
  top: 17px;
  left: 7%;
  width: 86%;
  height: 3px;
  background: var(--muted);
}

.iqr-whisker::before,
.iqr-whisker::after {
  position: absolute;
  top: -7px;
  width: 2px;
  height: 17px;
  background: var(--muted);
  content: "";
}

.iqr-whisker::before { left: 0; }
.iqr-whisker::after { right: 0; }

.iqr-box {
  top: 6px;
  left: 28%;
  width: 44%;
  height: 25px;
  border: 2px solid var(--studio-accent);
  background: rgba(var(--studio-accent-rgb), .18);
}

.iqr-median {
  z-index: 2;
  top: 5px;
  left: 50%;
  width: 3px;
  height: 27px;
  background: var(--studio-accent);
}

.iqr-scale {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  color: var(--muted);
  font-size: 14px;
}

.regression-equation {
  margin: 17px 0;
  padding: 15px;
  border-left: 3px solid var(--studio-accent);
  color: var(--heading);
  background: var(--surface);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 18px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.regression-card dl {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0;
}

.regression-card dl div {
  padding: 0 12px;
  border-right: 1px solid var(--line);
}

.regression-card dl div:first-child { padding-left: 0; }
.regression-card dl div:last-child { padding-right: 0; border-right: 0; }
.regression-card dt { color: var(--muted); font-size: 14px; }
.regression-card dd { margin: 5px 0 0; color: var(--heading); font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 16px; font-weight: 700; }

.analysis-lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(280px, .58fr);
  gap: 12px;
  margin-top: 12px;
}

.outlier-panel {
  overflow: hidden;
}

.outlier-panel td:last-child {
  color: var(--danger);
  font-weight: 650;
}

.analysis-method-note {
  position: relative;
  overflow: hidden;
  border: 1px solid #274137;
  border-radius: 4px;
  padding: 21px;
  color: #eaf3ee;
  background: #12251d;
}

.analysis-method-note::after {
  position: absolute;
  right: -70px;
  bottom: -85px;
  width: 210px;
  height: 210px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%;
  content: "";
}

.analysis-method-note > span { color: var(--lime); }
.analysis-method-note h3 { color: #fff; }
.analysis-method-note ul { position: relative; z-index: 1; margin: 18px 0 0; padding-left: 20px; color: #b9c8bf; }
.analysis-method-note li { margin: 10px 0; line-height: 1.65; }

/* Scientific plotting */
.plotting-masthead {
  min-height: 390px;
  padding: 62px 0 56px;
  color: #fff;
  background: #14221c;
}

.plot-hero-grid {
  position: absolute;
  inset: 0;
  opacity: .34;
  background-image: linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(90deg, transparent, #000 40%, #000);
}

.plotting-hero-layout {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  align-items: center;
  gap: 85px;
}

.plotting-masthead .studio-kicker { color: #9eb2a6; }
.plotting-masthead .studio-kicker span { color: #ffc19f; border-color: rgba(255,193,159,.45); background: rgba(255,193,159,.08); }
.plotting-masthead .studio-hero-copy h1 { color: #fff; }
.plotting-masthead .studio-hero-copy > p:not(.studio-kicker) { color: #b6c4bb; }

.plot-hero-register {
  margin: 0;
  border-top: 1px solid rgba(255,255,255,.28);
  border-bottom: 1px solid rgba(255,255,255,.28);
}

.plot-hero-register > div {
  display: grid;
  grid-template-columns: 54px 1fr;
  align-items: center;
  min-height: 74px;
  border-bottom: 1px solid rgba(255,255,255,.16);
}

.plot-hero-register > div:last-child { border-bottom: 0; }
.plot-hero-register dt { color: #ffb087; font-size: 14px; font-weight: 750; }
.plot-hero-register dd { margin: 0; }
.plot-hero-register strong,
.plot-hero-register span { display: block; }
.plot-hero-register strong { color: #fff; font-size: 16px; }
.plot-hero-register span { margin-top: 2px; color: #9eb2a6; font-size: 14px; }

.plotting-switcher {
  --studio-accent: #d7683e;
}

.plotting-section {
  background: var(--paper-2);
}

.plot-workspace {
  display: grid;
  grid-template-columns: 344px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.plot-control-panel {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
}

.plot-control-group {
  padding: 17px;
  border-bottom: 1px solid var(--line);
}

.plot-control-head {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 16px;
}

.plot-control-head > span {
  display: grid;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  place-items: center;
  color: var(--studio-accent);
  background: var(--studio-soft);
  font-size: 14px;
  font-weight: 750;
}

.plot-control-head h3 {
  margin: 0;
  color: var(--heading);
  font-size: 17px;
}

.plot-type-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.plot-type-options label {
  cursor: pointer;
}

.plot-type-options input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.plot-type-options label span {
  display: grid;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  place-content: center;
  color: var(--muted);
  background: var(--surface-soft);
  text-align: center;
  transition: border-color var(--motion-fast) ease, color var(--motion-fast) ease, background var(--motion-fast) ease;
}

.plot-type-options input:checked + span {
  border-color: var(--studio-accent);
  color: var(--studio-accent);
  background: var(--studio-soft);
  font-weight: 700;
}

.plot-type-options input:focus-visible + span {
  outline: 3px solid rgba(var(--studio-accent-rgb), .24);
  outline-offset: 2px;
}

.plot-control-panel .studio-field textarea {
  min-height: 185px;
}

.plot-field-stack {
  display: grid;
  gap: 14px;
}

.plot-label-grid {
  grid-template-columns: 1fr 1fr;
}

.plot-style-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
}

.color-field {
  grid-template-columns: 1fr 50px auto;
  align-items: center;
}

.color-field > span {
  grid-column: 1 / -1;
}

.color-field input[type="color"] {
  width: 50px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  padding: 3px;
  background: var(--surface);
  cursor: pointer;
}

.color-field output {
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

.plot-actions {
  padding: 17px 17px 0;
}

.plot-actions .button:first-child {
  flex: 1 1 100%;
  justify-content: center;
}

.plot-actions .button:not(:first-child) {
  flex: 1 1 calc(50% - 5px);
  justify-content: center;
}

.plot-control-panel > .studio-message {
  margin: 8px 17px 14px;
}

.plot-stage {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
}

.plot-stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 73px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
}

.plot-stage-head > div:last-child {
  display: flex;
  align-items: center;
  gap: 13px;
}

.plot-stage-head output {
  color: var(--muted);
  font-size: 14px;
}

.plot-canvas-shell {
  padding: 16px;
  background:
    linear-gradient(45deg, var(--paper-2) 25%, transparent 25%),
    linear-gradient(-45deg, var(--paper-2) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--paper-2) 75%),
    linear-gradient(-45deg, transparent 75%, var(--paper-2) 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

#plotCanvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  background: var(--surface);
}

.plot-description {
  margin: 0;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.plot-data-preview {
  padding: 18px 20px 20px;
}

.plot-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 11px;
}

.plot-preview-head span {
  color: var(--muted);
  font-size: 14px;
}

.plot-data-preview .studio-table-wrap {
  max-height: 260px;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.plot-export-note {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 40px;
  margin-top: 12px;
  padding: 21px 24px;
  border-top: 1px solid var(--line-strong);
  border-right: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  border-left: 4px solid var(--studio-accent);
  color: var(--text);
  background: var(--surface);
}

.plot-export-note p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

/* Document processing */
.document-masthead {
  padding: 58px 0;
  background:
    radial-gradient(circle at 80% 25%, rgba(var(--studio-accent-rgb), .12), transparent 29%),
    var(--surface-soft);
}

.document-hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(400px, .9fr);
  align-items: center;
  gap: 72px;
}

.document-flow {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: none;
}

.document-flow li {
  position: relative;
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 15px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.document-flow li::after {
  position: absolute;
  top: 100%;
  left: 24px;
  z-index: 1;
  color: var(--muted-2);
  content: "↓";
  transform: translateY(-7px);
}

.document-flow li:last-child::after { display: none; }

.document-flow li > span {
  display: grid;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(var(--studio-accent-rgb), .32);
  border-radius: 3px;
  place-items: center;
  color: var(--studio-accent);
  background: var(--studio-soft);
  font-size: 14px;
  font-weight: 750;
}

.document-flow strong,
.document-flow small {
  display: block;
}

.document-flow strong {
  color: var(--heading);
  font-size: 16px;
}

.document-flow small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 14px;
}

.document-section {
  background: var(--paper-2);
}

.document-desk {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
}

.document-pane,
.document-transform-panel {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
}

.document-pane {
  display: flex;
  min-height: 548px;
  flex-direction: column;
}

.document-pane > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  padding: 15px 19px;
  border-bottom: 1px solid var(--line);
}

.document-pane header output {
  color: var(--muted);
  font-size: 14px;
}

.document-textarea {
  flex: 1;
}

.document-textarea textarea {
  height: 100%;
  min-height: 413px;
  border: 0;
  border-radius: 0;
  padding: 18px;
  background:
    linear-gradient(90deg, transparent 35px, rgba(var(--studio-accent-rgb), .12) 35px 36px, transparent 36px),
    repeating-linear-gradient(0deg, transparent 0 25px, var(--grid-line) 25px 26px),
    var(--surface);
  line-height: 26px;
}

.document-textarea textarea:focus {
  box-shadow: inset 0 0 0 3px rgba(var(--studio-accent-rgb), .15);
}

.document-output-pane textarea {
  color: var(--heading);
  background-color: var(--surface-soft);
}

.document-pane-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 15px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}

.document-transform-panel {
  display: flex;
  padding: 18px;
  flex-direction: column;
  background: #15261f;
}

.document-transform-head {
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255,255,255,.13);
}

.document-transform-head span { color: var(--lime); }
.document-transform-head h3 { color: #fff; }

.document-transform-panel > .studio-field {
  margin-top: 17px;
  color: #fff;
}

.document-transform-panel .studio-field select {
  border-color: rgba(255,255,255,.18);
  color: #eaf3ee;
  background: #1d342a;
}

.document-transform-panel fieldset {
  display: grid;
  gap: 3px;
  margin: 18px 0 0;
  border: 0;
  border-top: 1px solid rgba(255,255,255,.13);
  padding: 15px 0 0;
}

.document-transform-panel legend {
  padding: 0;
  color: #9fb2a7;
  font-size: 14px;
  font-weight: 700;
}

.document-transform-panel .studio-check {
  color: #d5e1da;
}

.document-run {
  width: 100%;
  margin-top: auto;
  justify-content: center;
}

.document-transform-panel .studio-message {
  margin-bottom: 0;
  color: #ffb6aa;
}

.document-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
}

.document-summary article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 76px;
  padding: 16px 20px;
  border-right: 1px solid var(--line);
}

.document-summary article:last-child { border-right: 0; }
.document-summary span { color: var(--muted); font-size: 14px; }
.document-summary strong { color: var(--heading); font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 23px; }

.identifier-ledger {
  margin-top: 42px;
}

.identifier-ledger-head {
  display: grid;
  grid-template-columns: 1fr minmax(300px, 470px);
  align-items: end;
  gap: 44px;
  margin-bottom: 20px;
}

.identifier-ledger-head h2 {
  margin: 0;
  color: var(--heading);
  font-size: clamp(27px, 3vw, 36px);
  letter-spacing: -.04em;
}

.identifier-ledger-head > p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.identifier-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.identifier-card {
  display: flex;
  min-height: 340px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
}

.identifier-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 17px 18px;
  border-bottom: 1px solid var(--line);
}

.identifier-card h3 { font-size: 16px; }

.identifier-card header output {
  display: grid;
  min-width: 38px;
  height: 38px;
  border-radius: 50%;
  place-items: center;
  color: var(--studio-accent);
  background: var(--studio-soft);
  font-weight: 750;
}

.identifier-card ul {
  flex: 1;
  max-height: 300px;
  overflow: auto;
  margin: 0;
  padding: 8px 17px;
  list-style: none;
}

.identifier-card li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.identifier-card li:last-child { border-bottom: 0; }
.identifier-card li.identifier-empty { display: block; color: var(--muted); }
.identifier-card code { overflow-wrap: anywhere; color: var(--heading); font-size: 14px; }
.identifier-card li button { min-height: 34px; border: 1px solid var(--line); border-radius: 3px; padding: 5px 9px; color: var(--muted); background: var(--surface-soft); cursor: pointer; }
.identifier-card li button:hover,
.identifier-card li button:focus-visible { color: var(--studio-accent); border-color: var(--studio-accent); }
.identifier-card > .studio-copy-button { margin: 0 17px 17px; }

.document-privacy-note {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 12px;
  padding: 18px 20px;
  border: 1px solid rgba(var(--studio-accent-rgb), .25);
  border-radius: 4px;
  background: var(--studio-soft);
}

.document-privacy-note > span {
  flex: 0 0 auto;
  color: var(--studio-accent);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .12em;
}

.document-privacy-note p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.document-privacy-note strong { color: var(--heading); }

@media (max-width: 1120px) {
  .analysis-hero-layout,
  .document-hero-layout { gap: 42px; }
  .plotting-hero-layout { grid-template-columns: minmax(0, 1fr) 360px; gap: 46px; }
  .analysis-workspace { grid-template-columns: minmax(300px, .78fr) minmax(0, 1.22fr); }
  .analysis-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analysis-metrics article:nth-child(3n) { border-right: 1px solid var(--line); }
  .analysis-metrics article:nth-child(2n) { border-right: 0; }
  .document-desk { grid-template-columns: minmax(0, 1fr) 230px minmax(0, 1fr); }
}

@media (max-width: 920px) {
  .studio-switcher > .container { grid-template-columns: auto 1fr; }
  .studio-switcher > .container > span { display: none; }
  .studio-switcher > .container > a { justify-self: end; }
  .analysis-hero-layout,
  .document-hero-layout,
  .plotting-hero-layout { grid-template-columns: 1fr; }
  .analysis-snapshot { max-width: 620px; }
  .plot-hero-register { max-width: 520px; }
  .document-flow { max-width: 620px; }
  .analysis-workspace,
  .plot-workspace { grid-template-columns: 1fr; }
  .analysis-input-panel .studio-form-grid { grid-template-columns: repeat(3, 1fr); }
  .analysis-input-panel .studio-form-grid .studio-field:last-child { grid-column: auto; }
  .analysis-board { min-height: 0; }
  .analysis-empty { min-height: 360px; }
  .plot-control-panel { display: grid; grid-template-columns: 1fr 1fr; }
  .plot-control-group:nth-child(1),
  .plot-control-group:nth-child(3) { border-right: 1px solid var(--line); }
  .plot-control-group:nth-child(3) { grid-row: 1 / 3; grid-column: 2; }
  .plot-actions,
  .plot-control-panel > .studio-message { grid-column: 1 / -1; }
  .document-desk { grid-template-columns: 1fr 1fr; }
  .document-transform-panel { grid-column: 1 / -1; grid-row: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .document-transform-head { grid-column: 1 / -1; }
  .document-transform-panel > .studio-field,
  .document-transform-panel fieldset { margin-top: 0; }
  .document-run { align-self: end; margin-top: 0; }
  .document-transform-panel .studio-message { grid-column: 1 / -1; }
  .document-summary { grid-template-columns: repeat(2, 1fr); }
  .document-summary article:nth-child(2) { border-right: 0; }
  .document-summary article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .identifier-grid { grid-template-columns: 1fr; }
  .identifier-card { min-height: 260px; }
}

@media (max-width: 700px) {
  .studio-masthead { padding: 54px 0; }
  .studio-hero-copy h1 { font-size: clamp(34px, 10vw, 44px); }
  .studio-hero-copy > p:not(.studio-kicker) { font-size: 15px; }
  .studio-switcher { overflow-x: auto; scrollbar-width: none; }
  .studio-switcher::-webkit-scrollbar { display: none; }
  .studio-switcher > .container { width: max-content; min-width: 100%; grid-template-columns: 1fr auto; padding-inline: 18px; }
  .studio-switcher > .container > div a { min-width: 94px; padding-inline: 13px; }
  .studio-switcher > .container > a { padding-left: 22px; white-space: nowrap; }
  .studio-section-heading,
  .identifier-ledger-head { grid-template-columns: 1fr; gap: 15px; }
  .analysis-section,
  .plotting-section,
  .document-section { padding: 54px 0 70px; }
  .analysis-input-panel .studio-form-grid,
  .studio-form-grid { grid-template-columns: 1fr; }
  .analysis-input-panel .studio-form-grid .studio-field:last-child { grid-column: auto; }
  .analysis-metrics { grid-template-columns: 1fr 1fr; }
  .analysis-metrics article { min-height: 115px; }
  .regression-card dl { grid-template-columns: 1fr 1fr; gap: 15px 0; }
  .regression-card dl div:nth-child(2) { border-right: 0; }
  .regression-card dl div:nth-child(3) { padding-left: 0; }
  .analysis-lower-grid { grid-template-columns: 1fr; }
  .plot-control-panel { display: block; }
  .plot-control-group:nth-child(1),
  .plot-control-group:nth-child(3) { border-right: 0; }
  .plot-export-note { grid-template-columns: 1fr; gap: 12px; }
  .plot-stage-head { align-items: flex-start; }
  .plot-stage-head > div:last-child { align-items: flex-end; flex-direction: column; }
  .document-hero-layout { gap: 35px; }
  .document-desk { grid-template-columns: 1fr; }
  .document-transform-panel { grid-column: auto; grid-row: auto; display: flex; }
  .document-transform-panel > .studio-field,
  .document-transform-panel fieldset { margin-top: 17px; }
  .document-run { margin-top: 22px; }
  .document-pane { min-height: 500px; }
  .document-textarea textarea { min-height: 370px; }
  .document-summary { grid-template-columns: 1fr 1fr; }
  .document-summary article { padding: 14px; }
}

@media (max-width: 480px) {
  .studio-page .container { width: min(calc(100% - 30px), var(--container)); }
  .analysis-snapshot dl div { grid-template-columns: 1fr; gap: 3px; }
  .studio-actions .button { flex: 1 1 100%; justify-content: center; }
  .analysis-board-head,
  .plot-stage-head { align-items: flex-start; flex-direction: column; }
  .analysis-metrics { grid-template-columns: 1fr; }
  .analysis-metrics article,
  .analysis-metrics article:nth-child(3n) { border-right: 0; }
  .regression-card dl { grid-template-columns: 1fr; }
  .regression-card dl div { padding: 0 0 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .regression-card dl div:last-child { border-bottom: 0; }
  .plot-type-options { grid-template-columns: 1fr; }
  .plot-type-options label span { min-height: 50px; }
  .plot-label-grid { grid-template-columns: 1fr; }
  .document-summary { grid-template-columns: 1fr; }
  .document-summary article { border-right: 0; border-bottom: 1px solid var(--line); }
  .document-summary article:last-child { border-bottom: 0; }
  .document-privacy-note { align-items: flex-start; flex-direction: column; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .studio-page *,
  .studio-page *::before,
  .studio-page *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}
