/* ==========================================================================
   SOLID3D CAD - Main Application Styling
   Professional Parametric CAD Dark Theme (Inspired by SolidCraft & Fusion 360)
   License: MIT
   ========================================================================== */

:root {
  --bg-app: #323232;
  --bg-topbar: #1e1e1e;
  --bg-ribbon: #2b2b2b;
  --bg-panel: #252526;
  --bg-panel-border: #3f3f3f;
  --bg-hover: #383838;
  --bg-active: #424242;
  --bg-accent: #1473e6;
  --bg-accent-hover: #0d66d0;
  --bg-timeline: #1e1e1e;
  
  --text-main: #e4e4e4;
  --text-muted: #9e9e9e;
  --text-dim: #767676;
  --text-accent: #60a5fa;
  
  --border-subtle: #333333;
  --border-strong: #3f3f3f;
  
  --color-origin-x: #e04f5f;
  --color-origin-y: #4ec95a;
  --color-origin-z: #3488f7;
  
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-family);
  font-size: 12px;
  color: var(--text-main);
  background-color: var(--bg-app);
}

/* App Shell Layout */
#app-container {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  position: relative;
}

/* 1. Header / Top Navigation Bar (Excel / Modern Dark Studio Theme) */
#top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 36px;
  background: linear-gradient(180deg, #1c1f26 0%, #15181e 100%);
  border-bottom: 1px solid #282d37;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  padding: 0 6px 0 10px;
  z-index: 100;
  user-select: none;
}

.top-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 13px;
  color: #ffffff;
  letter-spacing: 0.5px;
  margin-right: 4px;
}

.app-brand svg {
  width: 18px;
  height: 18px;
  fill: var(--bg-accent);
}

.app-brand .mf-logo-prefix {
  color: #3b82f6;
  font-weight: 800;
}

.app-brand .mf-logo-suffix {
  color: #ffffff;
}

.main-menu {
  display: flex;
  list-style: none;
  gap: 2px;
}

.menu-item {
  position: relative;
}

.menu-item > span {
  display: inline-block;
  padding: 4px 9px;
  border-radius: 4px;
  cursor: pointer;
  color: #c9d1d9;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.12s ease;
}

.menu-item:hover > span {
  background-color: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.menu-item:active > span {
  background-color: #252a35;
  color: #79c0ff;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: #1a1d24;
  border: 1px solid #363d4d;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65);
  min-width: 215px;
  padding: 4px 0;
  z-index: 1000;
  list-style: none;
  animation: modalPopIn 0.1s ease-out;
}

.menu-item:hover .dropdown-menu {
  display: block;
}

.dropdown-menu li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 11.5px;
  color: #c9d1d9;
  transition: background-color 0.12s ease;
}

.dropdown-menu li:hover {
  background-color: #007acc;
  color: #ffffff;
}

.dropdown-menu li.divider {
  height: 1px;
  background-color: #2a303e;
  margin: 4px 0;
  padding: 0;
}

.dropdown-menu li .hotkey {
  color: #8b949e;
  font-size: 10.5px;
  margin-left: 12px;
}

.dropdown-menu li:hover .hotkey {
  color: #e0e7ff;
}

.top-center {
  display: flex;
  align-items: center;
  font-size: 11.5px;
  color: #8b92a0;
  gap: 6px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.07);
  padding: 3px 12px;
  border-radius: 14px;
}

.doc-name {
  color: #f0f3f6;
  font-weight: 600;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-icon-top {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #c9d1d9;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  height: 26px;
  font-weight: 500;
  transition: all 0.12s ease;
}

.btn-icon-top:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.top-bar-divider {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 4px;
}

/* Excel-Style Window Controls (Top Right) */
.word-window-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 28px;
  margin-left: 2px;
}

.word-win-btn {
  width: 32px;
  height: 26px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #9aa2b0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
  padding: 0;
}

.word-win-btn svg {
  display: block;
  flex-shrink: 0;
}

.word-win-btn:hover {
  background-color: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.word-win-btn:active {
  background-color: rgba(255, 255, 255, 0.15);
}

.word-win-btn.close-btn {
  color: #9aa2b0;
}

.word-win-btn.close-btn:hover {
  background-color: #e04343 !important;
  border-color: #dc2626 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(224, 67, 67, 0.45);
}

/* 2. Ribbon Workspaces & Tabs */
#ribbon-container {
  background-color: var(--bg-ribbon);
  border-bottom: 1px solid #282c35;
  display: flex;
  flex-direction: column;
  z-index: 90;
  transition: all 0.15s ease;
}

#ribbon-container.ribbon-collapsed .ribbon-content {
  display: none !important;
}

.ribbon-tabs {
  display: flex;
  gap: 1px;
  padding: 2px 8px 0 8px;
  background-color: #17191e;
  border-bottom: 1px solid #282c35;
}

.tab-btn {
  padding: 6px 14px;
  font-weight: 600;
  color: #8b949e;
  background: transparent;
  border: none;
  cursor: pointer;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  font-size: 11px;
  letter-spacing: 0.5px;
  transition: all 0.15s ease;
  border-top: 2px solid transparent;
}

.tab-btn:hover {
  color: #e1e4ea;
  background-color: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  color: #ffffff;
  background-color: #232730;
  border-top: 2px solid #38a5ff;
}

.tab-btn.sketch-mode {
  background-color: #17422a;
  color: #63e29c;
}

.tab-btn.sketch-mode.active {
  background-color: #1e5235;
  border-bottom-color: #4cd988;
}

/* Ribbon Content Panels */
.ribbon-content {
  display: none;
  height: 82px;
  padding: 4px 10px;
  align-items: stretch;
  gap: 8px;
  overflow-x: auto;
}

.ribbon-content.active {
  display: flex;
}

.ribbon-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--border-subtle);
  padding-right: 8px;
  min-width: max-content;
}

.ribbon-panel:last-child {
  border-right: none;
}

.panel-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.ribbon-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-main);
  padding: 4px 6px;
  min-width: 48px;
  height: 54px;
  border-radius: 4px;
  cursor: pointer;
  gap: 4px;
  transition: background 0.15s;
}

.ribbon-btn:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-subtle);
}

.ribbon-btn.active {
  background-color: var(--bg-active);
  border-color: var(--bg-accent);
}

.ribbon-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.ribbon-btn span {
  font-size: 10px;
  white-space: nowrap;
}

.panel-title {
  text-align: center;
  font-size: 9px;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  padding-top: 2px;
}

/* Finish Sketch Button Special Glow */
.btn-finish-sketch {
  background: #1c5432 !important;
  color: #70ffad !important;
  border: 1px solid #2ea44f !important;
  font-weight: 600;
}

.btn-finish-sketch:hover {
  background: #256d41 !important;
}

/* 3. Main Workspace (Canvas + Browser Tree + Command Dialog) */
#main-workspace {
  display: flex;
  flex: 1;
  position: relative;
  overflow: hidden;
  background-color: #121315;
}

/* Left Outliner / Model Tree */
#model-tree-panel {
  width: 250px;
  background-color: rgba(32, 34, 38, 0.95);
  backdrop-filter: blur(8px);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: width 0.2s ease;
}

#model-tree-panel.collapsed {
  width: 32px;
}

.tree-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 600;
  color: var(--text-muted);
}

.tree-content {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.tree-node {
  display: flex;
  align-items: center;
  padding: 4px 10px;
  cursor: pointer;
  color: var(--text-main);
  gap: 6px;
}

.tree-node:hover {
  background-color: var(--bg-hover);
}

.tree-node.selected {
  background-color: rgba(0, 122, 204, 0.3);
  color: #ffffff;
  border-left: 2px solid var(--bg-accent);
}

.tree-node .node-expander {
  width: 14px;
  text-align: center;
  color: var(--text-dim);
}

.tree-node .node-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.tree-node .node-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-node .node-delete {
  opacity: 0;
  cursor: pointer;
  font-size: 11px;
  padding: 0 4px;
  margin-right: 2px;
  transition: opacity 0.2s, transform 0.15s, color 0.15s;
  color: var(--text-dim);
}

.tree-node:hover .node-delete {
  opacity: 0.65;
}

.tree-node .node-delete:hover {
  opacity: 1 !important;
  transform: scale(1.25);
  color: #f85149;
}

.tree-node .node-edit {
  opacity: 0;
  cursor: pointer;
  font-size: 11px;
  padding: 0 4px;
  margin-right: 2px;
  transition: opacity 0.2s, transform 0.15s, color 0.15s;
  color: var(--text-dim);
}

.tree-node:hover .node-edit {
  opacity: 0.65;
}

.tree-node .node-edit:hover {
  opacity: 1 !important;
  transform: scale(1.25);
  color: #f85149;
  color: #4fc1ff;
}

.tree-node.active-sketch-node {
  background-color: rgba(245, 238, 56, 0.15);
  border-left: 2px solid #f5ee38;
}

.tree-node .node-visibility {
  width: 16px;
  height: 16px;
  color: var(--text-dim);
  opacity: 0.5;
  cursor: pointer;
}

.tree-node:hover .node-visibility,
.tree-node .node-visibility.visible {
  opacity: 1;
  color: var(--text-muted);
}

.tree-children {
  padding-left: 18px;
}

/* 4. 3D WebGL Viewport */
#viewport-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  outline: none;
}

#canvas3d {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* 2D Sketch Overlay Canvas */
#sketch-overlay-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  display: none;
}

#sketch-overlay-canvas.active {
  display: block;
  pointer-events: auto;
}

/* Viewport HUD & Overlays */
.viewport-hud {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
  z-index: 30;
}

.hud-badge {
  background: rgba(24, 25, 28, 0.75);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border-subtle);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-muted);
  pointer-events: auto;
}

.hud-badge.sketch-status {
  color: #63e29c;
  border-color: #2ea44f;
  font-weight: 600;
  display: none;
}

/* Floor Mode Switcher Widget (Fix Floor vs Free Floor) */
.floor-mode-switch {
  display: inline-flex;
  align-items: center;
  background: rgba(22, 24, 28, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-strong, #3a3f47);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
  pointer-events: auto;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.floor-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-muted, #8b949e);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  user-select: none;
}

.floor-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.floor-btn.active {
  background: #007acc;
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 122, 204, 0.4);
}

.floor-btn-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.floor-btn.active .floor-btn-indicator {
  background: #38ef7d;
  box-shadow: 0 0 6px #38ef7d;
}

.floor-btn svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

/* Viewport Controls (Bottom-Center Floating Tools) */
.viewport-toolbar {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  background: rgba(24, 25, 28, 0.85);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 2px 4px;
  gap: 4px;
  z-index: 30;
}

.v-tool-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.v-tool-btn:hover {
  background-color: var(--bg-hover);
  color: #ffffff;
}

.v-tool-btn.active {
  background-color: var(--bg-accent);
  color: #ffffff;
}

.v-tool-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* 5. Right Docked / Floating Command Dialog Panel */
#command-dialog-panel {
  position: absolute;
  top: 64px; /* Shifted down to clear .viewport-shading-bar */
  right: 16px;
  width: 320px;
  max-height: calc(100% - 80px);
  background: rgba(24, 27, 34, 0.96);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.65), 0 0 0 1px rgba(255,255,255,0.06);
  display: none;
  flex-direction: column;
  z-index: 120;
  overflow: hidden;
  user-select: none;
}

#command-dialog-panel.active {
  display: flex;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #191b1e;
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 600;
  font-size: 13px;
  cursor: grab;
  user-select: none;
}

.dialog-header:active {
  cursor: grabbing;
}

.dialog-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #f0f6fc;
}

.dialog-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-new {
  background: #238636;
  color: #ffffff;
}

.badge-edit {
  background: #0284c7;
  color: #ffffff;
}

.dialog-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}

.dialog-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.dialog-body {
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 240px);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  justify-content: space-between;
}

.form-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-input {
  flex: 1;
  background-color: #17181b;
  border: 1px solid var(--border-strong);
  color: #ffffff;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 12px;
  outline: none;
  font-family: var(--font-mono);
}

.form-input:focus {
  border-color: var(--bg-accent);
  box-shadow: 0 0 0 1px var(--bg-accent);
}

.form-slider-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.form-slider {
  flex: 1;
  -webkit-appearance: none;
  height: 4px;
  border-radius: 2px;
  background: #30363d;
  outline: none;
  accent-color: #38bdf8;
  cursor: pointer;
}

.form-slider-val {
  font-size: 11px;
  color: #38bdf8;
  font-weight: 600;
  min-width: 44px;
  text-align: right;
  font-family: var(--font-mono);
}

.form-quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.chip-preset {
  background: #21262d;
  border: 1px solid #30363d;
  color: #c9d1d9;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
}

.chip-preset:hover {
  background: #30363d;
  color: #58a6ff;
  border-color: #58a6ff;
}

.form-select {
  flex: 1;
  background-color: #17181b;
  border: 1px solid var(--border-strong);
  color: #ffffff;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 12px;
  outline: none;
}

.form-select:focus {
  border-color: var(--bg-accent);
}

.btn-select-target {
  background-color: #1a2733;
  border: 1px dashed var(--bg-accent);
  color: var(--text-accent);
  padding: 8px;
  border-radius: 4px;
  text-align: center;
  cursor: pointer;
  font-weight: 500;
}

.btn-select-target.selected {
  background-color: #1e3826;
  border: 1px solid #2ea44f;
  color: #63e29c;
}

.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border-subtle);
  background: #191b1e;
}

.btn-dialog {
  padding: 6px 16px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.btn-dialog-cancel {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-subtle);
}

.btn-dialog-cancel:hover {
  background: var(--bg-hover);
  color: #ffffff;
}

.btn-dialog-ok {
  background: var(--bg-accent);
  color: #ffffff;
  font-weight: 600;
}

.btn-dialog-ok:hover {
  background: var(--bg-accent-hover);
}

.btn-dialog-insert {
  background: #238636 !important;
  color: #ffffff !important;
  font-weight: 600;
  border: 1px solid #2ea44f !important;
}

.btn-dialog-insert:hover {
  background: #2ea44f !important;
}

.btn-dialog-update {
  background: #0284c7 !important;
  color: #ffffff !important;
  font-weight: 600;
  border: 1px solid #38bdf8 !important;
}

.btn-dialog-update:hover {
  background: #0369a1 !important;
}

/* 3D Model Placement Floating HUD */
#cad-placement-hud {
  position: absolute;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(8px);
  border: 1px solid #38bdf8;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6), 0 0 16px rgba(56, 189, 248, 0.35);
  color: #f1f5f9;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  display: none;
  align-items: center;
  gap: 10px;
  z-index: 150;
  pointer-events: none;
  user-select: none;
  letter-spacing: 0.3px;
}

#cad-placement-hud.active {
  display: flex;
}

#cad-placement-hud .hud-icon {
  font-size: 14px;
}

#cad-placement-hud .hud-axis-tag {
  background: #0284c7;
  color: #ffffff;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}

/* 6. Bottom Parametric Timeline */
#timeline-container {
  height: 52px;
  background-color: var(--bg-timeline);
  border-top: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 12px;
  z-index: 70;
}

.timeline-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  border-right: 1px solid var(--border-subtle);
  padding-right: 8px;
}

.timeline-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timeline-btn:hover {
  background: var(--bg-hover);
  color: #ffffff;
}

.timeline-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.timeline-track {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  overflow-x: auto;
  padding: 4px 0;
  position: relative;
}

.timeline-step {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: #272a30;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 11px;
  color: var(--text-main);
  white-space: nowrap;
  transition: all 0.15s ease;
}

.timeline-step:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-strong);
}

.timeline-step.active {
  border-color: var(--bg-accent);
  background-color: #233446;
}

.timeline-step.suppressed {
  opacity: 0.4;
  text-decoration: line-through;
}

.timeline-step .step-icon {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
}

.timeline-step .step-icon svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.timeline-rollback-bar {
  width: 4px;
  height: 32px;
  background-color: #ff9800;
  border-radius: 2px;
  cursor: ew-resize;
  position: relative;
  margin: 0 4px;
}

.timeline-rollback-bar::after {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  width: 12px;
  height: 8px;
  background-color: #ff9800;
  border-radius: 2px;
}

/* 7. Bottom Status Bar */
#status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 24px;
  background-color: var(--bg-topbar);
  border-top: 1px solid var(--border-subtle);
  padding: 0 12px;
  font-size: 11px;
  color: var(--text-muted);
  z-index: 80;
}

.status-left, .status-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-item strong {
  color: var(--text-main);
}

/* Context Menu */
.context-menu {
  display: none;
  position: fixed;
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  border-radius: 4px;
  padding: 4px 0;
  z-index: 2000;
  list-style: none;
  min-width: 160px;
}

.context-menu li {
  padding: 6px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}

.context-menu li:hover {
  background-color: var(--bg-accent);
  color: #ffffff;
}

.context-menu li.divider {
  height: 1px;
  background-color: var(--border-subtle);
  margin: 4px 0;
  padding: 0;
}

/* ==========================================================================
   INTERACTIVE 3D GIZMO & DRAG-DROP STYLING
   ========================================================================== */

.gizmo-floating-toolbar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(24, 25, 28, 0.90);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 3px 6px;
  z-index: 65;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.gizmo-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.gizmo-btn:hover {
  background-color: var(--bg-hover);
  color: #ffffff;
}

.gizmo-btn.active {
  background-color: var(--bg-accent);
  color: #ffffff;
  border-color: var(--bg-accent);
}

.gizmo-btn.gizmo-btn-delete:hover {
  background-color: rgba(248, 81, 73, 0.22);
  color: #f85149;
  border-color: rgba(248, 81, 73, 0.45);
}

.gizmo-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* File Drag & Drop Overlay */
.viewport-dropzone-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(18, 19, 21, 0.85);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.dropzone-box {
  border: 2px dashed var(--bg-accent);
  background: rgba(0, 122, 204, 0.08);
  border-radius: 12px;
  padding: 40px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: pulseBorder 1.5s infinite alternate;
}

@keyframes pulseBorder {
  from { border-color: var(--bg-accent); box-shadow: 0 0 10px rgba(0, 122, 204, 0.2); }
  to { border-color: #4fc1ff; box-shadow: 0 0 25px rgba(79, 193, 255, 0.5); }
}

/* ==========================================================================
   RIGHT DOCKED MATERIAL & APPEARANCE STUDIO SIDEBAR (#material-studio-sidebar)
   ========================================================================== */

.mat-sidebar-toggle-pill {
  position: absolute;
  bottom: 14px;
  right: 14px;
  z-index: 62;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  background: rgba(24, 26, 31, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(79, 193, 255, 0.45);
  color: #4fc1ff;
  font-size: 11px;
  font-weight: 600;
  padding: 0 11px;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: all 0.18s ease;
  white-space: nowrap;
}

.mat-sidebar-toggle-pill svg {
  width: 14px !important;
  height: 14px !important;
  flex-shrink: 0;
  fill: currentColor;
}

.mat-sidebar-toggle-pill:hover,
.mat-sidebar-toggle-pill.active {
  background: rgba(0, 122, 204, 0.25);
  border-color: #4fc1ff;
  color: #ffffff;
}

.material-sidebar {
  width: 356px;
  min-width: 356px;
  max-width: 356px;
  height: 100%;
  background: linear-gradient(180deg, #1b1d22 0%, #16181c 100%);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 58;
  user-select: none;
  transition: width 0.22s cubic-bezier(0.16, 1, 0.3, 1), min-width 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  box-shadow: -6px 0 20px rgba(0, 0, 0, 0.35);
}

.material-sidebar.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  border-left: none;
  box-shadow: none;
}

/* 1. Sidebar Header */
.mat-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: linear-gradient(90deg, rgba(0, 122, 204, 0.16) 0%, rgba(28, 30, 36, 0.95) 100%);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.mat-sidebar-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #ffffff;
}

.mat-sidebar-header-actions,
.mat-sidebar-actions {
  display: flex;
  align-items: center;
  gap: 3px;
}

.mat-icon-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mat-icon-btn:hover {
  background: var(--bg-hover);
  color: #ffffff;
  border-color: var(--border-strong);
}

/* 2. Target Object & Sub-Part Selector */
.mat-target-section {
  padding: 9px 12px;
  background: rgba(18, 19, 23, 0.78);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex-shrink: 0;
}

.mat-section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #9cdcfe;
}

.mat-pick-mode-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mat-pick-mode-btn.active {
  background: rgba(0, 122, 204, 0.22);
  border-color: #4fc1ff;
  color: #4fc1ff;
}

.mat-pick-mode-btn:hover {
  background: var(--bg-accent);
  color: #ffffff;
}

.mat-target-selectors {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mat-select-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mat-select-row label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  width: 82px;
}

.mat-select-input {
  flex: 1;
  min-width: 0;
  background-color: #121316;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  color: var(--text-main);
  font-size: 11px;
  padding: 4px 7px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.mat-select-input:focus {
  border-color: var(--bg-accent);
}

/* 3. Live 3D PBR Sphere Preview Hero */
.mat-preview-hero {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: radial-gradient(circle at 22% 50%, rgba(0, 122, 204, 0.18), rgba(16, 17, 21, 0.95) 70%);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.mat-sphere-box {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 8px;
  background: radial-gradient(circle at 35% 30%, #2b303c 0%, #121418 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6);
}

#mat-preview-canvas {
  width: 96px !important;
  height: 96px !important;
  display: block;
}

.mat-sphere-hint {
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(0, 0, 0, 0.58);
  padding: 1px 6px;
  border-radius: 3px;
  pointer-events: none;
  white-space: nowrap;
}

.mat-hero-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.mat-name-editable {
  width: 100%;
  background: rgba(14, 15, 18, 0.88);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  outline: none;
}

.mat-name-editable:focus {
  border-color: var(--bg-accent);
}

.mat-meta-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.mat-badge-cat,
.mat-badge-phys,
.mat-badge-mass {
  font-size: 10px;
  font-weight: 600;
  border-radius: 3px;
  padding: 2px 6px;
  white-space: nowrap;
}

.mat-badge-cat {
  background: rgba(0, 122, 204, 0.2);
  border: 1px solid rgba(79, 193, 255, 0.35);
  color: #4fc1ff;
}

.mat-badge-phys {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.mat-badge-mass {
  background: rgba(46, 160, 67, 0.16);
  border: 1px solid rgba(86, 211, 100, 0.35);
  color: #56d364;
}

.mat-quick-toolbar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.mat-qbtn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  font-size: 10px;
  font-weight: 600;
  padding: 4px 4px;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.mat-qbtn:hover {
  background: var(--bg-accent);
  border-color: #4fc1ff;
  color: #ffffff;
}

/* 4. Sidebar Sub-Tabs Navigation */
.mat-sidebar-tabs {
  display: flex;
  background: #141619;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.mat-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 8px 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  white-space: nowrap;
}

.mat-tab-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.03);
}

.mat-tab-btn.active {
  color: #4fc1ff;
  border-bottom-color: #4fc1ff;
  background: rgba(0, 122, 204, 0.12);
}

/* 5. Scrollable Sidebar Body & Tab Panels */
.mat-sidebar-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 12px 18px 12px;
}

.mat-tab-panel {
  display: none;
  flex-direction: column;
  gap: 10px;
}

.mat-tab-panel.active {
  display: flex;
}

.mat-group-box {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mat-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #9cdcfe;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 5px;
}

/* Color Picker & Swatches */
.mat-color-picker-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mat-color-well {
  width: 34px;
  height: 28px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.mat-hex-input {
  flex: 1;
  min-width: 0;
  background: #121316;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 5px 8px;
  text-transform: uppercase;
}

.mat-swatches-bar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.mat-color-swatch {
  height: 20px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.mat-color-swatch:hover {
  transform: scale(1.12);
  border-color: #ffffff;
}

/* Range Sliders */
.mat-param-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mat-param-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-main);
}

.mat-param-val {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: #4fc1ff;
  background: rgba(0, 122, 204, 0.16);
  padding: 1px 5px;
  border-radius: 3px;
}

.mat-range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  background: #101216;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.mat-range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #4fc1ff;
  border: 2px solid #ffffff;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.mat-ior-presets {
  display: flex;
  gap: 4px;
  margin-top: 3px;
}

.mat-ior-presets span {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 9.5px;
  padding: 3px 2px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.mat-ior-presets span:hover {
  background: rgba(0, 122, 204, 0.2);
  color: #ffffff;
  border-color: #4fc1ff;
}

.mat-checkbox-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-main);
}

.mat-checkbox-row label {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

/* Tab 2: Material Library Search, Filter & Cards */
.mat-lib-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 4px;
}

.mat-search-input {
  width: 100%;
  background: #121316;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  color: var(--text-main);
  font-size: 11px;
  padding: 6px 10px;
  outline: none;
}

.mat-search-input:focus {
  border-color: var(--bg-accent);
}

.mat-cat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.mat-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 9px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mat-pill:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.mat-pill.active {
  background: var(--bg-accent);
  border-color: #4fc1ff;
  color: #ffffff;
}

.mat-library-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}

.mat-lib-card {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 7px 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mat-lib-card:hover {
  background: rgba(0, 122, 204, 0.14);
  border-color: rgba(79, 193, 255, 0.5);
  transform: translateY(-1px);
}

.mat-lib-card.active {
  background: rgba(0, 122, 204, 0.22);
  border-color: #4fc1ff;
  box-shadow: 0 0 0 1px rgba(79, 193, 255, 0.35);
}

.mat-lib-sphere {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.mat-lib-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mat-lib-name {
  font-size: 11px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mat-lib-sub {
  font-size: 9.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Tab 3: Physical & Mechanical Engineering Readouts */
.mat-phys-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--text-main);
}

.mat-num-input {
  width: 95px;
  background: #121316;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  color: #4fc1ff;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 6px;
  text-align: right;
}

.mat-mass-report {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mass-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}

.mass-row strong {
  font-family: var(--font-mono);
  color: #ffffff;
}

.mass-row.highlight strong {
  color: #56d364;
  font-size: 12px;
}

/* ==========================================================================
   STAGE 2: 3D VIEWPORT MODEL LOADING OVERLAY (#cad-model-loading-overlay)
   ========================================================================== */
.cad-model-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(15, 23, 42, 0.88) 0%, rgba(9, 12, 19, 0.96) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 1;
  visibility: visible;
  transition: opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1), transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.32s;
  pointer-events: all;
  user-select: none;
}

.cad-model-loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(1.02);
}

.cad-loader-card {
  position: relative;
  background: rgba(24, 28, 38, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 30px 36px 26px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65), 0 0 1px 1px rgba(255, 255, 255, 0.08) inset;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 440px;
  width: 90%;
  backdrop-filter: blur(16px);
}

/* Stage Badge */
.cad-loader-stage-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(8, 145, 178, 0.15);
  border: 1px solid rgba(34, 211, 238, 0.35);
  color: #22d3ee;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 20px;
}

.cad-loader-stage-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22d3ee;
  box-shadow: 0 0 8px #22d3ee;
  animation: cadPulseDot 1.4s ease-in-out infinite alternate;
}

@keyframes cadPulseDot {
  0% { transform: scale(0.85); opacity: 0.5; }
  100% { transform: scale(1.3); opacity: 1; }
}

/* 3D Wireframe Rotating Isometric Cube Spinner */
.cad-cube-spinner-container {
  width: 64px;
  height: 64px;
  perspective: 400px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cad-cube-spinner {
  width: 36px;
  height: 36px;
  position: relative;
  transform-style: preserve-3d;
  animation: cadRotateCube 4.5s linear infinite;
}

.cad-cube-face {
  position: absolute;
  width: 36px;
  height: 36px;
  background: rgba(8, 145, 178, 0.12);
  border: 1.5px solid #22d3ee;
  box-shadow: inset 0 0 8px rgba(34, 211, 238, 0.2), 0 0 6px rgba(34, 211, 238, 0.3);
}

.cad-cube-face.front  { transform: rotateY(0deg) translateZ(18px); }
.cad-cube-face.back   { transform: rotateY(180deg) translateZ(18px); }
.cad-cube-face.right  { transform: rotateY(90deg) translateZ(18px); }
.cad-cube-face.left   { transform: rotateY(-90deg) translateZ(18px); }
.cad-cube-face.top    { transform: rotateX(90deg) translateZ(18px); }
.cad-cube-face.bottom { transform: rotateX(-90deg) translateZ(18px); }

@keyframes cadRotateCube {
  0% { transform: rotateX(-22deg) rotateY(0deg); }
  100% { transform: rotateX(-22deg) rotateY(360deg); }
}

/* Model File Name & Badge */
.cad-loader-model-name {
  color: #f1f5f9;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 5px;
  max-width: 380px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.cad-loader-model-type {
  display: inline-block;
  color: #94a3b8;
  font-size: 11.5px;
  font-weight: 500;
  margin-bottom: 18px;
}

/* Progress Track & Bar */
.cad-loader-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
  margin-bottom: 10px;
}

.cad-loader-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0284c7, #06b6d4, #22d3ee);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.7);
  transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Meta Information */
.cad-loader-meta {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 16px;
}

.cad-loader-status-text {
  font-size: 12px;
  color: #cbd5e1;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 290px;
  text-align: left;
}

.cad-loader-pct {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  color: #22d3ee;
  font-size: 12px;
}

/* Stage Substeps list */
.cad-loader-steps {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 10.5px;
  color: #64748b;
}

.cad-loader-step-item {
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.cad-loader-step-item.active {
  color: #38bdf8;
  font-weight: 600;
}

.cad-loader-step-item.done {
  color: #10b981;
}

.cad-loader-step-bullet {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #475569;
  transition: all 0.2s ease;
}

.cad-loader-step-item.active .cad-loader-step-bullet {
  background: #38bdf8;
  box-shadow: 0 0 6px #38bdf8;
  transform: scale(1.2);
}

.cad-loader-step-item.done .cad-loader-step-bullet {
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

/* Top Bar Quick Access Tools (Undo / Redo / Save) */
.quick-access-tools {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 0 4px;
}
.btn-quick-tool {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #94a3b8;
  width: 26px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  outline: none;
}
.btn-quick-tool:hover:not(.disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  color: #f1f5f9;
}
.btn-quick-tool:active:not(.disabled) {
  transform: scale(0.92);
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
}
.btn-quick-tool.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}
