/* A compact engineering workspace: essential inputs, linked geometry, then Fusion outputs. */
:root {
  color-scheme: light;
  background: #f2f0e9;
  color: #17212b;
}
body {
  margin: 0;
  background:
    linear-gradient(#17212b05 1px, transparent 1px),
    linear-gradient(90deg, #17212b05 1px, transparent 1px), #f2f0e9;
  background-size: 24px 24px;
}
.tm {
  --ink: #17212b;
  --muted: #53616c;
  --line: #c9c7bf;
  --surface: #fbfaf6;
  --blue: #1769aa;
  --error: #a7342b;
  box-sizing: border-box;
  width: min(1500px, 100%);
  margin: auto;
  padding: 20px;
  font:
    14px / 1.5 Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}
.tm *,
.tm *::before,
.tm *::after {
  box-sizing: border-box;
}
.tm a {
  color: var(--blue);
  text-underline-offset: 3px;
}
.tm a:visited {
  color: #6c4982;
}
.tm-header > a {
  font-size: 0.8rem;
}
.tm h1 {
  margin: 8px 0;
  font-size: clamp(1.45rem, 2.5vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
}
.tm h2 {
  font-size: 0.95rem;
  margin: 0 0 8px;
  line-height: 1.35;
}
.tm h3 {
  font-size: 0.85rem;
  margin: 14px 0 8px;
}
.tm p {
  margin: 6px 0 10px;
}
.tm-intro,
.tm-note {
  color: var(--muted);
}
.tm .tm-note {
  font-size: 0.8rem;
  line-height: 1.5;
}
.tm #cam-basis {
  width: 100%;
}
.tm-source,
.tm-target small {
  display: block;
  color: var(--muted);
  font-size: 0.73rem;
}
.tm button,
.tm input,
.tm select,
.tm textarea {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 38px;
  padding: 7px 9px;
  max-width: 100%;
}
.tm input {
  font-variant-numeric: tabular-nums;
}
.tm button {
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
}
.tm button:hover {
  background: #fff;
  border-color: #8d9499;
}
.tm button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.tm .tm-primary,
.tm-tabs button[aria-selected="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.tm .tm-primary:hover {
  background: #2a3742;
}
.tm :focus-visible {
  outline: 3px solid #1769aa66;
  outline-offset: 2px;
}
.tm [aria-invalid="true"] {
  border-color: var(--error);
  background: #fff3f1;
}
.tm label {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  margin: 7px 0 4px;
}
.tm label small {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--muted);
}
.tm input:not([type="checkbox"]),
.tm-region > select {
  width: 100%;
}
.tm input[readonly] {
  border-color: transparent;
  background: transparent;
}
.tm-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0 12px;
}
.tm-tabs button {
  min-height: 42px;
}
.tm-workspace {
  display: grid;
  grid-template-columns: minmax(240px, 290px) minmax(0, 1fr) minmax(220px, 260px);
  grid-template-areas: "toolbar toolbar toolbar" "thread drawing cutter" "result result result" "optional optional optional";
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 18px 16px;
  gap: 0 20px;
}
.tm-toolbar {
  grid-area: toolbar;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
  gap: 8px;
}
.tm-toolbar > p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.tm-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.tm-actions label {
  margin: 0;
}
.tm-actions label select {
  margin-left: 6px;
}
.tm-region {
  min-width: 0;
  padding: 12px 0;
}
.tm-thread {
  grid-area: thread;
}
.tm-cutter {
  grid-area: cutter;
}
.tm-drawing {
  grid-area: drawing;
  border-inline: 1px solid var(--line);
  padding-inline: 16px;
}
.tm-heading-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tm-heading-row label {
  margin: 0;
}
.tm-heading-row label select {
  display: inline-block;
  margin-left: 5px;
}
.tm-view-options {
  display: flex;
  justify-content: end;
  margin-top: 8px;
}
.tm-view-options label {
  margin: 0;
}
.tm svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 290px;
}
.tm svg text {
  font:
    16px ui-sans-serif,
    system-ui,
    sans-serif;
  fill: var(--ink);
}
.tm svg [role="button"] {
  cursor: pointer;
}
.tm svg .tm-hot {
  stroke: var(--blue);
  stroke-width: 5;
}
.tm #cutter-guide {
  max-height: 115px;
  margin: 8px 0;
}
.tm-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 12px;
}
.tm-fields > div {
  min-width: 0;
}
.tm .tm-link-button {
  color: var(--blue);
  background: transparent;
  border-color: transparent;
  text-align: left;
  padding-inline: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.tm-target {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  margin-top: 8px;
  font-size: 0.8rem;
}
.tm-target strong {
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}
.tm-target .tm-link-button {
  justify-self: start;
}
.tm-target #target-editor {
  grid-column: 1 / -1;
}
.tm .tm-help {
  border: 0;
  margin: 0;
}
.tm .tm-help summary {
  color: var(--blue);
  min-height: 32px;
}
.tm details {
  border-top: 1px solid var(--line);
  margin-top: 10px;
  padding-top: 3px;
  font-size: 0.85rem;
}
.tm summary {
  cursor: pointer;
  min-height: 38px;
  padding: 8px 0;
  font-size: 0.8rem;
  font-weight: 600;
}
.tm .tm-error {
  font-size: 0.8rem;
  color: var(--error);
  margin: 5px 0;
}
.tm .tm-error:empty,
.tm-source:empty {
  display: none;
}
.tm-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 10px 0;
}
.tm-legend button {
  display: grid;
  text-align: left;
  gap: 3px;
  font-weight: 400;
  min-width: 0;
}
.tm-legend strong {
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.tm-legend small {
  color: var(--muted);
  font-size: 0.7rem;
}
.tm .tm-selected {
  border-color: var(--blue);
  background: #edf5fc;
}
.tm-result {
  grid-area: result;
  border-top: 1px solid var(--line);
  padding: 16px 0 0;
  min-width: 0;
}
.tm-status {
  font-size: 0.75rem;
  color: var(--muted);
}
#boss-model-summary {
  grid-template-columns: minmax(0, 1fr) auto;
}
#boss-model-source,
#change-boss-model {
  grid-column: 1 / -1;
}
#change-boss-model {
  justify-self: start;
  text-align: left;
  white-space: normal;
}
.tm-output-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 40px;
  margin: 8px 0 12px;
}
.tm-output-row > div > span {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
}
.tm-output-row output {
  display: block;
  font-size: 1.7rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.tm-output-row output.tm-placeholder {
  font-size: 1rem;
  font-weight: 400;
  color: var(--muted);
}
.tm-needed {
  font-size: 0.8rem;
  color: var(--muted);
}
.tm-needed button {
  margin: 0 6px 4px 0;
}
.tm-schedule {
  display: grid;
  grid-template-columns: minmax(0, 240px) minmax(0, 1fr);
  gap: 8px 18px;
  margin: 8px 0;
  font-size: 0.85rem;
}
.tm-schedule dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.tm-schedule dd small {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
}
.tm-optional {
  grid-area: optional;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-top: 6px;
  align-items: start;
}
.tm-notice {
  border: 1px solid var(--line);
  background: #f0eee7;
  border-radius: 8px;
  padding: 12px;
  margin-top: 14px;
}
.tm-library-workspace {
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
  grid-template-areas: "toolbar toolbar" "libraryInputs libraryOutput" "libraryDrawing libraryOutput";
  grid-template-rows: auto auto 1fr;
}
.tm-library-inputs {
  grid-area: libraryInputs;
}
.tm-library-drawing {
  grid-area: libraryDrawing;
  border-top: 1px solid var(--line);
}
.tm-library-drawing svg {
  max-height: 175px;
}
.tm-library-drawing .tm-legend {
  grid-template-columns: minmax(0, 1fr);
}
.tm-library-output {
  grid-area: libraryOutput;
  padding: 12px 0 0 20px;
  border-left: 1px solid var(--line);
  min-width: 0;
}
.tm-table-wrap {
  overflow-x: auto;
}
.tm table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
  margin: 10px 0;
}
.tm caption {
  text-align: left;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 8px;
}
.tm th,
.tm td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.tm thead {
  background: #eeece5;
}
.tm th button {
  text-align: left;
  font-weight: 500;
  border-color: transparent;
  background: transparent;
}
.tm code {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
}
.tm td small {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
}
.tm td small:empty {
  display: none;
}
.tm td input {
  width: 100%;
  min-width: 100px;
}
.tm td input[readonly] {
  padding-left: 0;
  font-size: 0.9rem;
}
.tm td {
  font-variant-numeric: tabular-nums;
}
.tm-transfer-actions {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 14px;
  font-size: 0.8rem;
}
.tm textarea {
  width: 100%;
}
.tm #announcement:empty {
  display: none;
}
.tm-footer {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.8rem;
}
.tm-help-label {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 44px;
  padding-right: 24px;
  margin: 4px 0;
}
.tm .tm-help-label > label {
  margin: 0;
}
.tm-help-label--compact {
  min-height: 24px;
  margin: 0;
}
.tm .tm-help-button {
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 11px;
  line-height: 1;
  font-weight: 650;
  color: var(--muted);
  -webkit-tap-highlight-color: transparent;
}
.tm .tm-help-button::before {
  content: "";
  position: absolute;
  width: 17px;
  height: 17px;
  border: 1px solid currentColor;
  border-radius: 50%;
  pointer-events: none;
}
.tm .tm-help-button:hover,
.tm .tm-help-button[aria-expanded="true"] {
  background: transparent;
  color: var(--blue);
}
.tm-field-tooltip {
  position: fixed;
  z-index: 1000;
  width: min(320px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--ink);
  color: var(--surface);
  font-size: 14px;
  line-height: 1.5;
  font-weight: 400;
}
.ws-offset {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(0, 0.9fr);
  grid-template-areas: "bar bar" "inputs cutter" "results drawing" "extras extras";
  gap: 0 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 0 18px 14px;
}
.ws-offset button,
.ws-offset input,
.ws-offset select {
  min-height: 44px;
}
.ws-toolbar {
  grid-area: bar;
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0 12px;
  border-bottom: 1px solid var(--line);
}
.ws-toolbar label {
  margin: 0;
}
.ws-toolbar select {
  display: block;
  max-width: 230px;
}
.ws-inputs {
  grid-area: inputs;
  padding: 12px 0 0;
  min-width: 0;
}
.ws-row {
  display: grid;
  gap: 0 10px;
}
.ws-row > div {
  min-width: 0;
}
.ws-pair {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.ws-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.ws-source {
  color: var(--muted);
  font-size: 0.7rem;
  min-height: 22px;
  display: block;
  margin-top: 3px;
}
.ws-source:not(:empty) {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #efede7;
}
.ws-source[data-value-source="calculated"]:not(:empty) {
  color: #155b85;
  background: #e5f2fb;
  border-color: #b2d1e7;
}
.ws-offset input[data-value-source="calculated"]:not([aria-invalid="true"]) {
  background: #f0f7fc;
  border-color: #8fb5d0;
}
.tm .ws-source-key {
  color: var(--muted);
  font-size: 0.75rem;
  margin-bottom: 2px;
}
.ws-results {
  grid-area: results;
  border-top: 1px solid var(--line);
  margin-top: 4px;
  padding-top: 12px;
  min-width: 0;
}
.ws-output {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.ws-output span {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
}
.ws-output output {
  font-size: clamp(1rem, 1.5vw, 1.4rem);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.ws-current {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 14px;
  border-top: 1px solid var(--line);
  padding-top: 9px;
  margin-top: 12px;
  font-size: 0.8rem;
}
.tm .ws-limit {
  margin-top: 12px;
}
.ws-drawing {
  grid-area: drawing;
  border-left: 1px solid var(--line);
  padding: 12px 0 0 20px;
  min-width: 0;
}
.ws-extras {
  grid-area: extras;
}
.ws-cutter {
  grid-area: cutter;
  min-width: 0;
  padding: 12px 0 12px 20px;
  border-left: 1px solid var(--line);
}
.ws-cutter svg {
  display: block;
  width: min(100%, 300px);
  height: 100px;
  margin-inline: auto;
  font-size: 12px;
}
.ws-comparison {
  width: 100%;
  table-layout: fixed;
  margin-block: 12px;
  font-size: 0.8rem;
}
.ws-comparison caption {
  text-align: left;
  color: var(--muted);
  font-size: 0.75rem;
}
.ws-comparison td,
.ws-comparison th {
  padding: 6px 4px;
  overflow-wrap: anywhere;
}
.ws-mating {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 14px;
}
.ws-fit-heading,
.ws-fit-scale {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}
.ws-fit-heading label {
  margin: 0;
}
.ws-fit-heading output,
.ws-fit-clearance output {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.ws-mating input[type="range"] {
  display: block;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  accent-color: var(--blue);
  cursor: pointer;
}
.ws-mating input[type="range"]:disabled {
  cursor: default;
}
.ws-fit-scale {
  color: var(--muted);
  font-size: 0.8rem;
}
.tm .ws-fit-clearance {
  margin-block: 12px 4px;
  font-size: 0.85rem;
}
.ws-mating details {
  margin-top: 10px;
}
@media (max-width: 900px) {
  .ws-offset {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "bar" "inputs" "cutter" "results" "drawing" "extras";
  }
  .ws-drawing {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 12px 0 0;
    margin-top: 8px;
  }
  .ws-cutter {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 12px 0;
    margin-top: 8px;
  }
}
@media (max-width: 639px) {
  .ws-offset {
    padding-inline: 12px;
  }
  .ws-toolbar .tm-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ws-toolbar {
    position: relative;
  }
  .ws-toolbar > label {
    max-width: calc(100% - 78px);
  }
  .ws-toolbar #ws-clear {
    position: absolute;
    top: 30px;
    right: 0;
  }
  .ws-toolbar .tm-actions label {
    flex: 1;
    min-width: 0;
  }
  .ws-toolbar select {
    width: 100%;
    max-width: 100%;
    padding-inline: 7px;
  }
  .ws-cutter .ws-row:last-of-type > div:first-child {
    grid-column: 1 / -1;
  }
  .ws-cutter select {
    width: 100%;
  }
  .ws-drawing svg text {
    font-size: 30px;
  }
  .ws-inputs .ws-three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ws-extras .ws-three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ws-output output {
    font-size: 1.05rem;
  }
  .ws-output {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ws-output > div:first-child {
    grid-column: 1 / -1;
  }
}
@media (min-width: 640px) and (max-width: 959px) {
  .tm-workspace {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: "toolbar toolbar" "thread cutter" "result result" "drawing drawing" "optional optional";
  }
  .tm-drawing {
    border-inline: 0;
    border-top: 1px solid var(--line);
    padding-inline: 0;
  }
  .tm-library-workspace {
    grid-template-areas: "toolbar toolbar" "libraryInputs libraryDrawing" "libraryOutput libraryOutput";
  }
  .tm-library-output {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-left: 0;
  }
  .tm-optional {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
}
@media (max-width: 639px) {
  .tm {
    padding: 12px;
  }
  .tm h1 {
    font-size: 1.45rem;
  }
  .tm-workspace,
  .tm-library-workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "toolbar" "thread" "cutter" "result" "drawing" "optional";
    padding: 0 12px 12px;
    gap: 0;
  }
  .tm-library-workspace {
    grid-template-areas: "toolbar" "libraryInputs" "libraryOutput" "libraryDrawing";
  }
  .tm-library-output {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-left: 0;
  }
  .tm-cutter,
  .tm-drawing,
  .tm-library-drawing {
    border: 0;
    border-top: 1px solid var(--line);
    padding-inline: 0;
  }
  .tm-region {
    padding-block: 14px;
  }
  .tm button,
  .tm input,
  .tm select,
  .tm summary {
    min-height: 44px;
  }
  .tm input:not([type="checkbox"]),
  .tm select,
  .tm td input,
  .tm td input[readonly] {
    font-size: 16px;
  }
  .tm label {
    font-size: 0.85rem;
  }
  .tm-tabs button {
    flex: 1;
  }
  .tm-toolbar .tm-actions {
    width: 100%;
  }
  .tm-output-row {
    gap: 10px 22px;
  }
  .tm-output-row output {
    font-size: 1.45rem;
  }
  .tm-output-row .tm-actions {
    width: 100%;
  }
  .tm-schedule {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
  }
  .tm-schedule dd {
    margin-bottom: 6px;
  }
  .tm-optional {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .tm table {
    table-layout: fixed;
  }
  .tm th,
  .tm td {
    padding: 7px 3px;
    overflow-wrap: anywhere;
  }
  .tm th:first-child {
    width: 32%;
  }
  .tm th button {
    padding: 4px 0;
    font-size: 0.77rem;
  }
  .tm td input {
    min-width: 0;
    padding: 5px 0;
  }
  .tm code {
    font-size: 0.67rem;
  }
  .tm-legend {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Keep disclosures hidden after all component and responsive display rules. */
.tm-saved {
  margin: 14px 0;
  border-block: 1px solid var(--line);
  padding: 6px 0;
}
.tm-saved summary {
  min-height: 44px;
  padding-block: 10px;
}
.tm-saved summary small {
  margin-left: 10px;
  font-weight: normal;
  color: var(--muted);
}
.tm-saved-body {
  max-width: 900px;
  padding-bottom: 8px;
}
.tm-saved-name,
.tm-saved-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin-block: 10px;
}
.tm-saved-picker {
  grid-template-columns: minmax(0, 1fr) repeat(3, auto);
}
.tm-saved label {
  display: block;
  min-width: 0;
}
.tm-saved input,
.tm-saved select,
.tm-saved textarea {
  font-size: 16px;
}
.tm-saved textarea {
  margin-top: 5px;
  min-height: 150px;
  resize: vertical;
}
.tm-saved input[type="file"] {
  max-width: 100%;
  margin-block: 5px 12px;
}
.tm-saved .tm-actions {
  margin-block: 12px;
}
@media (max-width: 600px) {
  .tm-saved-picker {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .tm-saved-picker label {
    grid-column: 1 / -1;
  }
  .tm-saved summary small {
    display: block;
    margin-left: 0;
  }
}

.tm [hidden] {
  display: none;
}
