:root {
  --bg: #eef2f6;
  --bg-elevated: rgba(248, 250, 252, 0.98);
  --bg-panel: #f1f4f8;
  --border: rgba(119, 137, 156, 0.18);
  --border-strong: rgba(88, 108, 128, 0.28);
  --text: #223446;
  --muted: #65788b;
  --accent: rgb(103, 162, 192);
  --accent-soft: rgba(103, 162, 192, 0.18);
  --manufacturer-total-color: #4f9ab8;
  --own-parts-color: #1f4d63;
  --success: #31c48d;
  --danger: #ff4d6d;
  --shadow-soft: 0 10px 24px rgba(108, 124, 140, 0.10);
  --shadow-pressed: inset 0 1px 2px rgba(122, 138, 154, 0.10);
  --shadow-floating: 0 18px 40px rgba(70, 88, 106, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, #f5f7fa 0%, #eaf0f5 100%);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 1px solid rgba(151, 168, 185, 0.18);
  border-radius: 10px;
  cursor: pointer;
  transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  box-shadow: var(--shadow-soft);
}

button:hover {
  transform: translateY(-1px);
}

button.primary {
  background: linear-gradient(180deg, rgb(117, 171, 199), rgb(103, 162, 192));
  color: white;
  padding: 0.65rem 0.9rem;
  border-color: rgba(84, 135, 161, 0.34);
}

button.ghost {
  background: #f6f8fb;
  color: var(--text);
  padding: 0.65rem 0.9rem;
}

button.ghost.active {
  background: linear-gradient(180deg, rgb(117, 171, 199), rgb(103, 162, 192));
  color: white;
  box-shadow: 0 10px 22px rgba(76, 123, 148, 0.18);
}

button.danger {
  background: #fff1f4;
  color: #b73754;
  border: 1px solid rgba(199, 80, 108, 0.18);
  padding: 0.65rem 0.9rem;
}

button.small {
  padding: 0.45rem 0.72rem;
  border-radius: 9px;
}

.shell {
  min-height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.brand-mark {
  width: 88px;
  height: 60px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #f7f9fb;
  border: 1px solid rgba(151, 168, 185, 0.18);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.eyebrow {
  margin: 0 0 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.66rem;
  color: var(--muted);
}

h1,
h2 {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0.01em;
}

h1 {
  font-size: 1.55rem;
  font-weight: 700;
}

h2 {
  font-size: 1.02rem;
  font-weight: 700;
}

.panel {
  background: var(--bg-panel);
  border: 1px solid rgba(151, 168, 185, 0.18);
  border-radius: 16px;
  padding: 0.85rem;
  box-shadow: var(--shadow-soft);
}

.panel + .panel {
  margin-top: 1rem;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.project-actions,
.button-row {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.muted,
.hint,
.tree-meta {
  color: var(--muted);
}

.hint,
.muted {
  font-size: 0.84rem;
  line-height: 1.38;
}

.tree-panel {
  min-height: 640px;
  height: calc(100vh - 170px);
  padding-top: 0.85rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tree-view {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.4rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(103, 162, 192, 0.5) transparent;
}

.tree-view::-webkit-scrollbar {
  width: 9px;
}

.tree-view::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(103, 162, 192, 0.72), rgba(103, 162, 192, 0.38));
  border-radius: 999px;
}

.tree-view.drag-active {
  gap: 1rem;
}

.add-tree-tile {
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 100%;
  min-height: 58px;
  margin-top: 0.6rem;
  border: 1px dashed rgba(103, 162, 192, 0.45);
  border-radius: 12px;
  background: #f6f8fb;
  box-shadow: var(--shadow-soft);
  color: rgb(103, 162, 192);
  font-size: 2rem;
  font-weight: 500;
}

.add-tree-tile.hidden {
  display: none;
}

.tree-item {
  --tree-indent: 0rem;
  padding-left: var(--tree-indent);
  position: relative;
}

.tree-item.depth-1 {
  --tree-indent: 1.25rem;
}

.tree-item.depth-2 {
  --tree-indent: 2.5rem;
}

.tree-item.depth-3,
.tree-item.depth-4,
.tree-item.depth-5 {
  --tree-indent: 3.75rem;
}

.tree-node-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem;
  width: min(100%, 420px);
}

.tree-drop-zone {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: min(100%, 420px);
  min-height: 0;
  max-height: 0;
  margin: 0;
  padding: 0 0.8rem;
  border-radius: 10px;
  border: 0 dashed rgba(103, 162, 192, 0.35);
  color: rgba(20, 48, 71, 0.52);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: rgba(103, 162, 192, 0.06);
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transition:
    max-height 140ms ease,
    margin 140ms ease,
    padding 140ms ease,
    border-color 140ms ease,
    background-color 140ms ease,
    color 140ms ease,
    transform 140ms ease,
    opacity 140ms ease;
}

.tree-view.drag-active .tree-drop-zone {
  min-height: 34px;
  max-height: 34px;
  margin: 0.25rem 0;
  padding: 0.35rem 0.8rem;
  border-width: 1px;
  opacity: 1;
  pointer-events: auto;
}

.tree-drop-zone.active {
  border-color: rgba(103, 162, 192, 0.7);
  background: rgba(103, 162, 192, 0.18);
  color: rgb(103, 162, 192);
  transform: translateX(2px);
}

.tree-drop-zone::before {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-right: 0.55rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 0.72rem;
  line-height: 1;
  content: "";
}

.tree-drop-zone::after {
  content: "";
  margin-left: auto;
  font-size: 0.82rem;
  opacity: 0.75;
}

.tree-drop-zone-before::before {
  content: "\2191";
}

.tree-drop-zone-before::after {
  content: "\2191";
}

.tree-drop-zone-inside::before {
  content: "+";
}

.tree-drop-zone-inside::after {
  content: "\2192";
}

.tree-drop-zone-after::before {
  content: "\2193";
}

.tree-drop-zone-after::after {
  content: "\2193";
}

.tree-drop-zone-inside {
  margin-top: 0.45rem;
  margin-bottom: 0.45rem;
  background: rgba(103, 162, 192, 0.08);
}

.tree-node-row {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
  min-width: 0;
}

.tree-node-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: relative;
  width: 100%;
  text-align: left;
  background: color-mix(in srgb, var(--tree-node-accent, #f7f9fb) 8%, #f4f7fa 92%);
  border: 1px solid rgba(151, 168, 185, 0.18);
  padding: 0.48rem 0.55rem;
  color: var(--text);
  min-width: 0;
  min-height: 64px;
  box-shadow: var(--shadow-soft);
}

.tree-node-toggle {
  flex: 0 0 34px;
  background: #f7f9fb;
  box-shadow: var(--shadow-soft);
}

.tree-node-toggle.collapsed {
  transform: rotate(-90deg);
}

.tree-node-toggle.hidden-toggle {
  visibility: hidden;
}

.tree-node-main.active {
  border-color: color-mix(in srgb, var(--tree-node-accent, rgb(103, 162, 192)) 72%, white);
  background: color-mix(in srgb, var(--tree-node-accent, rgb(103, 162, 192)) 14%, #f6f9fb 86%);
  box-shadow: 0 10px 22px rgba(101, 120, 140, 0.10);
}

.tree-node-main.dragging {
  opacity: 0.45;
}

.thumb-shell {
  position: relative;
  width: 58px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 10px;
  overflow: hidden;
  background: #eef3f7;
}

.thumb,
.thumb-fallback {
  width: 100%;
  height: 100%;
}

.thumb {
  object-fit: cover;
  display: none;
}

.thumb.visible {
  display: block;
}

.thumb-fallback {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
}

.tree-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.tree-title {
  display: block;
  font-size: 0.92rem;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.18;
}

.tree-node-actions {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  align-content: start;
  align-items: flex-end;
}

.toggle-node-tools.active {
  background: rgba(103, 162, 192, 0.16);
  border-color: rgba(103, 162, 192, 0.45);
}

.tree-node-tools {
  display: grid;
  grid-template-columns: repeat(2, 34px);
  gap: 0.25rem;
}

.tree-node-tools.hidden {
  display: none;
}

.tree-children.collapsed {
  display: none;
}

.tree-children {
  margin-top: 0.7rem;
}

.icon-btn {
  width: 30px;
  height: 30px;
  background: #f7f9fb;
  color: var(--text);
  border: 1px solid rgba(151, 168, 185, 0.18);
  box-shadow: var(--shadow-soft);
}

.icon-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.content {
  padding: 1rem 1.1rem;
}

.brand-inline {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0.35rem 0.72rem;
  border-radius: 999px;
  background: #f7f9fb;
  border: 1px solid rgba(151, 168, 185, 0.18);
  box-shadow: var(--shadow-soft);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(360px, 420px) minmax(420px, 1fr) 320px;
  gap: 0.85rem;
  align-items: start;
}

.workspace-grid.hotspot-panel-hidden {
  grid-template-columns: minmax(360px, 420px) minmax(520px, 1fr);
}

.node-form,
.hotspot-form {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-weight: 500;
  font-size: 0.84rem;
}

input,
textarea,
select {
  width: 100%;
  padding: 0.62rem 0.72rem;
  background: #f8fafc;
  border: 1px solid rgba(151, 168, 185, 0.22);
  border-radius: 10px;
  color: var(--text);
  box-shadow: var(--shadow-pressed);
}

input[type="color"] {
  min-height: 42px;
  padding: 0.3rem;
}

.preset-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.color-preset {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 999px;
  background: var(--preset-color);
  border: 2px solid rgba(20, 48, 71, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.color-preset:hover {
  transform: translateY(-1px) scale(1.04);
}

.empty-state {
  padding: 0.85rem;
  border-radius: 12px;
  border: 1px dashed rgba(103, 162, 192, 0.24);
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
  background: #f6f8fb;
  box-shadow: var(--shadow-soft);
}

.image-empty {
  min-height: 420px;
  display: grid;
  place-items: center;
}

.image-stage {
  border-radius: 16px;
  border: 1px solid rgba(151, 168, 185, 0.18);
  background:
    linear-gradient(45deg, rgba(20,48,71,0.03) 25%, transparent 25%, transparent 75%, rgba(20,48,71,0.03) 75%),
    linear-gradient(45deg, rgba(20,48,71,0.03) 25%, transparent 25%, transparent 75%, rgba(20,48,71,0.03) 75%);
  background-position: 0 0, 12px 12px;
  background-size: 24px 24px;
  min-height: 420px;
  height: calc(100vh - 190px);
  max-height: calc(100vh - 190px);
  padding: 0.75rem;
  display: grid;
  place-items: center;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.media-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.media-tabs.hidden {
  display: none;
}

.media-tabs button.active {
  background: linear-gradient(135deg, rgb(123, 178, 206), rgb(103, 162, 192));
  color: white;
}

.image-canvas {
  position: relative;
  display: inline-block;
  width: var(--image-display-width, auto);
  height: var(--image-display-height, auto);
  max-width: 100%;
  max-height: 100%;
  line-height: 0;
}

.image-canvas img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
  user-select: none;
}

.model-stage {
  border-radius: 16px;
  border: 1px solid rgba(151, 168, 185, 0.18);
  background: #f3f7fa;
  min-height: 420px;
  padding: 0.75rem;
  box-shadow: var(--shadow-soft);
}

.model-stage.hidden {
  display: none;
}

#stageModel {
  width: 100%;
  height: 420px;
  background: linear-gradient(180deg, #ffffff, #edf3f7);
  border-radius: 12px;
  --poster-color: transparent;
}

.manufacturer-analysis {
  margin-top: 0.8rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid rgba(151, 168, 185, 0.18);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(241, 245, 249, 0.98));
  box-shadow: var(--shadow-soft);
}

.manufacturer-analysis.hidden {
  display: none;
}

.manufacturer-analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-top: 0.8rem;
}

.manufacturer-analysis-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.manufacturer-marker-legend {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.manufacturer-marker-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  color: var(--text);
  border: 1px solid rgba(151, 168, 185, 0.18);
  background: #f8fafc;
}

.manufacturer-marker-key {
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  color: white;
}

.manufacturer-marker-legend-item.manufacturer .manufacturer-marker-key {
  background: rgba(103, 162, 192, 1);
}

.manufacturer-marker-legend-item.own .manufacturer-marker-key {
  background: rgba(20, 48, 71, 0.88);
}

.manufacturer-marker-legend-item.norelem .manufacturer-marker-key {
  background: #f59e0b;
}

.manufacturer-config-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.manufacturer-config-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.55rem;
  border-radius: 12px;
  border: 1px solid rgba(151, 168, 185, 0.18);
  background: #f8fafc;
  box-shadow: var(--shadow-pressed);
}

.manufacturer-config-row input[type="text"] {
  min-width: 0;
}

.manufacturer-config-row input[type="color"] {
  min-height: 40px;
}

.manufacturer-remove-btn {
  min-width: 40px;
  padding-inline: 0.6rem;
}

.manufacturer-metric {
  padding: 0.8rem 0.9rem;
  border-radius: 14px;
  border: 1px solid rgba(151, 168, 185, 0.18);
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.manufacturer-metric.manufacturer {
  background: linear-gradient(180deg, color-mix(in srgb, var(--manufacturer-total-color) 18%, white), color-mix(in srgb, var(--manufacturer-total-color) 8%, white));
  border-color: color-mix(in srgb, var(--manufacturer-total-color) 22%, white);
}

.manufacturer-metric.own {
  background: linear-gradient(180deg, color-mix(in srgb, var(--own-parts-color) 14%, white), color-mix(in srgb, var(--own-parts-color) 6%, white));
  border-color: color-mix(in srgb, var(--own-parts-color) 20%, white);
}

.manufacturer-metric.manufacturer .manufacturer-metric-label,
.manufacturer-metric.manufacturer strong,
.manufacturer-metric.manufacturer .manufacturer-metric-meta {
  color: var(--manufacturer-total-color);
}

.manufacturer-metric.own .manufacturer-metric-label,
.manufacturer-metric.own strong,
.manufacturer-metric.own .manufacturer-metric-meta {
  color: var(--own-parts-color);
}

.manufacturer-metric-label,
.manufacturer-analysis-detail-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.manufacturer-metric strong {
  font-size: 1.5rem;
  line-height: 1;
}

.manufacturer-metric-meta {
  color: var(--muted);
  font-size: 0.86rem;
}

.manufacturer-share-bar {
  margin-top: 0.85rem;
  width: 100%;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  display: flex;
  border: 1px solid rgba(151, 168, 185, 0.18);
  background: #edf2f7;
}

.manufacturer-share {
  height: 100%;
  transition: width 180ms ease;
}

.manufacturer-share.manufacturer {
  background: linear-gradient(90deg, color-mix(in srgb, var(--manufacturer-total-color) 84%, white), var(--manufacturer-total-color));
}

.manufacturer-share.own {
  background: linear-gradient(90deg, color-mix(in srgb, var(--own-parts-color) 76%, white), var(--own-parts-color));
}

.manufacturer-brand-section {
  margin-top: 0.9rem;
}

.manufacturer-brand-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-top: 0.6rem;
}

.manufacturer-brand-row {
  padding: 0.78rem 0.85rem;
  border-radius: 14px;
  border: 1px solid rgba(151, 168, 185, 0.18);
  background: #f8fafc;
}

.manufacturer-brand-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.45rem;
}

.manufacturer-brand-head strong {
  font-size: 0.98rem;
}

.manufacturer-brand-meta {
  color: var(--muted);
  font-size: 0.84rem;
}

.manufacturer-brand-labels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.manufacturer-brand-labels span:nth-child(2) {
  text-align: center;
}

.manufacturer-brand-labels span:nth-child(3) {
  text-align: right;
}

.manufacturer-share.brand {
  background: linear-gradient(90deg, color-mix(in srgb, var(--brand-color, #f59e0b) 84%, white), var(--brand-color, #f59e0b));
}

.manufacturer-share.other-manufacturer {
  background: linear-gradient(90deg, rgba(103, 162, 192, 0.52), rgba(103, 162, 192, 0.72));
}

.manufacturer-analysis-details {
  margin-top: 0.85rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid rgba(151, 168, 185, 0.16);
}

.manufacturer-analysis-details strong {
  font-size: 1.15rem;
}

.manufacturer-summary {
  margin-top: 0.85rem;
  padding: 0.8rem 0.85rem;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid rgba(151, 168, 185, 0.16);
}

.manufacturer-summary p {
  margin: 0.45rem 0 0;
  color: var(--text);
  line-height: 1.45;
}

.analysis-marker {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  color: white;
  z-index: 1;
  pointer-events: auto;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.84);
}

.analysis-marker.manufacturer {
  background: rgba(103, 162, 192, 0.98);
}

.analysis-marker.own {
  background: rgba(20, 48, 71, 0.92);
}

.analysis-marker-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  min-width: 160px;
  max-width: 220px;
  padding: 0.5rem 0.6rem;
  border-radius: 10px;
  background: rgba(17, 24, 39, 0.96);
  color: white;
  line-height: 1.35;
  font-size: 0.78rem;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.24);
  opacity: 0;
  visibility: hidden;
  transition: opacity 140ms ease, visibility 140ms ease;
  pointer-events: none;
}

.analysis-marker-tooltip strong {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.8rem;
}

.analysis-marker:hover .analysis-marker-tooltip,
.analysis-marker:focus-visible .analysis-marker-tooltip {
  opacity: 1;
  visibility: visible;
}

.model-hotspot {
  min-width: 22px;
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.52rem 0.28rem 0.3rem;
  border-radius: 999px;
  border: 2px solid var(--hotspot-color, #67a2c0);
  background: rgba(255, 255, 255, 0.96);
  color: #143047;
  font-weight: 700;
  font-size: 0.82rem;
  line-height: 1.2;
  box-shadow: 0 0 0 8px rgba(103, 162, 192, 0.12);
}

.model-hotspot.active {
  box-shadow: 0 0 0 10px rgba(103, 162, 192, 0.22);
}

.model-hotspot.compact {
  min-width: 18px;
  min-height: 18px;
  width: 18px;
  height: 18px;
  padding: 0;
  gap: 0;
  justify-content: center;
}

.hotspot {
  position: absolute;
  min-width: 22px;
  min-height: 22px;
  margin-left: 0;
  margin-top: 0;
  border-radius: 999px;
  border: 2px solid var(--hotspot-text-color, #143047);
  box-shadow: 0 0 0 8px rgba(103, 162, 192, 0.12);
  cursor: grab;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.52rem 0.28rem 0.3rem;
  transform: translate(-50%, -50%);
  color: var(--hotspot-text-color, #143047);
  background: var(--hotspot-color, #ff6b2c);
  font-weight: 700;
  font-size: 0.82rem;
  line-height: 1.2;
  white-space: nowrap;
}

.hotspot::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--hotspot-color, #ff6b2c);
}

.hotspot.active {
  transform: translate(-50%, -50%) scale(1.05);
  box-shadow: 0 0 0 10px rgba(103, 162, 192, 0.22);
}

.hotspot.compact {
  min-width: 18px;
  min-height: 18px;
  width: 18px;
  height: 18px;
  padding: 0;
  gap: 0;
  justify-content: center;
}

.hotspot.compact:hover,
.hotspot.compact.hover-preview {
  width: auto;
  min-width: 22px;
  min-height: 22px;
  padding: 0.28rem 0.52rem 0.28rem 0.3rem;
  gap: 0.3rem;
}

.hotspot-label {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hotspot-icon {
  font-size: 0.82rem;
  line-height: 1;
}

.hotspot-delete-btn {
  width: 20px;
  height: 20px;
  min-width: 20px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid currentColor;
  background: rgba(255, 255, 255, 0.28);
  color: inherit;
  display: inline-grid;
  place-items: center;
  font-size: 0.8rem;
  line-height: 1;
}

.hotspot-delete-btn:hover {
  transform: none;
  background: rgba(255, 255, 255, 0.42);
}

.hotspot.compact .hotspot-label,
.hotspot.compact .hotspot-icon,
.model-hotspot.compact .hotspot-label,
.model-hotspot.compact .hotspot-icon {
  display: none;
}

.hotspot.compact:hover .hotspot-label,
.hotspot.compact:hover .hotspot-icon,
.hotspot.compact.hover-preview .hotspot-label,
.hotspot.compact.hover-preview .hotspot-icon,
.model-hotspot.compact:hover .hotspot-label,
.model-hotspot.compact:hover .hotspot-icon,
.model-hotspot.compact.hover-preview .hotspot-label,
.model-hotspot.compact.hover-preview .hotspot-icon {
  display: inline;
}

.hidden {
  display: none;
}

body.viewer-mode [data-editor-only] {
  display: none !important;
}

.hotspot-panel {
  align-self: start;
}

.hotspot-panel.hidden {
  display: none;
}

.settings-group {
  border: 1px solid rgba(151, 168, 185, 0.18);
  border-radius: 12px;
  background: #f5f8fb;
  box-shadow: var(--shadow-soft);
}

.settings-group[open] {
  padding-bottom: 0.25rem;
}

.settings-group summary {
  cursor: pointer;
  list-style: none;
  padding: 0.78rem 0.9rem;
  font-weight: 700;
  user-select: none;
}

.tree-context-menu {
  position: fixed;
  z-index: 60;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.5rem;
  border-radius: 12px;
  border: 1px solid rgba(151, 168, 185, 0.18);
  background: #f7f9fb;
  box-shadow: var(--shadow-floating);
}

.tree-context-menu.hidden {
  display: none;
}

.tree-context-menu button {
  width: 100%;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 0.62rem 0.72rem;
}

.tree-context-menu button:hover {
  background: rgba(103, 162, 192, 0.12);
  border-color: rgba(103, 162, 192, 0.22);
  transform: none;
}

.tree-context-menu .danger-item {
  color: #c73a55;
}

.settings-group summary::-webkit-details-marker {
  display: none;
}

.settings-group summary::after {
  content: "+";
  float: right;
  color: var(--muted);
}

.settings-group[open] summary::after {
  content: "−";
}

.settings-group-body {
  padding: 0 1rem 1rem;
}

.settings-modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 48, 71, 0.12);
  z-index: 900;
}

.settings-modal.hidden {
  display: none;
}

.settings-popup {
  position: fixed;
  top: 1.4rem;
  right: 1.4rem;
  width: min(420px, calc(100vw - 2rem));
  max-height: calc(100vh - 2.8rem);
  overflow: auto;
}

.button-stack {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.submenu-copy {
  margin-bottom: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
}

.panel-divider {
  height: 1px;
  margin: 0.8rem 0;
  background: var(--border);
}

.panel-header.compact {
  margin-bottom: 0.75rem;
}

.hotspot-modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 48, 71, 0.18);
  display: grid;
  place-items: center;
  padding: 2rem;
  z-index: 1000;
}

.hotspot-modal.hidden {
  display: none;
}

.analysis-modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 48, 71, 0.18);
  display: grid;
  place-items: center;
  padding: 2rem;
  z-index: 950;
}

.analysis-modal.hidden {
  display: none;
}

.analysis-popup {
  width: min(560px, calc(100vw - 2rem));
  max-height: calc(100vh - 3rem);
  overflow: auto;
}

.analysis-results-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1rem 0 1.25rem;
}

.analysis-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f8fafc;
}

.analysis-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
}

.analysis-item-label {
  font-weight: 600;
}

.analysis-item-coords {
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 900px) {
  .manufacturer-analysis-grid {
    grid-template-columns: 1fr;
  }

  .manufacturer-analysis-details {
    flex-direction: column;
    align-items: flex-start;
  }
}

.hotspot-window {
  position: fixed;
  top: 10vh;
  left: 15vw;
  width: min(720px, 70vw);
  height: min(520px, 70vh);
  min-width: 360px;
  min-height: 240px;
  background: #f7f9fb;
  border: 1px solid rgba(151, 168, 185, 0.18);
  border-radius: 14px;
  box-shadow: var(--shadow-floating);
  overflow: hidden;
}

.hotspot-window-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0.9rem 0.65rem;
  border-bottom: 1px solid var(--border);
  cursor: move;
  user-select: none;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
}

.hotspot-window-body {
  height: calc(100% - 78px);
  padding: 0.8rem;
  overflow: auto;
}

.hotspot-window-body iframe {
  width: 100%;
  height: 100%;
  min-height: 320px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.hotspot-window-body model-viewer {
  width: 100%;
  height: 100%;
  min-height: 320px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff, #edf3f7);
}

.hotspot-window-body pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

.hotspot-window-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 22px;
  height: 22px;
  cursor: nwse-resize;
  background:
    linear-gradient(135deg, transparent 0 45%, rgba(20, 48, 71, 0.25) 45% 55%, transparent 55% 100%);
}

@media (max-width: 1320px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }
}
