:root {
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  font-size: 15px;
  font-synthesis: none;
  color: var(--ink);
  background: var(--canvas);
  --ink: #20332b;
  --muted: #64736b;
  --line: #dce3dc;
  --accent: #2e6352;
  --accent-soft: #dce9df;
  --canvas: #f5f6f2;
  --surface: #fffefa;
  --sidebar: #edf0ea;
  --danger: #ad4942;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
a,
input,
textarea,
select {
  touch-action: manipulation;
  outline-offset: 3px;
}
:focus-visible {
  outline: 2px solid var(--accent);
}
button,
a {
  -webkit-tap-highlight-color: transparent;
  transition:
    background 0.12s,
    color 0.12s;
}
button {
  cursor: pointer;
  border: 0;
}
button:disabled,
select:disabled,
input[type="number"]:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
a {
  color: var(--accent);
}
a:not([href]) {
  pointer-events: none;
  opacity: 0.4;
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.3px;
}
.quiet {
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  padding: 8px;
  border-radius: 6px;
  text-decoration: none;
  white-space: nowrap;
}
.quiet:hover {
  color: var(--ink);
  background: #e5ebe4;
}
.primary,
.secondary {
  min-height: 44px;
  border-radius: 8px;
  padding: 11px 16px;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-decoration: none;
}
.primary {
  background: var(--accent);
  color: white;
}
.primary:hover:not(:disabled) {
  background: #234e40;
}
.secondary {
  color: var(--accent);
  background: var(--accent-soft);
}
.secondary:hover {
  background: #d0e2d5;
}
.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}
.error {
  color: var(--danger);
  font-size: 14px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.skip-link {
  position: absolute;
  left: 8px;
  top: -60px;
  background: white;
  padding: 12px;
  z-index: 10;
}
.skip-link:focus {
  top: 8px;
}
#workspace {
  display: grid;
  grid-template-columns: 254px minmax(0, 1fr) 360px;
  height: 100dvh;
  min-height: min(640px, 100dvh);
}
.sidebar {
  padding: 29px 16px 12px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-height: 0;
}
.brand {
  display: flex;
  gap: 9px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.7px;
  padding: 0 7px;
}
.brand img {
  flex-shrink: 0;
}
.new-task {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--accent);
  background: #dae6dc;
  border: 1px solid #cfddd0;
  border-radius: 8px;
  min-height: 46px;
  flex-shrink: 0;
  font-weight: 600;
}
.new-task:hover {
  background: #cddfd1;
}
.new-task span[aria-hidden] {
  font-size: 23px;
  line-height: 1;
  font-weight: 400;
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.section-heading h2 #task-count,
.section-heading h2 #label-count {
  font-size: 13px;
  font-weight: 400;
  margin-left: 4px;
  color: var(--muted);
}
.history {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.history h2 {
  font-size: 14px;
  color: var(--muted);
  padding-left: 9px;
}
input[type="search"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 12px;
  font-size: 13px;
  background: #ffffff80;
  color: var(--ink);
}
#history-empty {
  padding: 8px;
}
#task-list {
  list-style: none;
  padding: 0;
  margin: 0 -4px;
  overflow: auto;
  min-height: 0;
}
#task-list li {
  margin: 0 0 5px;
}
.task-item {
  width: 100%;
  text-align: left;
  background: transparent;
  padding: 10px 12px;
  border-radius: 8px;
  display: block;
  border: 1px solid transparent;
}
.task-item:hover {
  background: #e2e9e0;
}
.task-item[aria-current="true"] {
  background: #fffefa;
  border-color: #d6dfd4;
  box-shadow: inset 2px 0 var(--accent);
}
.task-item-title {
  font-size: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.65;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.task-item-source {
  display: block;
  font-size: 12px;
  margin-top: 4px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-item-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.task-item-meta .failed {
  color: var(--danger);
}
.sidebar-footer {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
}
details p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  margin-top: 12px;
}
.account-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-left: 8px;
  color: var(--muted);
  font-size: 12px;
}
.account-line > button,
.account-line > a {
  flex-shrink: 0;
}
.image-workspace {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 27px 24px 12px;
}
.viewer-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 24px;
  min-width: 0;
}
.viewer-heading > div:first-child {
  min-width: 0;
}
.language-switch {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e9ede6;
}
.language-switch button {
  min-width: 38px;
  min-height: 32px;
  padding: 6px 8px;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
}
.language-switch button:hover {
  color: var(--ink);
}
.language-switch button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 1px 3px #20332b14;
}
.viewer-heading h1 {
  font-size: 24px;
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: -0.6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.viewer-heading p {
  color: var(--muted);
  font-size: 14px;
  margin-top: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.viewer-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  margin-bottom: 14px;
}
.view-modes {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: #e9ede6;
  border: 1px solid #e0e5dc;
  border-radius: 8px;
}
.view-modes button {
  background: transparent;
  color: var(--muted);
  padding: 7px 11px;
  border-radius: 5px;
  font-size: 14px;
  min-height: 32px;
  white-space: nowrap;
}
.view-modes button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px #20332b14;
}
.zoom-tools {
  display: flex;
  align-items: center;
  gap: 2px;
}
.zoom-tools .quiet {
  min-width: 30px;
  font-size: 17px;
  padding: 6px;
}
.zoom-tools #reset-view {
  font-size: 13px;
  padding-left: 8px;
}
.canvas-shell {
  position: relative;
  background: #000;
  flex: 1;
  min-height: 350px;
  border: 1px solid #d5ddd3;
  border-radius: 10px;
  overflow: hidden;
}
#niivue-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.pane-chrome {
  position: absolute;
  pointer-events: none;
  width: 50%;
  height: 50%;
  border: 1px solid #28322d99;
  color: #b9c7c1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px 12px 8px;
}
.pane-chrome[data-pane="axial"] {
  left: 0;
  top: 0;
  --plane-color: #e8ae79;
}
.pane-chrome[data-pane="sagittal"] {
  left: 50%;
  top: 0;
  --plane-color: #80bcb3;
}
.pane-chrome[data-pane="coronal"] {
  left: 0;
  top: 50%;
  --plane-color: #8eaedd;
}
.pane-chrome[data-pane="render"] {
  left: 50%;
  top: 50%;
  --plane-color: #bca6d0;
}
.pane-title {
  font-size: 13px;
  color: var(--plane-color);
  align-self: flex-start;
  line-height: 24px;
  background: #000b;
  padding: 0 5px;
  border-radius: 3px;
}
.pane-title small {
  font-size: 12px;
  color: #96a69e;
  padding-left: 8px;
}
.slice-control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 2px 4px;
  color: #b0beb7;
  background: #000c;
  border-radius: 4px;
  pointer-events: auto;
}
.slice-control input[type="range"] {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 24px;
  margin: 0;
  accent-color: var(--plane-color);
}
.slice-control output {
  min-width: 60px;
  text-align: right;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.render-hint {
  font-size: 12px;
  color: #96a69d;
  align-self: center;
  background: #0009;
  padding: 4px 8px;
}
.canvas-shell:not([data-view="multiplanar"]) .pane-chrome {
  display: none;
}
.canvas-shell[data-view="axial"] [data-pane="axial"],
.canvas-shell[data-view="sagittal"] [data-pane="sagittal"],
.canvas-shell[data-view="coronal"] [data-pane="coronal"],
.canvas-shell[data-view="render"] [data-pane="render"] {
  display: flex;
  inset: 0;
  width: 100%;
  height: 100%;
}
.canvas-shell[data-loaded="false"] .pane-chrome {
  display: none;
}
.viewer-empty {
  --welcome-width: min(100%, 1040px);
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-y: auto;
  color: var(--muted);
  padding: 32px 24px;
  text-align: center;
  background: var(--surface);
  container-type: inline-size;
}
/* The empty draft is an introduction; the image viewer keeps its own frame. */
#workspace:not(:has(#request[hidden], #drop-zone.has-file))
  .canvas-shell:has(#viewer-empty:not([hidden])),
#workspace:not(:has(#request[hidden], #drop-zone.has-file)) .viewer-empty {
  background: transparent;
  border-color: transparent;
}

.viewer-empty h3 {
  font-size: 25px;
  font-weight: 500;
  letter-spacing: -0.5px;
  color: var(--ink);
}
.viewer-empty .primary {
  width: auto;
  font-size: 14px;
  padding: 12px 24px;
  margin-top: 24px;
}
.capability-overview {
  width: var(--welcome-width);
  flex-shrink: 0;
  margin-top: 40px;
  text-align: left;
}
.capability-heading {
  text-align: center;
}
.capability-heading h2 {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.5px;
  color: var(--ink);
}
.capability-modalities {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 64px;
  margin-top: 24px;
}
.capability-modality {
  min-width: 0;
}
.capability-modality h3 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.2;
  color: var(--accent);
}
.capability-range,
.capability-lesions {
  font-size: 15px;
  line-height: 1.8;
  color: var(--ink);
}
.capability-range {
  margin-top: 10px;
}
.capability-lesions {
  margin-top: 8px;
}
/* Only the empty draft gets the overview, including during task load/failure. */
#workspace:has(#request[hidden]) .capability-overview,
#workspace:has(#drop-zone.has-file) .capability-overview {
  display: none;
}
.welcome-upload {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px 24px;
  width: var(--welcome-width);
  flex-shrink: 0;
  text-align: left;
}
.welcome-upload h3 {
  font-size: 28px;
  font-weight: 600;
}
.welcome-upload .primary {
  margin-top: 0;
}
@container (max-width: 560px) {
  .welcome-upload {
    justify-content: flex-start;
  }
  .welcome-upload h3 {
    font-size: 25px;
  }
  .capability-heading h2 {
    font-size: 21px;
  }
  .capability-modalities {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}
.example-gallery {
  width: var(--welcome-width);
  flex-shrink: 0;
  margin-top: 24px;
}
.example-gallery h4 {
  margin: 0 0 12px;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
}
.example-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.example-card {
  min-width: 0;
  text-align: left;
}
.example-button {
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  color: var(--ink);
  background: white;
  text-align: left;
}
.example-button:hover:not(:disabled),
.example-button[aria-busy="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.example-preview {
  width: 100%;
  height: 132px;
  display: block;
  object-fit: contain;
  background: #000;
}
@media (min-width: 1700px) {
  .viewer-empty {
    padding: 32px 48px;
  }
  .example-preview {
    height: 156px;
  }
}
.example-caption {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
}
.example-title {
  font-size: 14px;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.example-size {
  color: var(--muted);
  font-size: 12px;
}
.example-credit {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.example-credit {
  display: inline-block;
  margin-top: 6px;
}
.example-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.example-prompt {
  max-width: 100%;
  border: 1px solid #bdcdbf;
  border-radius: 7px;
  padding: 7px 10px;
  color: var(--accent);
  background: var(--surface);
  font-size: 13px;
  text-align: left;
}
.example-prompt:hover {
  background: var(--accent-soft);
}
.example-credit a {
  color: inherit;
}
@media (max-height: 760px) and (min-width: 901px) {
  .example-gallery {
    margin-top: 24px;
  }
  .example-preview {
    height: 78px;
  }
}
@media (max-width: 700px) {
  .example-cards {
    gap: 8px;
  }
  .example-caption {
    padding: 8px;
  }
  .example-preview {
    height: 78px;
  }
  .example-title {
    font-size: 13px;
  }
}
.viewer-loading {
  position: absolute;
  inset: 0;
  background: #0b1310f5;
  color: #c8d7cf;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 15px;
}
.viewer-loading[data-stage="overlay"] {
  inset: 12px 12px auto auto;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  pointer-events: none;
}
.viewer-loading[data-stage="overlay"] .spinner {
  width: 14px;
  height: 14px;
}
.spinner {
  width: 19px;
  height: 19px;
  border: 2px solid #557363;
  border-top-color: #ccdfd2;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.viewer-error {
  position: absolute;
  inset: 24px 24px auto;
  background: #fff2ed;
  border: 1px solid #e9c6bd;
  border-radius: 8px;
  padding: 16px;
  color: #9a453e;
  font-size: 14px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
#retry-viewer {
  position: absolute;
  left: 50%;
  bottom: 30%;
  transform: translateX(-50%);
  background: #e5eee6;
  color: #244d3e;
  padding: 11px 18px;
  border-radius: 8px;
}
.viewer-caption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  padding: 12px 2px 0;
}
.connection-note {
  color: var(--danger);
  font-size: 13px;
  padding-top: 8px;
}
.context-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border-left: 1px solid var(--line);
  padding: 25px 22px 14px;
}
.context-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  gap: 22px;
  flex-shrink: 0;
}
.context-tabs button {
  background: transparent;
  color: var(--muted);
  padding: 10px 0 16px;
  font-size: 15px;
  border-bottom: 2px solid transparent;
}
.context-tabs button[aria-selected="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.context-content {
  overflow: auto;
  min-height: 0;
  flex: 1;
  padding-top: 25px;
  padding-right: 9px;
  margin-right: -9px;
}
.request-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.upload-zone {
  position: relative;
  border: 1px dashed #afc3b5;
  border-radius: 8px;
  background: #f5f8f1;
  min-height: 136px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px 12px;
  text-align: center;
  cursor: pointer;
}
.upload-zone:hover,
.upload-zone.dragging {
  background: #e9f2e7;
  border-color: var(--accent);
}
.upload-zone:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.upload-zone svg {
  color: var(--accent);
}
.upload-zone strong {
  font-size: 14px;
  font-weight: 500;
  overflow-wrap: anywhere;
  max-width: 100%;
}
.upload-zone span {
  color: var(--muted);
  font-size: 12px;
}
.upload-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}
.upload-zone.has-file {
  min-height: 90px;
}
.upload-zone.has-file svg,
.upload-zone.has-file #file-help {
  display: none;
}
.file-meta {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 5px 12px;
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
}
.file-meta dt,
.file-meta dd {
  margin: 0;
}
.file-meta dd {
  color: var(--ink);
  text-align: right;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.upload-progress {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}
progress {
  width: 100%;
  height: 4px;
  border: 0;
  border-radius: 3px;
  accent-color: var(--accent);
  background: #dce6db;
}
progress::-webkit-progress-bar {
  background: #dce6db;
  border-radius: 3px;
}
progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: 3px;
}
.field-label {
  font-size: 14px;
  display: block;
}
textarea,
input[type="password"],
input[type="number"],
select {
  width: 100%;
  border: 1px solid #bdcdbf;
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  background: white;
  font-size: 15px;
  line-height: 1.75;
}
textarea {
  resize: vertical;
  min-height: 150px;
  max-height: 320px;
  font-size: 16px;
}
textarea::placeholder {
  color: #839087;
}
.record-request h2 {
  margin-bottom: 17px;
}
#request-text {
  line-height: 1.85;
  font-size: 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.request-meta {
  font-size: 13px;
  color: var(--muted);
  margin-top: 16px;
  line-height: 1.7;
}
.task-status {
  padding: 22px 0;
  margin-top: 20px;
  border-top: 1px solid var(--line);
}
.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
}
.status-line strong {
  font-size: 14px;
  font-weight: 500;
}
.status-line .quiet {
  margin-left: auto;
}
.status-dot {
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #89968b;
}
.task-status[data-status="completed"] .status-dot {
  background: #558c64;
}
.task-status[data-status="failed"] .status-dot {
  background: var(--danger);
}
#status-detail {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
  margin-top: 8px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.task-timing {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  font-variant-numeric: tabular-nums;
}
.task-status progress {
  display: block;
  margin-top: 8px;
  height: 5px;
}
.task-status progress::-webkit-progress-value {
  transition: width 0.6s linear;
}
@media (prefers-reduced-motion: reduce) {
  .task-status progress::-webkit-progress-value {
    transition: none;
  }
}
.task-status .error {
  margin-top: 12px;
}
.display-settings {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.display-settings .field-label {
  margin-top: 4px;
}
select {
  min-height: 43px;
  padding: 8px 11px;
  font-size: 14px;
}
.window-numbers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.window-numbers label {
  font-size: 14px;
}
.window-numbers label > span:not([data-i18n-en]) {
  color: var(--muted);
  font-size: 12px;
}
.window-numbers input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  margin-top: 6px;
  padding: 8px 10px;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.window-numbers input[aria-invalid="true"] {
  border-color: var(--danger);
}
#window-error {
  margin: -4px 0 0;
  font-size: 13px;
}
.crosshair-setting {
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  margin: 0;
  flex-shrink: 0;
}
.result-panel {
  border-top: 1px solid var(--line);
  margin-top: 25px;
  padding-top: 24px;
}
.overlay-settings {
  margin-top: 18px;
}
.result-output-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  font-size: 14px;
}
.result-output-choice select {
  flex: 1;
  min-width: 0;
  padding: 8px;
}
.overlay-settings label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}
input[type="range"] {
  accent-color: var(--accent);
  width: 100%;
  cursor: pointer;
}
#opacity {
  height: 24px;
  margin: 10px 0 4px;
}
#opacity-value {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.label-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 2px;
}
.label-actions .quiet {
  padding: 5px 3px;
  font-size: 12px;
}
.labels {
  max-height: 260px;
  overflow: auto;
  margin-top: 8px;
}
.label-option {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 2px;
  border-bottom: 1px solid #edf0e9;
  cursor: pointer;
}
.label-option:hover {
  background: #f2f5ee;
}
.label-swatch {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex-shrink: 0;
}
.label-name {
  font-size: 14px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.label-details {
  min-width: 0;
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}
.label-size {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
#result-summary {
  margin-top: 14px;
  font-size: 12px;
}
#result-explanation {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.result-empty {
  margin: 26px 0;
  border-top: 1px solid var(--line);
  padding-top: 20px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.downloads {
  border-top: 1px solid var(--line);
  padding-top: 24px;
  margin-top: 25px;
}
.downloads h2 {
  margin-bottom: 13px;
}
.file-download {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--accent);
  font-size: 14px;
  text-decoration: none;
  border-radius: 6px;
  padding: 7px 8px;
  margin: 0;
}
.file-download:hover {
  background: #edf3e9;
}
.file-download span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}
.file-download span:last-child {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 12px;
}
.workspace-help {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 18px;
}
.workspace-help summary {
  font-size: 12px;
}
#session-error {
  padding: 4px 8px;
  font-size: 12px;
}
#account-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-footer > small {
  color: var(--muted);
  font-size: 11px;
  padding-left: 8px;
}
@media (min-width: 1700px) {
  #workspace {
    grid-template-columns: 278px minmax(0, 1fr) 348px;
  }
  .image-workspace {
    padding: 30px 30px 14px;
  }
  .context-panel {
    padding: 28px 26px 16px;
  }
  .labels {
    max-height: 360px;
  }
}
@media (max-width: 1220px) {
  #workspace {
    grid-template-columns: 222px minmax(0, 1fr) 294px;
  }
  .sidebar {
    padding-left: 12px;
    padding-right: 12px;
  }
  .brand {
    font-size: 18px;
    gap: 7px;
  }
  .brand img {
    width: 30px;
    height: 30px;
  }
  .image-workspace {
    padding-left: 18px;
    padding-right: 18px;
  }
  .context-panel {
    padding-left: 18px;
    padding-right: 18px;
  }
  .view-modes button {
    padding: 6px 8px;
    font-size: 13px;
  }
  .pane-title small {
    display: none;
  }
  .viewer-caption span:last-child {
    display: none;
  }
}
@media (max-width: 1050px) {
  #workspace {
    grid-template-columns: 196px minmax(0, 1fr) 274px;
  }
  .brand {
    font-size: 16px;
    padding-left: 0;
  }
  .brand img {
    width: 28px;
    height: 28px;
  }
  .image-workspace {
    padding: 24px 12px 12px;
  }
  .viewer-heading h1 {
    font-size: 21px;
  }
  .viewer-toolbar {
    flex-wrap: wrap;
  }
  .pane-chrome {
    padding: 8px 6px;
  }
  .slice-control label {
    display: none;
  }
  .context-tabs {
    gap: 18px;
  }
  .context-tabs button {
    font-size: 14px;
  }
}
@media (max-width: 800px) {
  #workspace {
    height: auto;
    min-height: 100dvh;
    grid-template-columns: 1fr;
  }
  .sidebar {
    padding: 18px;
    gap: 18px;
  }
  .history {
    max-height: 260px;
  }
  .image-workspace {
    padding: 20px 16px;
  }
  .canvas-shell {
    flex: none;
    height: 560px;
  }
  .canvas-shell:has(.viewer-empty:not([hidden])) {
    height: auto;
  }
  .canvas-shell:has(.viewer-empty:not([hidden])) > #niivue-canvas {
    position: absolute;
    inset: 0;
  }
  .viewer-empty {
    position: relative;
    padding: 28px 22px;
  }
  .example-cards {
    grid-template-columns: 1fr;
  }
  .example-button {
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr);
    align-items: center;
  }
  .example-preview {
    height: 82px;
  }
  .context-panel {
    padding: 18px 24px 24px;
  }
  .context-content {
    overflow: visible;
  }
  .viewer-heading {
    padding-bottom: 14px;
  }
  .viewer-toolbar {
    flex-wrap: wrap;
  }
  .context-tabs {
    gap: 26px;
  }
  .context-tabs button {
    font-size: 15px;
  }
  .labels {
    max-height: 300px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .spinner {
    animation: none;
  }
}

.history ol,
.context-content,
.labels {
  scrollbar-width: thin;
  scrollbar-color: #c2ccc1 transparent;
}
.image-workspace:has(#viewer-empty:not([hidden])) .viewer-caption,
.image-workspace:has(#viewer-empty:not([hidden])) .viewer-toolbar {
  display: none;
}
.pane-title {
  font-size: 14px;
  font-weight: 500;
}

/* Conversation stays beside the image; measurements remain in the result panel. */
.conversation-log { display: grid; gap: 22px; margin-bottom: 24px; }
.conversation-message { min-width: 0; line-height: 1.75; font-size: 14px; }
.conversation-message strong { font-size: 12px; color: var(--muted); font-weight: 600; }
.conversation-message p { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.user-message {
  justify-self: end;
  max-width: 90%;
  border: 1px solid #d7e3da;
  border-radius: 14px 14px 4px 14px;
  padding: 10px 14px;
  background: #edf4f0;
}
.user-message > strong { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.user-message p { margin: 0; }
.agent-message { padding: 0 2px; }
.conversation-message > span { color: var(--muted); font-size: 12px; margin-right: 10px; }
.conversation-link { background: transparent; color: var(--accent); padding: 7px 0; margin-right: 12px; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.context-panel > .request-form {
  flex: 0 0 auto;
  padding: 12px 0 0;
  gap: 10px;
}
.composer-surface {
  overflow: hidden;
  border: 1px solid #bdcdbf;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 3px 14px rgb(24 35 31 / 5%);
}
.composer-surface:focus-within {
  border-color: #8da99d;
  box-shadow: 0 0 0 3px rgb(36 95 79 / 9%);
}
.request-form textarea {
  display: block;
  min-height: 96px;
  height: 96px;
  max-height: 160px;
  resize: none;
  padding: 14px 15px 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 14px;
}
.request-form textarea:focus-visible { outline: 0; }
.composer-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 9px 10px;
  border-top: 1px solid #eceeea;
}
.composer-actions .primary { width: auto; min-width: 78px; min-height: 36px; padding: 7px 16px; font-size: 13px; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.image-details { margin-bottom: 18px; }
.image-details > summary { color: var(--muted); font-size: 12px; }
.image-details .upload-zone { min-height: 60px; margin-top: 12px; padding: 10px; }
.image-details .upload-zone svg { display: none; }
.image-details .file-meta { margin-top: 12px; font-size: 12px; }
.context-panel > .workspace-help { flex: 0 0 auto; margin-top: 10px; padding-top: 0; border: 0; }
@media (min-width: 801px) and (max-height: 700px) {
  .canvas-shell { min-height: 180px; }
  .context-panel { padding-top: 12px; }
  .context-content { padding-top: 12px; }
  .request-form textarea { min-height: 72px; height: 72px; }
  .context-panel > .task-status { padding: 8px 0; }
}
.context-panel > .task-status { margin: 0 0 12px; flex: 0 0 auto; }
