:root {
  color-scheme: dark;
  --bg: #070808;
  --rail: #0d0f10;
  --panel: #121516;
  --panel-raised: #181c1d;
  --panel-soft: #101313;
  --line: #2a3031;
  --line-bright: #3a4445;
  --text: #eef3f1;
  --muted: #9aa6a4;
  --muted-2: #6f7c79;
  --cyan: #59d6e8;
  --green: #7ee09a;
  --amber: #e7b95e;
  --red: #f06f73;
  --violet: #aa9cff;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

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

.app-shell {
  display: grid;
  grid-template-columns: 192px minmax(0, 1fr) 390px;
  width: 100%;
  height: 100vh;
  min-width: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    var(--bg);
  background-size: 40px 40px;
}

.left-rail,
.inspector {
  min-height: 0;
  border-color: var(--line);
  background: rgba(11, 13, 14, 0.97);
}

.left-rail {
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px 8px;
  border-right: 1px solid var(--line);
  scrollbar-color: #2f3a3b transparent;
  scrollbar-width: thin;
}

.left-rail::-webkit-scrollbar {
  width: 8px;
}

.left-rail::-webkit-scrollbar-track {
  background: transparent;
}

.left-rail::-webkit-scrollbar-thumb {
  border: 2px solid rgba(11, 13, 14, 0.97);
  border-radius: 8px;
  background: #2f3a3b;
}

.product-lockup {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
  padding: 0 2px 10px;
  border-bottom: 1px solid var(--line);
}

.brand-lockup {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.mark {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(89, 214, 232, 0.45);
  border-radius: 4px;
  background: #111819;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0;
}

.product-lockup strong {
  display: block;
  font-size: 12px;
  line-height: 1.1;
}

.product-lockup small {
  display: block;
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 10px;
  line-height: 1.2;
}

.file-menu-wrap {
  position: relative;
}

.file-menu-button {
  min-width: 42px;
  height: 26px;
  border: 1px solid rgba(89, 214, 232, 0.28);
  border-radius: 4px;
  background: #101718;
  color: #dce8e6;
  cursor: pointer;
  font-size: 10.5px;
  font-weight: 850;
  text-transform: uppercase;
}

.file-menu-button:hover,
.file-menu-button[aria-expanded="true"] {
  border-color: rgba(89, 214, 232, 0.58);
  background: #132126;
  color: #f2fdff;
}

.file-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  width: 190px;
  padding: 5px;
  border: 1px solid #344042;
  border-radius: 5px;
  background: #0c0f10;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.46);
}

.file-menu[hidden] {
  display: none;
}

.file-menu button {
  display: grid;
  width: 100%;
  min-height: 28px;
  align-items: center;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: #dce5e2;
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
  text-align: left;
}

.file-menu button:hover,
.file-menu button:focus-visible {
  border-color: rgba(89, 214, 232, 0.28);
  background: #132024;
  outline: none;
}

.file-menu button:disabled {
  cursor: default;
  opacity: 0.45;
}

.file-menu-divider {
  height: 1px;
  margin: 5px 3px;
  background: var(--line);
}

.file-recent-group {
  display: grid;
  gap: 3px;
  padding: 3px;
}

.file-recent-group[hidden] {
  display: none;
}

.file-recent-group > span {
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.file-recent-list {
  display: grid;
  gap: 2px;
}

.file-recent-empty {
  padding: 5px 6px;
  color: #66736f;
  font-size: 10px;
  font-weight: 750;
}

.tool-button {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 5px 8px;
  border: 1px solid #242a2b;
  border-radius: 4px;
  background: linear-gradient(180deg, #121617, #0f1212);
  color: #dce5e2;
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.12;
  text-align: left;
}

.tool-button:hover {
  border-color: #485456;
  background: linear-gradient(180deg, #171c1d, #111515);
}

.tool-button.active {
  border-color: rgba(89, 214, 232, 0.7);
  background: linear-gradient(180deg, #132a2f, #102024);
  color: #f2fdff;
}

.tool-button.primary {
  border-color: rgba(89, 214, 232, 0.58);
  background: linear-gradient(180deg, #13262a, #0f1c1f);
  color: #f2fdff;
}

.tool-button.export {
  border-color: rgba(126, 224, 154, 0.22);
}

.tool-button.strong {
  margin-top: auto;
  border-color: rgba(231, 185, 94, 0.45);
  background: linear-gradient(180deg, #261f12, #1d180f);
  color: #fff5d7;
}

.tool-button.history-button {
  min-height: 34px;
}

.tool-button:disabled {
  cursor: default;
  opacity: 0.42;
}

.tool-button:disabled:hover {
  border-color: #242a2b;
  background: linear-gradient(180deg, #121617, #0f1212);
}

.icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--cyan);
  font-size: 10px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.export .icon {
  color: var(--green);
}

.strong .icon {
  color: var(--amber);
}

.rail-separator {
  height: 1px;
  margin: 5px 0;
  background: var(--line);
}

.mesh-scale-card,
.mesh-transform-card,
.mesh-integrity-card,
.cut-workflow-card {
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px solid #242c2d;
  border-radius: 4px;
  background: #0b0e0e;
}

.mesh-integrity-card {
  border-color: #2a3233;
}

.mesh-transform-card {
  border-color: rgba(89, 214, 232, 0.22);
  background: #0a0d0d;
}

.cut-workflow-card {
  border-color: rgba(89, 214, 232, 0.46);
  background: linear-gradient(180deg, #0c1415, #090d0e);
  box-shadow: inset 0 0 0 1px rgba(89, 214, 232, 0.06);
}

.cut-workflow-card .mesh-scale-row span {
  color: #7bdde9;
}

.cut-workflow-card .mesh-scale-row strong {
  color: var(--cyan);
}

.cut-action-grid {
  display: grid;
  gap: 5px;
}

.inspector .cut-workflow-card {
  gap: 12px;
  padding: 12px;
  border-radius: 7px;
}

.inspector .cut-action-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.cut-workflow-card .tool-button {
  min-height: 34px;
}

.inspector .cut-workflow-card .tool-button {
  min-height: 40px;
}

.cut-workflow-card .cut-primary {
  border-color: rgba(89, 214, 232, 0.34);
  background:
    linear-gradient(90deg, rgba(89, 214, 232, 0.16), transparent 34%),
    linear-gradient(180deg, #121617, #0f1212);
  color: #edf7f6;
}

.cut-workflow-card .cut-primary .icon {
  border-color: rgba(89, 214, 232, 0.42);
  background: rgba(89, 214, 232, 0.12);
  color: #8ff3ff;
}

.cut-workflow-card .cut-primary.active {
  border-color: rgba(89, 214, 232, 0.78);
  background: linear-gradient(180deg, #16343a, #102329);
  color: #f2fdff;
}

.cut-workflow-card .cut-primary.active .icon {
  background: rgba(89, 214, 232, 0.22);
}

.cut-workflow-card .cut-apply {
  border-color: rgba(126, 224, 154, 0.34);
}

.cut-workflow-card .cut-apply .icon {
  color: var(--green);
}

.cut-workflow-card .cut-reset {
  border-color: rgba(231, 185, 94, 0.24);
}

.cut-workflow-card .cut-reset .icon {
  color: var(--amber);
}

.mesh-scale-row,
.mesh-scale-field {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.mesh-card-kicker {
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
}

.mesh-scale-row span,
.mesh-scale-field span {
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mesh-scale-row strong {
  min-width: 0;
  overflow: hidden;
  color: #dce5e2;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mesh-scale-field input {
  width: 100%;
  min-height: 24px;
  border: 1px solid #2b3435;
  border-radius: 3px;
  background: #0f1212;
  color: #e8eeee;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.transform-block {
  display: grid;
  gap: 5px;
  padding-top: 6px;
  border-top: 1px solid rgba(89, 214, 232, 0.11);
}

.transform-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.transform-block-head span,
.transform-block-head small {
  color: var(--muted-2);
  font-size: 9.5px;
  font-weight: 850;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
}

.transform-block-head small {
  color: #5e6b69;
  font-size: 9px;
}

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

.transform-action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.transform-small-action {
  min-height: 25px;
  border: 1px solid #263031;
  border-radius: 3px;
  background: #0f1212;
  color: #d6e1df;
  cursor: pointer;
  font-size: 9.5px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.transform-small-action:hover,
.transform-small-action:focus-visible {
  border-color: rgba(89, 214, 232, 0.48);
  background: #121c1d;
  color: #ffffff;
  outline: none;
}

.axis-field {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  align-items: stretch;
  min-width: 0;
  min-height: 27px;
  overflow: hidden;
  border: 1px solid #263031;
  border-radius: 3px;
  background: #0f1212;
}

.axis-field:focus-within {
  border-color: rgba(89, 214, 232, 0.64);
  box-shadow: 0 0 0 1px rgba(89, 214, 232, 0.08);
}

.axis-field span {
  display: grid;
  place-items: center;
  border-right: 1px solid rgba(255, 255, 255, 0.055);
  background: #141819;
  color: #a8b4b2;
  font-size: 9.5px;
  font-weight: 900;
  line-height: 1;
}

.axis-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: #edf4f2;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  outline: none;
  padding: 0 4px 0 3px;
  text-align: right;
}

.axis-field input::-webkit-outer-spin-button,
.axis-field input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.axis-field input[type="number"] {
  appearance: textfield;
}

.axis-x span {
  color: #f06f73;
}

.axis-y span {
  color: #7ee09a;
}

.axis-z span {
  color: #7b96ff;
}

.scale-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}

.scale-field {
  grid-template-columns: 18px minmax(0, 1fr);
}

.scale-axis-grid[hidden],
#uniformScaleControl[hidden] {
  display: none;
}

.scale-mode-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 6px;
}

.scale-mode-toggle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-width: 0;
  min-height: 27px;
  padding: 0 6px;
  border: 1px solid #263031;
  border-radius: 3px;
  background: #0f1212;
  color: #c9d3d0;
  cursor: pointer;
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
}

.scale-mode-toggle strong {
  color: #60706d;
  font-size: 9.5px;
}

.scale-axis-grid {
  gap: 4px;
}

.scale-axis-grid .axis-field {
  grid-template-columns: 12px minmax(0, 1fr);
}

.scale-axis-grid .axis-field input {
  font-size: 9.5px;
  padding: 0 2px;
}

.scale-mode-toggle[aria-pressed="true"] {
  border-color: rgba(89, 214, 232, 0.54);
  background: #112125;
  color: #f2fdff;
}

.scale-mode-toggle[aria-pressed="true"] strong {
  color: var(--cyan);
}

.scale-mode-toggle:hover {
  border-color: rgba(89, 214, 232, 0.38);
  background: #121819;
}

.transform-reset {
  min-width: 0;
  min-height: 27px;
  padding: 0 6px;
  border: 1px solid rgba(126, 224, 154, 0.24);
  border-radius: 3px;
  background: #101713;
  color: var(--green);
  cursor: pointer;
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
}

.transform-reset:hover {
  border-color: rgba(126, 224, 154, 0.48);
  background: #121c16;
}

.mini-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 7px;
  border: 1px solid rgba(126, 224, 154, 0.24);
  border-radius: 4px;
  background: #0f1412;
  color: #cbd6d3;
  cursor: pointer;
  font-size: 10.5px;
  font-weight: 850;
  text-align: left;
}

.mini-action:hover {
  border-color: rgba(126, 224, 154, 0.44);
  background: #121a16;
}

.mini-action strong {
  color: var(--green);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.integrity-detail {
  min-height: 28px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.35;
}

.shell-readout {
  min-height: 16px;
  color: #7a8784;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.25;
  text-transform: uppercase;
}

.shell-readout.warn {
  color: var(--amber);
}

.shell-readout.ok {
  color: var(--green);
}

.integrity-actions {
  display: grid;
  gap: 5px;
}

.mesh-integrity-card .mini-action {
  min-height: 26px;
  padding: 4px 7px;
}

.shell-merge-action {
  border-color: rgba(89, 214, 232, 0.3);
  background: #0d1719;
}

.shell-merge-action:hover {
  border-color: rgba(89, 214, 232, 0.58);
  background: #102024;
}

.shell-merge-action span {
  display: grid;
  gap: 2px;
}

.shell-merge-action b {
  color: #e4f6f7;
  font-size: 10.5px;
  line-height: 1;
}

.shell-merge-action small {
  color: #82a6aa;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.shell-merge-action strong {
  color: var(--cyan);
}

#meshIntegrityReadout.ok {
  color: var(--green);
}

#meshIntegrityReadout.warn {
  color: var(--amber);
}

#meshIntegrityReadout.bad {
  color: var(--red);
}

.viewport {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 48%, rgba(89, 214, 232, 0.055), transparent 0 44%),
    #090b0b;
}

#viewerCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.viewport.dragging {
  box-shadow: inset 0 0 0 2px rgba(89, 214, 232, 0.65);
}

.viewport.inspect-mode #viewerCanvas {
  cursor: grab;
}

.viewport.inspect-mode #viewerCanvas:active {
  cursor: grabbing;
}

.top-status {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 116px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.view-widget {
  position: absolute;
  top: 13px;
  right: 14px;
  z-index: 4;
  display: grid;
  gap: 7px;
  justify-items: end;
  pointer-events: none;
  perspective: 420px;
}

.view-cube {
  position: relative;
  width: 70px;
  height: 70px;
  overflow: hidden;
  border: 1px solid rgba(89, 214, 232, 0.36);
  border-radius: 4px;
  background: rgba(11, 17, 18, 0.8);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035);
  pointer-events: auto;
}

#viewCubeCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.view-cube-label-layer {
  position: absolute;
  inset: 1px;
  pointer-events: none;
}

.view-cube-label {
  position: absolute;
  left: 50%;
  top: 50%;
  color: #e6fffb;
  font-size: 14px;
  font-weight: 950;
  line-height: 1;
  text-shadow:
    -1px -1px 0 rgba(3, 8, 9, 0.96),
    1px -1px 0 rgba(3, 8, 9, 0.96),
    -1px 1px 0 rgba(3, 8, 9, 0.96),
    1px 1px 0 rgba(3, 8, 9, 0.96),
    0 0 5px rgba(89, 214, 232, 0.55);
  transform: translate(-50%, -50%);
}

.view-cube-label[data-view="bottom"] {
  font-size: 11px;
}

.section-clip-control {
  position: absolute;
  top: 126px;
  right: 14px;
  z-index: 4;
  display: grid;
  grid-template-rows: 24px 240px auto;
  gap: 7px;
  justify-items: center;
  width: 82px;
  pointer-events: auto;
}

.section-clip-control[hidden] {
  display: none;
}

.section-clip-top {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 5px;
  align-items: center;
  width: 100%;
}

.section-clip-reset {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(89, 214, 232, 0.32);
  border-radius: 4px;
  background: rgba(11, 17, 18, 0.88);
  color: #dff6f3;
  cursor: pointer;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
}

.section-clip-reset:hover,
.section-clip-reset:focus-visible {
  border-color: rgba(89, 214, 232, 0.78);
  background: rgba(24, 50, 53, 0.94);
  color: #ffffff;
  outline: none;
}

.section-clip-percent {
  position: relative;
  display: block;
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  height: 22px;
  border: 1px solid rgba(89, 214, 232, 0.28);
  border-radius: 4px;
  background: rgba(11, 17, 18, 0.88);
  color: #dff6f3;
}

.section-clip-percent input[type="number"] {
  appearance: textfield;
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 0 16px 0 5px;
  border: 0;
  background: transparent;
  color: #dff6f3;
  font-size: 10px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  line-height: 20px;
  text-align: right;
}

.section-clip-percent input[type="number"]:focus {
  outline: none;
}

.section-clip-percent input[type="number"]::-webkit-outer-spin-button,
.section-clip-percent input[type="number"]::-webkit-inner-spin-button {
  appearance: none;
  margin: 0;
}

.section-clip-percent span {
  position: absolute;
  top: 50%;
  right: 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  line-height: 1;
  pointer-events: none;
  transform: translateY(-50%);
}

.section-clip-slider {
  position: relative;
  width: 22px;
  height: 240px;
  border: 1px solid rgba(89, 214, 232, 0.35);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(126, 224, 154, 0.45), rgba(89, 214, 232, 0.16)),
    rgba(11, 17, 18, 0.76);
  box-shadow: inset 0 0 0 7px rgba(4, 8, 9, 0.72);
  cursor: ns-resize;
  touch-action: none;
}

.section-clip-slider:focus-visible {
  border-color: rgba(89, 214, 232, 0.78);
  outline: none;
  box-shadow:
    inset 0 0 0 7px rgba(4, 8, 9, 0.72),
    0 0 0 2px rgba(89, 214, 232, 0.18);
}

.section-clip-thumb {
  position: absolute;
  left: 50%;
  top: calc((1 - var(--section-clip-fraction, 1)) * 100%);
  width: 18px;
  height: 18px;
  border: 1px solid rgba(222, 255, 251, 0.9);
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 3px rgba(89, 214, 232, 0.16);
  transform: translate(-50%, -50%);
}

.section-clip-readout {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid rgba(89, 214, 232, 0.28);
  border-radius: 4px;
  background: rgba(11, 17, 18, 0.88);
  color: #dff6f3;
  font-size: 10px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: center;
}

.camera-mode-toggle {
  width: 54px;
  height: 24px;
  border: 1px solid rgba(89, 214, 232, 0.35);
  border-radius: 4px;
  background: rgba(11, 17, 18, 0.86);
  color: var(--cyan);
  cursor: pointer;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
  pointer-events: auto;
}

.camera-mode-toggle:hover,
.camera-mode-toggle:focus-visible,
.camera-mode-toggle[aria-pressed="true"] {
  border-color: rgba(89, 214, 232, 0.85);
  background: rgba(20, 42, 45, 0.92);
  color: #ffffff;
  outline: none;
}

.top-status > div {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: rgba(7, 8, 8, 0.68);
  backdrop-filter: blur(12px);
}

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

.top-status strong {
  max-width: 360px;
  color: #f6faf8;
  font-size: 12px;
}

.top-status span {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.status-cluster span:first-child {
  color: var(--cyan);
}

.status-cluster span:nth-child(2) {
  color: var(--amber);
}

.status-cluster span:last-child {
  color: var(--green);
}

.drop-hint {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 2;
  display: grid;
  gap: 3px;
  width: min(330px, calc(100% - 28px));
  padding: 10px 12px;
  border: 1px solid rgba(89, 214, 232, 0.22);
  border-radius: 6px;
  background: rgba(10, 12, 12, 0.7);
  backdrop-filter: blur(10px);
}

.drop-hint strong {
  font-size: 12px;
}

.drop-hint span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.drop-hint.hidden {
  display: none;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(90deg, rgba(89, 214, 232, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(126, 224, 154, 0.035) 1px, transparent 1px),
    rgba(5, 7, 7, 0.76);
  background-size: 34px 34px;
  backdrop-filter: blur(4px);
}

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

.loading-panel {
  display: grid;
  gap: 14px;
  width: min(430px, 100%);
  padding: 18px;
  border: 1px solid rgba(89, 214, 232, 0.38);
  border-radius: 6px;
  background: rgba(9, 12, 12, 0.94);
  box-shadow:
    0 20px 70px rgba(0, 0, 0, 0.46),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.loading-header {
  display: grid;
  gap: 5px;
}

.loading-kicker {
  color: var(--cyan);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.loading-header strong {
  color: #f5faf8;
  font-size: 18px;
  line-height: 1.15;
}

.loading-track {
  position: relative;
  height: 8px;
  overflow: hidden;
  border: 1px solid #293536;
  border-radius: 999px;
  background: #0d1111;
}

.loading-track span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  box-shadow: 0 0 18px rgba(89, 214, 232, 0.32);
  transition: width 140ms ease;
}

.loading-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.35;
}

.loading-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.loading-meta strong {
  color: var(--amber);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.inspector {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100vh;
  padding: 14px;
  border-left: 1px solid var(--line);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.inspector-header {
  padding: 0 2px 8px;
  border-bottom: 1px solid var(--line);
}

.inspector-header span {
  color: var(--cyan);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.inspector-header h1 {
  margin: 5px 0 0;
  font-size: 24px;
  line-height: 1;
}

.panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid #263031;
  border-radius: 7px;
  background: rgba(18, 21, 22, 0.94);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid #22292a;
}

.panel-heading h2 {
  margin: 0;
  color: #f2f5f3;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.panel-heading span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cut-control-panel.is-idle {
  border-color: #1f2a2b;
}

.cut-control-panel.is-idle > :not(.panel-heading):not(.cut-idle-hint) {
  opacity: 0.54;
}

.cut-idle-hint {
  margin: -4px 0 0;
  color: #9da8a3;
  font-size: 11px;
  line-height: 1.35;
}

.cut-idle-hint[hidden] {
  display: none;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border: 1px solid #252d2e;
  border-radius: 7px;
  background: #0d1010;
}

.mode-strip {
  margin: -2px 0 2px;
}

.segmented.two-up {
  grid-template-columns: repeat(2, 1fr);
}

.segmented.three-up {
  grid-template-columns: repeat(3, 1fr);
}

.inspector.repair-active .cut-workflow-card,
.inspector.repair-active #partLayoutPanel,
.inspector.repair-active #cutStackPanel,
.inspector.repair-active #cutPlanePanel,
.inspector.repair-active #cutWindowPanel,
.inspector.repair-active #connectorSystemPanel,
.inspector.repair-active #exportPanel,
.inspector.repair-active #diagnosticPanel {
  display: none;
}

.inspector.repair-active #repairPanel {
  display: grid;
}

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

.repair-verdict {
  padding: 9px 10px;
  border: 1px solid #263031;
  border-radius: 6px;
  background: #0d1010;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.repair-verdict.ok {
  border-color: rgba(126, 224, 154, 0.42);
  color: var(--green);
}

.repair-issue-list,
.repair-report {
  display: grid;
  gap: 7px;
}

.repair-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.repair-actions #repairFixAll {
  grid-column: 1 / -1;
}

.repair-issue {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto auto;
  gap: 7px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(255, 101, 101, 0.34);
  border-radius: 6px;
  background: rgba(255, 101, 101, 0.07);
  color: #f3d0d0;
  font-size: 11px;
}

.repair-issue.warning {
  border-color: rgba(255, 196, 87, 0.34);
  background: rgba(255, 196, 87, 0.07);
  color: var(--amber);
}

.repair-issue.info {
  border-color: rgba(89, 214, 232, 0.28);
  background: rgba(89, 214, 232, 0.06);
  color: var(--muted);
}

.repair-issue-kind {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(255, 101, 101, 0.12);
}

.repair-issue.warning .repair-issue-kind {
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(255, 196, 87, 0.12);
}

.repair-issue-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repair-report {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.stack-list,
.part-list {
  display: grid;
  gap: 6px;
}

.stack-list {
  max-height: 150px;
  overflow: auto;
  padding-right: 2px;
}

.stack-row,
.part-chip {
  display: grid;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid #262d2e;
  border-radius: 6px;
  background: #101414;
  color: #dce5e2;
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0;
  text-align: left;
}

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

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

.stack-empty {
  min-height: 34px;
  padding: 8px 9px;
  border: 1px dashed #30393a;
  border-radius: 6px;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 800;
}

.stack-row.active,
.part-chip.active {
  border-color: rgba(89, 214, 232, 0.62);
  background: #102024;
  color: #f2fdff;
}

.stack-row span,
.part-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stack-row small,
.part-chip small {
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 800;
}

.part-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #596162;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.part-status-dot.good {
  background: var(--green);
}

.part-status-dot.warn {
  background: var(--amber);
}

.part-status-dot.bad {
  background: var(--red);
}

.part-status-dot.unknown {
  background: #596162;
}

.segmented button,
.quality-row button,
.compact-button {
  min-height: 28px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #aeb9b6;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.segmented button:hover,
.quality-row button:hover,
.compact-button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f3f7f5;
}

.segmented button.active,
.quality-row button.active {
  background: #1b2a2d;
  color: var(--cyan);
  box-shadow: inset 0 0 0 1px rgba(89, 214, 232, 0.22);
}

.compact-button {
  border: 1px solid #30393a;
  background: #0f1212;
  color: #cbd6d3;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.field > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.field strong {
  color: var(--cyan);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

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

select,
input[type="number"] {
  width: 100%;
  min-height: 30px;
  min-width: 0;
  border: 1px solid #30393a;
  border-radius: 5px;
  background: #0f1212;
  color: #e8eeee;
  font-size: 12px;
}

select {
  padding: 0 8px;
}

input[type="number"] {
  padding: 0 7px;
  font-variant-numeric: tabular-nums;
}

.dual-field,
.numeric-grid {
  display: grid;
  gap: 9px;
}

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

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

.numeric-grid label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

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

.label-help {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.help-dot {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  padding: 0;
  border: 1px solid #394345;
  border-radius: 50%;
  background: #111616;
  color: var(--cyan);
  cursor: help;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.help-dot::after {
  position: absolute;
  right: -4px;
  bottom: calc(100% + 8px);
  z-index: 20;
  width: 250px;
  padding: 8px 9px;
  border: 1px solid #344143;
  border-radius: 5px;
  background: #090c0c;
  color: #cdd8d5;
  content: attr(data-tip);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  text-transform: none;
  transform: translateY(3px);
  transition: opacity 120ms ease, transform 120ms ease;
  white-space: normal;
}

.help-dot:hover::after,
.help-dot:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.toggle input {
  width: 15px;
  height: 15px;
  accent-color: var(--green);
}

.quality-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(3, 48px);
  gap: 5px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.quality-row button {
  border: 1px solid #252d2e;
  background: #0f1212;
}

.diagnostic-panel {
  margin-bottom: 4px;
}

.diagnostics {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.diagnostics strong {
  color: #e8eeee;
}

.diagnostics .good {
  color: var(--green);
}

.diagnostics .warn {
  color: var(--amber);
}

.diagnostics .bad {
  color: var(--red);
}

.integrity-issues {
  display: grid;
  gap: 7px;
}

.integrity-issue {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border: 1px solid rgba(255, 196, 87, 0.32);
  border-radius: 6px;
  background: rgba(255, 196, 87, 0.07);
  color: var(--amber);
  font-size: 11px;
}

.integrity-issue.bad {
  border-color: rgba(255, 101, 101, 0.36);
  background: rgba(255, 101, 101, 0.08);
  color: var(--red);
}

.issue-action {
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid #384243;
  border-radius: 5px;
  background: #101414;
  color: #dce5e2;
  cursor: pointer;
  font-size: 10px;
  font-weight: 850;
}

@media (max-width: 980px) {
  html,
  body {
    height: auto;
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 156px minmax(0, 1fr);
    grid-template-rows: minmax(520px, 72vh) auto;
    height: auto;
    min-height: 100vh;
  }

  .left-rail {
    grid-row: 1 / 3;
    height: auto;
  }

  .viewport {
    min-height: 520px;
  }

  .inspector {
    grid-column: 2;
    height: auto;
    max-height: none;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 640px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(460px, 68vh) auto;
  }

  .left-rail {
    grid-column: 1;
    grid-row: auto;
    flex-direction: row;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .viewport,
  .inspector {
    grid-column: 1;
  }

  .product-lockup {
    min-width: 150px;
    margin: 0;
    padding: 0 10px 0 0;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .tool-button {
    min-width: 136px;
  }

  .tool-button.strong {
    margin-top: 0;
  }

  .rail-separator {
    display: none;
  }

  .viewport {
    min-height: 460px;
  }

  .top-status {
    top: 104px;
    right: 12px;
    align-items: stretch;
    flex-direction: column;
  }

  .dual-field,
  .numeric-grid {
    grid-template-columns: 1fr;
  }
}
