:root {
  color-scheme: light;
  --page: #f4f5f6;
  --panel: #ffffff;
  --panel-muted: #f7f8f8;
  --canvas: #d7dadd;
  --line: #d2d6d9;
  --line-strong: #adb4b9;
  --ink: #202427;
  --muted: #697278;
  --quiet: #8d969c;
  --teal: #167f87;
  --teal-dark: #0d6269;
  --teal-soft: #d8f0f1;
  --coral: #d9544b;
  --coral-soft: #fae0de;
  --yellow: #f0c95c;
  --shadow: 0 8px 28px rgb(28 36 40 / 12%);
  --header-height: 58px;
  --status-height: 34px;
  --labels-width: 252px;
  font-family:
    Inter, "Segoe UI", "Helvetica Neue", Arial, "Noto Sans JP", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--page);
  color: var(--ink);
}

button,
select,
input {
  font: inherit;
}

button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
canvas:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

button:disabled,
select:disabled {
  cursor: default;
  opacity: 0.42;
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.local-file-dialog {
  width: min(520px, calc(100vw - 32px));
  max-width: none;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 20px 60px rgb(28 36 40 / 28%);
}

.information-dialog {
  width: min(660px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
}

.local-file-dialog::backdrop {
  background: rgb(32 36 39 / 48%);
}

.local-file-dialog-content {
  padding: 24px;
}

.local-file-dialog-heading {
  display: flex;
  align-items: center;
  gap: 13px;
}

.local-file-dialog-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border: 1px solid #a6ced1;
  border-radius: 6px;
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.local-file-dialog-icon svg {
  width: 22px;
  height: 22px;
}

.destructive-dialog-icon {
  border-color: #df9b96;
  background: var(--coral-soft);
  color: #92372f;
}

.destructive-kicker {
  color: #92372f;
}

.cloud-dialog-icon {
  border-color: #d8bd72;
  background: #fff5d8;
  color: #76520b;
}

.cloud-dialog-kicker {
  color: #76520b;
}

.dialog-kicker {
  display: block;
  margin-bottom: 3px;
  color: var(--teal-dark);
  font-size: 10px;
  font-weight: 750;
}

.local-file-dialog h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.25;
}

.local-file-dialog-copy {
  margin-top: 19px;
  color: #3c4449;
  font-size: 14px;
  line-height: 1.62;
}

.local-file-dialog-copy p {
  margin: 0;
}

.local-file-dialog-copy p + p {
  margin-top: 10px;
}

.local-file-assurance {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 17px;
  padding: 12px 14px;
  border-left: 3px solid var(--teal);
  background: var(--panel-muted);
  font-size: 13px;
}

.local-file-assurance span {
  color: var(--muted);
  line-height: 1.45;
}

.destructive-assurance {
  border-left-color: var(--coral);
  background: #fff5f4;
}

.dialog-exception {
  border-left-color: #6d7b82;
}

.cloud-assurance {
  border-left-color: #c4992e;
  background: #fffaf0;
}

.dialog-language-block {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: #3c4449;
  font-size: 12px;
  line-height: 1.65;
}

.dialog-language-block h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.dialog-language-block p {
  margin: 0;
}

.dialog-language-block p + p {
  margin-top: 8px;
}

.information-dialog code,
.workflow-steps code {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.94em;
}

.dialog-checkbox {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.dialog-checkbox input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--teal);
}

.local-file-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}

.local-file-dialog-actions .command-button {
  min-width: 112px;
}

.mask-import-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
}

.mask-import-mode {
  min-width: 0;
  padding: 0;
  margin: 18px 0 0;
  border: 0;
}

.mask-import-mode legend {
  padding: 0;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.mask-import-segments {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
}

.mask-import-segments label {
  position: relative;
  cursor: pointer;
}

.mask-import-segments input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.mask-import-segments span {
  display: grid;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.mask-import-segments label:first-child span {
  border-radius: 5px 0 0 5px;
}

.mask-import-segments label:last-child span {
  margin-left: -1px;
  border-radius: 0 5px 5px 0;
}

.mask-import-segments input:checked + span {
  position: relative;
  z-index: 1;
  border-color: var(--teal-dark);
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.mask-import-segments input:focus-visible + span {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.mask-import-mode > p {
  min-height: 18px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.mask-import-options .command-button {
  width: 100%;
  height: 42px;
}

.compact-dialog-actions {
  margin-top: 14px;
}

.workflow-dialog {
  width: min(680px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.workflow-dialog::backdrop {
  background: rgb(30 35 38 / 42%);
}

.workflow-dialog-shell {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.workflow-summary {
  margin: 14px 18px 0;
  padding: 9px 11px;
  border-left: 3px solid var(--teal);
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 650;
}

.workflow-steps {
  display: grid;
  gap: 0;
  margin: 12px 18px 18px;
  padding: 0;
  list-style: none;
}

.workflow-steps li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.workflow-steps li:last-child {
  border-bottom: 0;
}

.workflow-step-number {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--panel-muted);
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 750;
}

.workflow-steps div {
  min-width: 0;
}

.workflow-steps strong,
.workflow-steps div span {
  display: block;
}

.workflow-steps strong {
  font-size: 12px;
}

.workflow-steps div span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.workflow-steps .command-button {
  min-width: 128px;
}

.label-manager-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 18px;
}

.label-manager-identity,
.label-manager-action-row,
.label-manager-danger {
  grid-column: 1 / -1;
}

.label-manager-identity {
  display: flex;
  align-items: center;
  gap: 9px;
}

.label-manager-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.label-manager-danger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.project-check-dialog {
  width: min(760px, calc(100vw - 28px));
}

.project-check-results {
  display: grid;
  gap: 1px;
  max-height: min(540px, 62vh);
  margin: 12px 18px 18px;
  overflow: auto;
  background: var(--line);
}

.project-check-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 8px 10px;
  background: var(--panel);
  font-size: 11px;
}

.project-check-item > span {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--panel-muted);
  font-weight: 750;
}

.project-check-item p {
  margin: 2px 0 0;
}

.project-check-item.error > span {
  background: var(--coral-soft);
  color: #92372f;
}

.project-check-item.warning > span,
.workflow-summary.warning {
  background: #fff2cf;
  color: #76520b;
}

.workflow-summary.error {
  border-left-color: var(--coral);
  background: var(--coral-soft);
  color: #92372f;
}

.workflow-summary.success {
  border-left-color: #2b8a57;
  background: #e4f4ea;
  color: #206640;
}

.tools-dialog {
  width: min(760px, calc(100vw - 32px));
  max-width: none;
  max-height: min(760px, calc(100dvh - 32px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 20px 60px rgb(28 36 40 / 28%);
}

.tools-dialog::backdrop {
  background: rgb(32 36 39 / 48%);
}

.tools-dialog-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  max-height: min(760px, calc(100dvh - 34px));
}

#tools-dialog[open] {
  position: fixed;
  z-index: 1000;
  inset: 158px 16px auto auto;
  max-height: min(760px, calc(100dvh - 174px));
  margin: 0;
}

#tools-dialog[open] .tools-dialog-shell {
  max-height: min(760px, calc(100dvh - 176px));
}

.segonweb-jobs-dialog {
  width: min(860px, calc(100vw - 32px));
}

.segonweb-jobs-dialog[open] {
  position: fixed;
  z-index: 1000;
  inset: 158px 16px auto auto;
  max-height: min(760px, calc(100dvh - 174px));
  margin: 0;
}

.segonweb-jobs-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: min(760px, calc(100dvh - 34px));
}

.segonweb-jobs-body {
  min-height: 0;
  overflow: auto;
}

.segonweb-job-table-wrap {
  min-height: 150px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-muted);
}

.segonweb-job-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}

.segonweb-job-table th,
.segonweb-job-table td {
  padding: 9px 12px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.segonweb-job-table th {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}

.segonweb-job-table th:last-child,
.segonweb-job-table td:last-child {
  width: 48px;
  padding-inline: 6px;
  text-align: center;
}

.segonweb-job-table tbody tr {
  background: var(--panel);
  cursor: pointer;
}

.segonweb-job-table tbody tr:hover,
.segonweb-job-table tbody tr.selected {
  background: var(--teal-soft);
}

.segonweb-job-table .icon-button {
  width: 30px;
  height: 30px;
}

.segonweb-job-empty {
  margin: 0;
  padding: 38px 16px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.segonweb-job-editor {
  padding: 18px 22px 20px;
}

.segonweb-field-grid {
  display: grid;
  grid-template-columns:
    120px minmax(180px, 1fr)
    repeat(2, minmax(170px, 0.75fr));
  gap: 12px;
}

.segonweb-field-grid .compact-field {
  display: grid;
  gap: 5px;
  align-items: stretch;
  white-space: normal;
}

.segonweb-field-grid input,
.segonweb-field-grid select {
  width: 100%;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--panel);
  color: var(--ink);
}

.segonweb-frame-capture {
  display: grid;
  grid-template-columns: minmax(62px, 1fr) auto;
  gap: 5px;
}

.segonweb-frame-capture button {
  min-width: 72px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--teal-dark);
  border-radius: 4px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-size: 10px;
  font-weight: 750;
  cursor: pointer;
}

.segonweb-frame-capture button:hover {
  background: #cce9eb;
}

.segonweb-current-frame {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.segonweb-current-frame span {
  min-width: 118px;
  text-align: center;
}

.segonweb-current-frame .icon-button {
  width: 30px;
  height: 30px;
}

.segonweb-current-frame strong {
  color: var(--ink);
}

.segonweb-prompts-section {
  margin-top: 16px;
  border: 1px solid var(--line);
}

.segonweb-prompts-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-muted);
}

.segonweb-prompts-heading > div {
  display: grid;
  gap: 2px;
}

.segonweb-prompts-heading > div > span {
  color: var(--teal-dark);
  font-size: 9px;
  font-weight: 800;
}

.segonweb-prompts-heading strong {
  font-size: 12px;
}

.segonweb-prompt-table-wrap {
  max-height: 210px;
  overflow: auto;
}

.segonweb-prompt-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 11px;
}

.segonweb-prompt-table th,
.segonweb-prompt-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.segonweb-prompt-table th {
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.segonweb-prompt-table th:nth-child(1) {
  width: 70px;
}

.segonweb-prompt-table th:nth-child(2) {
  width: 64px;
}

.segonweb-prompt-table th:last-child {
  width: 116px;
}

.segonweb-prompt-table td:nth-child(3) {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-action-button {
  padding: 3px 5px;
  border: 0;
  background: transparent;
  color: var(--teal-dark);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.text-action-button:hover {
  text-decoration: underline;
}

.text-action-button.danger-text {
  color: var(--coral);
}

.segonweb-job-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: var(--panel-muted);
}

@media (max-width: 760px) {
  .segonweb-jobs-dialog[open] {
    inset: 10px;
    width: auto;
    max-height: calc(100dvh - 20px);
  }

  .segonweb-jobs-shell {
    max-height: calc(100dvh - 22px);
  }

  .segonweb-field-grid {
    grid-template-columns: 1fr 1fr;
  }

  .segonweb-name-field {
    grid-column: 1 / -1;
  }

  .segonweb-prompts-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .segonweb-job-actions {
    flex-wrap: wrap;
  }

  .segonweb-field-grid .compact-field > span:first-child {
    display: inline;
  }
}

.stl-preview-dialog {
  width: min(1180px, calc(100vw - 32px));
  height: min(780px, calc(100dvh - 32px));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 1px solid #343940;
  border-radius: 6px;
  background: #17191d;
  box-shadow: 0 18px 60px rgb(0 0 0 / 35%);
}

.stl-preview-dialog::backdrop {
  background: rgb(20 24 27 / 58%);
}

.stl-preview-shell {
  display: grid;
  grid-template-rows: 60px minmax(0, 1fr);
  width: 100%;
  height: 100%;
}

.stl-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  border-bottom: 1px solid #353a40;
  background: #22252a;
  color: #f5f6f7;
}

.stl-preview-header h2 {
  margin: 1px 0 0;
  font-size: 17px;
}

.stl-preview-header .dialog-kicker {
  color: #8fc3c7;
}

.stl-preview-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stl-preview-header .command-button,
.stl-preview-header .icon-button {
  border-color: #4a5057;
  background: #2d3137;
  color: #f5f6f7;
}

.stl-preview-workspace {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 238px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #17191d;
}

.stl-preview-canvas {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.stl-preview-canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.stl-preview-objects {
  min-width: 0;
  padding: 14px 12px;
  overflow: auto;
  border-left: 1px solid #353a40;
  background: #202328;
  color: #e8eaec;
}

.stl-preview-objects > strong {
  display: block;
  margin-bottom: 10px;
  color: #a7afb5;
  font-size: 10px;
  text-transform: uppercase;
}

.stl-preview-object-row {
  display: grid;
  grid-template-columns: 18px 18px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  padding: 8px 0;
  border-bottom: 1px solid #343940;
  font-size: 11px;
}

.stl-preview-object-row input[type="checkbox"] {
  accent-color: #47a6ad;
}

.stl-preview-object-row input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: #47a6ad;
}

.stl-preview-progress {
  position: absolute;
  inset: 0 238px 0 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #17191d;
  color: #e8eaec;
  font-size: 13px;
  text-align: center;
}

.stl-preview-progress[hidden] {
  display: none;
}

.tools-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
}

.tools-dialog-header h2 {
  margin: 0;
  font-size: 19px;
}

.tools-dialog-header-actions,
.tools-frame-navigation {
  display: flex;
  align-items: center;
}

.tools-dialog-header-actions {
  gap: 12px;
}

.tools-frame-navigation {
  gap: 7px;
}

.tools-frame-navigation span {
  min-width: 86px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.tools-frame-navigation strong {
  color: var(--ink);
}

.tools-frame-navigation .icon-button {
  width: 30px;
  height: 30px;
}

.tools-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-bottom: 1px solid var(--line);
  background: var(--panel-muted);
}

.tools-tabs button {
  min-width: 0;
  height: 40px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

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

.tools-tabs button[aria-selected="true"] {
  box-shadow: inset 0 -3px var(--teal);
  background: var(--panel);
  color: var(--teal-dark);
}

.tool-panel {
  min-height: 300px;
  padding: 22px;
  overflow: auto;
}

.tool-panel[hidden] {
  display: none;
}

.demo-intro {
  display: grid;
  pointer-events: auto;
  gap: 4px;
  max-width: 560px;
  margin: 16px auto 0;
  color: var(--muted);
  font-size: 12px;
}

.demo-intro h2 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 12px;
}

.demo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 8px;
  margin: 6px 0;
}

.empty-state .demo-grid .demo-button {
  width: 100%;
  min-width: 0;
  min-height: 96px;
  height: auto;
  padding: 12px;
  justify-content: flex-start;
  text-align: left;
  white-space: normal;
}

.demo-grid .demo-button svg {
  flex: 0 0 20px;
}

.demo-grid small {
  display: block;
  margin-top: 4px;
}

@media (max-width: 600px) {
  .demo-grid { grid-template-columns: minmax(0, 1fr); }
}

#open-menu .open-menu-panel .command-button span {
  display: inline;
  white-space: normal;
}

#open-menu .open-menu-panel .command-button {
  width: 100%;
  height: auto;
  min-height: 34px;
  text-align: left;
}

.demo-intro b {
  color: var(--ink);
  font-weight: 750;
}

.demo-intro small,
.demo-calibration-attribution {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.demo-intro a,
.demo-calibration-attribution a {
  color: var(--teal-dark);
}

.demo-calibration-guide {
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
  padding: 16px;
  border: 1px solid #b9d7d0;
  border-left: 4px solid var(--teal);
  border-radius: 6px;
  background: #f2f8f6;
}

.demo-calibration-guide[hidden] {
  display: none;
}

.demo-calibration-heading {
  display: grid;
  gap: 2px;
}

.demo-calibration-heading span {
  color: var(--teal-dark);
  font-size: 9px;
  font-weight: 800;
}

.demo-calibration-heading strong {
  color: var(--ink);
  font-size: 14px;
}

.demo-calibration-guide p {
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.55;
}

.demo-calibration-values {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
}

.demo-calibration-values span {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #c9ddd8;
  border-radius: 5px;
  background: var(--panel);
  color: var(--muted);
  font-size: 10px;
}

.demo-calibration-values strong {
  color: var(--ink);
  font-size: 12px;
  white-space: normal;
}

.demo-calibration-values i {
  font-style: normal;
}

.demo-calibration-guide .demo-calibration-note {
  color: var(--muted);
  font-size: 10px;
}

.demo-calibration-guide .demo-next-step {
  padding-top: 9px;
  border-top: 1px solid #c9ddd8;
  color: var(--teal-dark);
  font-weight: 800;
}

.tool-grid {
  display: grid;
  gap: 18px 22px;
}

.display-tool-grid,
.calibration-grid,
.extraction-grid,
.stl-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cleanup-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.range-field,
.number-field,
.tool-select-field,
.color-field {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.range-field > span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.range-field output {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.range-field input[type="range"] {
  width: 100%;
  accent-color: var(--teal);
}

.number-field input,
.tool-select-field select,
.color-field input {
  width: 100%;
  height: 36px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--panel);
  color: var(--ink);
}

.color-field input {
  padding: 4px;
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.extract-block + .extract-block,
.cleanup-section + .cleanup-section,
.volume-export-group + .volume-export-group {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.extract-block h3,
.cleanup-section h3,
.volume-export-group h3 {
  margin: 0 0 16px;
  font-size: 13px;
}

.volume-export-group > .command-button {
  margin-top: 18px;
}

.volume-export-note {
  max-width: 680px;
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.cleanup-section > .command-button {
  margin-top: 18px;
}

.volume-statistics-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.volume-statistics-heading h3 {
  margin-bottom: 0;
}

.volume-statistics-heading span {
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}

.table-scroll {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
}

.data-table {
  width: 100%;
  min-width: 580px;
  border-collapse: collapse;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

.data-table th:first-child,
.data-table td:first-child {
  text-align: left;
}

.data-table th {
  position: sticky;
  top: 0;
  background: var(--panel-muted);
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

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

.vol-info-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.vol-info-heading {
  display: grid;
  gap: 6px;
}

.vol-info-heading > span {
  color: var(--teal-dark);
  font-size: 10px;
  font-weight: 800;
}

.vol-info-heading output {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.app-shell {
  display: grid;
  grid-template-rows: var(--header-height) auto auto minmax(0, 1fr) var(--status-height);
  width: 100%;
  height: 100dvh;
  min-width: 320px;
}

.app-header {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(180px, auto) minmax(190px, 1fr);
  align-items: center;
  gap: 18px;
  min-width: 0;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  z-index: 5;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-lockup > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.brand-lockup strong {
  font-size: 17px;
  letter-spacing: 0;
}

.brand-lockup > div > span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.brand-lockup b {
  padding: 2px 5px;
  border: 1px solid #e6c044;
  border-radius: 3px;
  background: #fff7d7;
  color: #705a09;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.brand-icon {
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  border-radius: 6px;
  object-fit: contain;
}

.project-summary {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  line-height: 1.25;
}

#project-name {
  max-width: 320px;
  overflow: hidden;
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.save-state {
  color: var(--muted);
  font-size: 10px;
}

.save-state.saving {
  color: #946f06;
}

.save-state.saved {
  color: var(--teal-dark);
}

.header-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.icon-link {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
}

.icon-link:hover {
  color: var(--ink);
}

.command-bar,
.secondary-bar {
  display: flex;
  align-items: center;
  min-width: 0;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.command-bar {
  min-height: 54px;
  gap: 12px;
  padding: 7px 12px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.secondary-bar {
  min-height: 43px;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 12px;
  background: var(--panel-muted);
}

.command-group,
.history-section,
.export-section {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}

.command-primary {
  gap: 6px;
}

.command-divider {
  width: 1px;
  height: 30px;
  flex: 0 0 auto;
  background: var(--line);
}

.command-button,
.icon-button,
.mode-control button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.command-button:hover:not(:disabled),
.icon-button:hover:not(:disabled),
.mode-control button:hover:not(:disabled) {
  border-color: #7f898f;
  background: #f0f2f3;
}

.command-button:active:not(:disabled),
.icon-button:active:not(:disabled),
.mode-control button:active:not(:disabled) {
  background: #e5e8ea;
}

.command-button {
  gap: 7px;
  min-width: 92px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  text-decoration: none;
}

.command-button.accent {
  border-color: var(--teal-dark);
  background: var(--teal);
  color: #fff;
}

.command-button.accent:hover:not(:disabled) {
  border-color: #094e53;
  background: var(--teal-dark);
}

.command-button.add {
  border-color: #16808b;
  background: #d9f1f3;
  color: #07565d;
}

.command-button.erase {
  border-color: #dc726a;
  background: var(--coral-soft);
  color: #92372f;
}

.command-button.danger {
  border-color: #9f3e37;
  background: var(--coral);
  color: #fff;
}

.command-button.danger:hover:not(:disabled) {
  border-color: #7f2e29;
  background: #b9423a;
}

.icon-button {
  width: 34px;
  min-width: 34px;
  padding: 0;
}

.image-navigation {
  display: flex;
  align-items: center;
  margin-left: 2px;
}

.image-navigation .icon-button:first-child {
  border-radius: 5px 0 0 5px;
}

.image-navigation .icon-button:last-child {
  border-radius: 0 5px 5px 0;
}

.image-counter {
  display: grid;
  place-items: center;
  width: 68px;
  height: 34px;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  background: var(--panel-muted);
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.compact-field {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
  white-space: nowrap;
}

.compact-field select {
  height: 34px;
  min-width: 90px;
  padding: 0 26px 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--panel);
  color: var(--ink);
  font-size: 12px;
  text-transform: none;
}

.color-select {
  position: relative;
  display: inline-flex;
}

.color-select select {
  min-width: 96px;
  padding-left: 31px;
}

.pen-color-swatch {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 10px;
  width: 13px;
  height: 13px;
  border: 1px solid #6d7479;
  border-radius: 2px;
  transform: translateY(-50%);
  pointer-events: none;
}

.transfer-field select {
  min-width: 72px;
}

.auto-field select {
  min-width: 88px;
}

.mode-control {
  display: flex;
}

.mode-control button {
  min-width: 54px;
  padding: 0 10px;
  border-radius: 0;
  font-size: 11px;
}

.mode-control button:first-child {
  border-radius: 5px 0 0 5px;
}

.mode-control button:last-child {
  border-radius: 0 5px 5px 0;
}

.mode-control button + button {
  margin-left: -1px;
}

.mode-control button.selected {
  z-index: 1;
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-weight: 700;
}

.bar-label {
  color: var(--quiet);
  font-size: 9px;
  font-weight: 750;
}

.bar-separator {
  width: 1px;
  height: 22px;
  margin: 0 3px;
  background: var(--line);
}

.secondary-bar .icon-button,
.secondary-bar .command-button {
  height: 31px;
}

.secondary-bar .icon-button {
  width: 31px;
  min-width: 31px;
}

.workflow-actions {
  position: relative;
}

.toolbar-menu {
  position: relative;
}

.toolbar-menu > summary {
  list-style: none;
}

.toolbar-menu > summary::-webkit-details-marker {
  display: none;
}

.toolbar-menu-panel {
  position: absolute;
  z-index: 15;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  width: 210px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.toolbar-menu-panel button {
  min-height: 31px;
  padding: 0 9px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.toolbar-menu-panel button:hover:not(:disabled) {
  background: var(--panel-muted);
}

.toolbar-menu-panel button:disabled {
  color: var(--quiet);
  cursor: default;
}

.menu-heading {
  padding: 8px 9px 3px;
  color: var(--quiet);
  font-size: 9px;
  font-weight: 750;
  text-transform: uppercase;
}

.workspace {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--labels-width);
  min-height: 0;
  overflow: hidden;
}

.canvas-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--canvas);
}

#editor-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

#editor-canvas.panning {
  cursor: grabbing;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--muted);
  text-align: center;
  pointer-events: none;
}

.empty-state[hidden] {
  display: none;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 14px;
  border: 1px solid #aeb5b9;
  border-radius: 6px;
  background: rgb(255 255 255 / 36%);
}

.empty-icon svg {
  width: 27px;
  height: 27px;
}

.empty-state h1 {
  margin: 0;
  color: #4d555a;
  font-size: 18px;
  font-weight: 680;
}

.empty-state p {
  margin: 5px 0 17px;
  font-size: 12px;
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  pointer-events: auto;
}

.zoom-readout {
  position: absolute;
  right: 13px;
  bottom: 13px;
  min-width: 52px;
  padding: 5px 8px;
  border: 1px solid rgb(255 255 255 / 45%);
  border-radius: 4px;
  background: rgb(30 35 38 / 76%);
  color: #fff;
  font-size: 10px;
  text-align: center;
  pointer-events: none;
}

.editing-state {
  position: absolute;
  left: 13px;
  bottom: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 150px);
  padding: 5px 8px;
  border: 1px solid rgb(255 255 255 / 48%);
  border-radius: 4px;
  background: rgb(30 35 38 / 78%);
  color: #fff;
  font-size: 10px;
  pointer-events: none;
}

.editing-state[hidden] {
  display: none;
}

.editing-state strong,
.editing-state span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editing-state span {
  color: #d7e2e3;
  font-weight: 700;
}

.editing-state.automatic {
  border-color: #efb13f;
  background: rgb(84 56 7 / 88%);
}

.loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: rgb(226 229 231 / 88%);
  color: var(--ink);
  z-index: 4;
}

.loading-overlay[hidden] {
  display: none;
}

.loading-overlay strong {
  margin-top: 7px;
  font-size: 13px;
}

.loading-overlay span {
  color: var(--muted);
  font-size: 11px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #b6c0c4;
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.labels-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-left: 1px solid var(--line);
  background: var(--panel);
  z-index: 3;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  flex: 0 0 auto;
  padding: 0 13px;
  border-bottom: 1px solid var(--line);
}

.panel-heading > div {
  display: flex;
  flex-direction: column;
}

.panel-heading span {
  color: var(--quiet);
  font-size: 9px;
  font-weight: 750;
}

.panel-heading strong {
  margin-top: 2px;
  font-size: 12px;
}

.label-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  flex: 1 1 auto;
  min-height: 0;
  padding: 9px;
  overflow-y: auto;
  background: var(--line);
}

.label-item {
  position: relative;
  display: grid;
  grid-template-columns: 18px 20px minmax(0, 1fr) 26px;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 5px 7px;
  border: 0;
  background: var(--panel);
  cursor: pointer;
}

.label-item:hover {
  background: #f2f4f4;
}

.label-menu-button {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.label-menu-button:hover:not(:disabled) {
  background: #dfe7e8;
  color: var(--ink);
}

.label-menu-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.label-menu-button svg {
  width: 16px;
  height: 16px;
}

.label-item.target {
  box-shadow: inset 3px 0 0 var(--teal);
  background: #edf7f7;
}

.label-item input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--teal);
}

.label-swatch {
  width: 17px;
  height: 17px;
  border: 1px solid rgb(0 0 0 / 14%);
}

.label-copy {
  min-width: 0;
}

.label-copy strong,
.label-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.label-copy strong {
  font-size: 11px;
  font-weight: 650;
}

.label-copy span {
  color: var(--quiet);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.label-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 38px;
  flex: 0 0 auto;
  padding: 0 11px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.label-summary strong {
  color: var(--ink);
  font-weight: 650;
}

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 0 11px;
  border-top: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 10px;
}

.status-message {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.status-message svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  color: var(--teal);
}

#status-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.local-processing-status {
  display: inline-flex;
  height: 30px;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  padding: 2px 9px 2px 5px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--teal-dark);
  cursor: pointer;
}

.local-processing-status:hover {
  background: var(--teal-soft);
}

.local-processing-icon {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background: #dff1e6;
  color: #206640;
}

.local-processing-icon svg {
  width: 13px;
  height: 13px;
  stroke-width: 2.2;
}

.local-processing-copy {
  display: grid;
  gap: 0;
  text-align: left;
  line-height: 1.05;
}

.local-processing-copy strong {
  font-size: 10px;
  font-weight: 750;
}

.local-processing-copy > span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.image-meta {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 50px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 28px));
  padding: 10px 14px;
  border: 1px solid #0c555b;
  border-radius: 5px;
  background: #173e42;
  box-shadow: var(--shadow);
  color: #fff;
  font-size: 12px;
  transform: translateX(-50%);
}

.toast[hidden] {
  display: none;
}

.mobile-only {
  display: none;
}

@media (max-width: 1120px) {
  :root {
    --labels-width: 218px;
  }

  .app-header {
    grid-template-columns: 1fr auto 1fr;
  }

  .command-bar {
    gap: 8px;
  }

  .command-divider {
    display: none;
  }

  .command-button {
    min-width: 78px;
    padding: 0 9px;
  }

  .compact-field > span:first-child {
    display: none;
  }

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

@media (max-width: 760px) {
  :root {
    --header-height: 52px;
    --status-height: 38px;
  }

  .app-shell {
    grid-template-rows: var(--header-height) auto auto minmax(0, 1fr) var(--status-height);
  }

  .app-header {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 0 10px;
  }

  .brand-lockup > div > span,
  .project-summary,
  .icon-link {
    display: none;
  }

  .mobile-only {
    display: inline-flex;
  }

  .command-bar {
    min-height: 49px;
    padding: 6px 8px;
  }

  .command-button,
  .icon-button,
  .mode-control button,
  .compact-field select,
  .image-counter {
    height: 36px;
  }

  .command-button span {
    display: none;
  }

  .command-button {
    min-width: 38px;
    width: 38px;
    padding: 0;
  }

  .empty-state .command-button {
    width: auto;
    min-width: 96px;
    padding: 0 12px;
  }

  .empty-state .command-button span {
    display: inline;
  }

  .mode-control button {
    min-width: 50px;
    padding: 0 8px;
  }

  .transfer-field {
    display: none;
  }

  .secondary-bar {
    min-height: 42px;
    padding: 5px 8px;
    overflow-x: auto;
  }

  .secondary-bar .command-button {
    width: 34px;
    min-width: 34px;
  }

  .workspace {
    display: block;
  }

  .canvas-panel {
    width: 100%;
    height: 100%;
  }

  .labels-panel {
    position: absolute;
    inset: 0 0 0 auto;
    width: min(292px, 88vw);
    border-left: 1px solid var(--line-strong);
    box-shadow: -10px 0 28px rgb(28 36 40 / 16%);
    transform: translateX(105%);
    transition: transform 180ms ease;
  }

  .labels-panel.open {
    transform: translateX(0);
  }

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

  .image-meta {
    display: none;
  }

  .local-processing-copy > span {
    display: none;
  }

  .status-bar {
    justify-content: flex-start;
    gap: 8px;
  }

  .tools-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
  }

  #tools-dialog[open] {
    inset: 10px;
    width: auto;
    max-height: calc(100dvh - 20px);
  }

  .tools-dialog-shell {
    max-height: calc(100dvh - 22px);
  }

  .tools-dialog-header {
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px;
  }

  .tools-dialog-header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .tools-tabs {
    grid-template-columns: repeat(2, 1fr);
  }

  .tools-tabs button {
    border-bottom: 1px solid var(--line);
  }

  .tools-tabs button:nth-child(even) {
    border-right: 0;
  }

  .tools-tabs button:last-child {
    grid-column: 1 / -1;
    border-bottom: 0;
  }

  .tool-panel {
    min-height: 0;
    padding: 18px 16px;
  }
}

@media (max-width: 470px) {
  .information-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
  }

  .local-file-dialog-content {
    padding: 20px;
  }

  .local-processing-status {
    padding-right: 5px;
  }

  .local-file-dialog-actions .command-button {
    width: auto;
    min-width: 104px;
    padding: 0 12px;
  }

  .local-file-dialog-actions .command-button span {
    display: inline;
  }

  .mask-import-options {
    grid-template-columns: 1fr;
  }

  .display-tool-grid,
  .calibration-grid,
  .extraction-grid,
  .cleanup-grid,
  .interpolation-grid,
  .stl-grid {
    grid-template-columns: 1fr;
  }

  .demo-calibration-values {
    grid-template-columns: 1fr;
  }

  .draw-settings .compact-field {
    display: none;
  }

  .draw-settings .pen-color-field {
    display: flex;
  }

  .command-bar {
    scrollbar-width: none;
  }

  .command-bar::-webkit-scrollbar {
    display: none;
  }

  .bar-label,
  .bar-separator {
    display: none;
  }

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

@media (max-width: 760px) {
  .workflow-steps li {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .workflow-steps .command-button {
    grid-column: 2;
    justify-self: start;
  }

  .stl-preview-dialog {
    width: calc(100vw - 20px);
    height: calc(100dvh - 20px);
  }

  .stl-preview-workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .stl-preview-objects {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 14px;
    max-height: 150px;
    border-top: 1px solid #353a40;
    border-left: 0;
  }

  .stl-preview-objects > strong {
    grid-column: 1 / -1;
  }

  .stl-preview-progress {
    inset: 0 0 150px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Desktop workspace: Objects | Image | Tools */
:root {
  --objects-width: 204px;
  --tools-width: 324px;
  --slice-bar-height: 48px;
}

.app-shell {
  grid-template-rows: var(--header-height) 46px minmax(0, 1fr);
}

.app-header {
  grid-template-columns: minmax(180px, 0.75fr) minmax(260px, 1fr) minmax(360px, 1.25fr);
}

.project-summary {
  line-height: 1.15;
}

.project-details {
  max-width: 460px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions {
  min-width: 0;
}

.header-privacy-indicator,
.header-health-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel-muted);
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
  font-weight: 650;
}

.header-privacy-indicator .local-processing-copy {
  display: block;
}

.header-privacy-indicator .local-processing-copy strong {
  display: block;
  color: var(--teal-dark);
  line-height: 1.1;
}

.header-privacy-indicator .local-processing-copy span {
  display: none;
}

.header-health-indicator svg,
.header-privacy-indicator svg {
  width: 14px;
  height: 14px;
}

.header-health-indicator.success {
  border-color: #8ab9a0;
  color: #28744b;
  background: #eef8f1;
}

.header-health-indicator.warning {
  border-color: #d6b75c;
  color: #755a0c;
  background: #fff9e8;
}

.header-health-indicator.error {
  border-color: #d6948e;
  color: #913b34;
  background: #fff2f1;
}

.command-bar {
  min-height: 46px;
  padding: 5px 12px;
  overflow: visible;
}

.top-command-group {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
}

.top-command-group #export-menu {
  margin-left: auto;
}

.top-command-group .command-button {
  min-width: auto;
}

.top-command-group #fit-view {
  padding: 0 11px;
}

.mobile-tools-toggle {
  display: none;
}

.open-menu-panel {
  left: 0;
  right: auto;
  min-width: 214px;
}

.open-menu-panel hr {
  width: calc(100% - 16px);
  margin: 5px 8px;
  border: 0;
  border-top: 1px solid var(--line);
}

.workspace-redesigned {
  display: grid;
  grid-template-columns: var(--objects-width) minmax(360px, 1fr) var(--tools-width);
  min-width: 0;
  min-height: 0;
}

.instant3d-workflow {
  border-top: 1px solid #ccd6d5;
  margin-top: 18px;
  padding-top: 16px;
}

.instant3d-workflow .field-stack,
.instant3d-workflow .field-stack > span {
  display: grid;
  gap: 6px;
}

.instant3d-workflow .field-stack { margin-top: 10px; }
.instant3d-workflow input[type="search"],
.instant3d-workflow select { width: 100%; min-width: 0; }
.instant3d-workflow #instant3d-available { min-height: 146px; }

.instant3d-add-row,
.instant3d-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
  margin-top: 10px;
}

.instant3d-add-row label { display: grid; gap: 5px; }
.instant3d-selected { display: grid; gap: 5px; min-height: 42px; }
.instant3d-selected-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 6px;
  border: 1px solid #d5dddd;
  padding: 6px 7px;
  background: #f8fafa;
}
.instant3d-selected-row button { width: 28px; height: 28px; padding: 0; }
.instant3d-privacy,
.instant3d-availability { color: #566; font-size: 11px; line-height: 1.45; }

.instant3d-availability { margin: 0; }

.custom-model-workflow .command-button {
  width: auto;
  min-width: 92px;
  max-width: 100%;
  padding: 0 12px;
}

.custom-model-summary {
  display: grid;
  gap: 5px;
  margin: 10px 0 0;
}

.custom-model-summary > div {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 8px;
}

.custom-model-summary dt { color: #667; }
.custom-model-summary dd { margin: 0; overflow-wrap: anywhere; }

#custom-model-conflict-merge[hidden] { display: none; }

.labels-panel {
  grid-column: 1;
  border-right: 1px solid var(--line);
  border-left: 0;
}

.label-list {
  grid-template-columns: 1fr;
  gap: 2px;
  padding: 7px;
  background: var(--panel-muted);
}

.label-item {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 4px;
}

.label-item.target {
  border-color: #91c6ca;
  box-shadow: inset 3px 0 0 var(--teal);
}

.image-workspace {
  display: grid;
  grid-column: 2;
  grid-template-rows: minmax(0, 1fr) var(--slice-bar-height);
  min-width: 0;
  min-height: 0;
}

.canvas-panel {
  min-width: 0;
  min-height: 0;
  border: 0;
}

.slice-status-bar {
  display: grid;
  grid-template-columns: minmax(330px, 1.15fr) minmax(150px, 1fr) auto;
  grid-template-rows: 30px 12px;
  align-items: center;
  gap: 1px 12px;
  min-width: 0;
  padding: 2px 10px;
  border-top: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 10px;
}

.viewer-operation-guide {
  grid-column: 1 / -1;
  grid-row: 2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: pre;
  line-height: 12px;
}

.slice-navigation {
  display: grid;
  grid-template-columns: 30px 54px auto minmax(100px, 1fr) 30px;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.slice-navigation .icon-button {
  width: 30px;
  min-width: 30px;
  height: 30px;
}

.slice-number-input {
  width: 54px;
  height: 30px;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--panel);
  color: var(--ink);
  font-size: 11px;
  text-align: center;
}

.slice-slider {
  width: 100%;
  min-width: 70px;
  accent-color: var(--teal);
}

.slice-status-bar .image-counter {
  height: auto;
  min-width: 45px;
  padding: 0;
  border: 0;
  background: transparent;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.slice-status-bar .status-message {
  overflow: hidden;
}

.slice-status-bar #status-text,
.slice-status-bar .image-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tools-dock {
  display: grid;
  grid-column: 3;
  grid-template-rows: 52px auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  border-left: 1px solid var(--line);
  background: var(--panel);
}

.tools-dock-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 13px;
  border-bottom: 1px solid var(--line);
}

.tools-dock-header > div {
  display: flex;
  flex-direction: column;
}

.tools-dock-header span {
  color: var(--quiet);
  font-size: 9px;
  font-weight: 750;
}

.tools-dock-header strong {
  margin-top: 2px;
  font-size: 12px;
}

.tools-category-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 6px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-muted);
}

.tools-category-tabs button {
  min-width: 0;
  min-height: 30px;
  padding: 4px 6px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
  font-weight: 650;
}

.tools-category-tabs button:hover {
  background: #e8ecee;
  color: var(--ink);
}

.tools-category-tabs button[aria-selected="true"] {
  background: var(--panel);
  color: var(--teal-dark);
  box-shadow: inset 0 0 0 1px #9cc8cb;
}

.tools-dock-body {
  min-height: 0;
  overflow: hidden;
}

.tools-dock .tool-panel {
  height: 100%;
  min-height: 0;
  padding: 14px;
  overflow-x: hidden;
  overflow-y: auto;
}

.tools-dock .tool-panel[hidden] {
  display: none;
}

.tool-section-heading {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 15px 0 8px;
}

.tool-section-heading:first-child {
  margin-top: 0;
}

.tool-section-heading strong {
  font-size: 11px;
}

.tool-section-heading span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.current-target-card,
.spatial-information,
.project-health-detail {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px;
  border-left: 3px solid var(--teal);
  background: var(--panel-muted);
}

.current-target-card > span,
.spatial-information > span {
  color: var(--quiet);
  font-size: 9px;
  font-weight: 750;
}

.current-target-card strong,
.spatial-information strong {
  font-size: 13px;
}

.current-target-card small,
.spatial-information small {
  color: var(--muted);
  font-size: 10px;
}

.draw-refine-panel .draw-settings,
.draw-refine-panel .edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.draw-refine-panel .draw-settings {
  align-items: end;
}

.draw-refine-panel .mode-control {
  width: 100%;
}

.draw-refine-panel .mode-control button {
  flex: 1 1 0;
}

.draw-refine-panel .legacy-target-field {
  display: none;
}

.draw-refine-panel .pen-color-field {
  width: 100%;
}

.draw-refine-panel .pen-color-field > span:first-child,
.draw-refine-panel .transfer-field > span:first-child,
.draw-refine-panel .auto-field > span:first-child {
  display: block;
}

.draw-refine-panel .color-select,
.draw-refine-panel .pen-color-field select {
  width: 100%;
}

.draw-refine-panel .edit-actions > button {
  flex: 1 1 calc(33% - 7px);
}

.draw-refine-panel .transfer-field,
.draw-refine-panel .auto-field {
  flex: 1 1 calc(50% - 4px);
}

.pending-drawing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 15px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.pending-drawing-row > span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pending-drawing-row strong {
  font-size: 11px;
}

.pending-drawing-row small {
  color: var(--muted);
  font-size: 9px;
}

.ai-workflow-panel .workflow-summary {
  margin-bottom: 10px;
}

.ai-workflow-panel .workflow-steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.ai-workflow-panel .workflow-steps li {
  grid-template-columns: 28px minmax(0, 1fr);
  padding: 10px;
}

.ai-workflow-panel .workflow-steps .command-button {
  grid-column: 1 / -1;
  width: 100%;
}

.tool-disclosure {
  margin: 12px 0;
  border: 1px solid var(--line);
}

.tool-disclosure > summary {
  padding: 10px;
  background: var(--panel-muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.tool-disclosure > .tool-grid,
.tool-disclosure > .tool-actions {
  margin: 12px;
}

.project-check-panel .command-button {
  width: 100%;
  margin-top: 12px;
}

.project-destructive-actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.project-destructive-actions span {
  color: var(--muted);
  font-size: 10px;
}

.legacy-control,
.legacy-controls,
.file-inputs {
  display: none !important;
}

.empty-state {
  padding: 18px;
}

.empty-state h1 {
  font-size: 19px;
}

.empty-privacy {
  margin-top: 12px;
  color: var(--teal-dark);
  font-size: 10px;
}

.demo-guide-progress {
  margin-left: auto;
  padding: 2px 5px;
  border: 1px solid #9fc9cc;
  border-radius: 3px;
  background: var(--panel);
  color: var(--teal-dark);
  font-size: 9px;
  white-space: nowrap;
}

@media (max-width: 1180px) {
  :root {
    --objects-width: 176px;
    --tools-width: 292px;
  }

  .app-header {
    grid-template-columns: minmax(170px, 0.8fr) minmax(220px, 1fr) auto;
  }

  .header-health-indicator span,
  .header-privacy-indicator .local-processing-copy {
    display: none;
  }

  .header-health-indicator,
  .header-privacy-indicator {
    width: 32px;
    justify-content: center;
    padding: 0;
  }

  .slice-status-bar {
    grid-template-columns: minmax(300px, 1fr) minmax(0, 0.7fr);
  }

  .slice-status-bar .image-meta {
    display: none;
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-rows: var(--header-height) 46px minmax(0, 1fr);
  }

  .app-header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .project-summary {
    display: none;
  }

  .mobile-only,
  .mobile-tools-toggle {
    display: inline-flex;
  }

  .workspace-redesigned {
    display: block;
  }

  .image-workspace {
    width: 100%;
    height: 100%;
  }

  .labels-panel,
  .tools-dock {
    position: absolute;
    inset: 0 auto 0 0;
    width: min(286px, 88vw);
    border-right: 1px solid var(--line-strong);
    box-shadow: 10px 0 28px rgb(28 36 40 / 18%);
    transform: translateX(-105%);
    transition: transform 180ms ease;
    z-index: 12;
  }

  .labels-panel.open {
    transform: translateX(0);
  }

  .tools-dock {
    inset: 0 0 0 auto;
    display: grid;
    width: min(340px, 94vw);
    border-right: 0;
    border-left: 1px solid var(--line-strong);
    box-shadow: -10px 0 28px rgb(28 36 40 / 18%);
    transform: translateX(105%);
  }

  .tools-dock.open {
    transform: translateX(0);
  }

  .slice-status-bar {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
  }

  .slice-status-bar .status-message,
  .slice-status-bar .image-meta {
    display: none;
  }
}

@media (max-width: 600px) {
  .app-header {
    padding: 0 8px;
  }

  .header-actions {
    gap: 4px;
  }

  .header-health-indicator,
  .header-privacy-indicator,
  .header-actions .icon-link {
    display: none;
  }


  .command-bar {
    padding: 5px 7px;
  }

  .top-command-group {
    gap: 5px;
  }

  .top-command-group .command-button {
    width: 34px;
    min-width: 34px;
    padding: 0;
  }

  .top-command-group .command-button span {
    display: none;
  }

  .top-command-group #export-menu {
    margin-left: auto;
  }

  .slice-navigation {
    grid-template-columns: 30px 48px auto minmax(60px, 1fr) 30px;
    gap: 5px;
  }

  .slice-status-bar {
    padding: 2px 6px;
  }

  .empty-state {
    justify-content: flex-start;
    padding-top: 8vh;
    overflow-y: auto;
  }

  .demo-intro {
    max-width: 94%;
  }
}

.header-actions .related-tool-link {
  display: inline-flex;
  white-space: nowrap;
}
