:root {
  --bg-app: #f3f5f9;
  --bg-surface: #ffffff;
  --bg-sidebar: #0f172a;
  --bg-sidebar-hover: #1e293b;
  --bg-sidebar-active: #1d4ed8;
  --border-subtle: #e2e8f0;
  --border-sidebar: #1e293b;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-sidebar: #e2e8f0;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 6px 20px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  color: var(--text-primary);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

/* App Shell */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 310px;
  min-width: 280px;
  max-width: 340px;
  background: var(--bg-sidebar);
  color: var(--text-sidebar);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-sidebar);
  flex-shrink: 0;
}

.sidebar-header {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border-sidebar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.brand-title {
  font-size: 15px;
  font-weight: 600;
  color: #f8fafc;
  line-height: 1.25;
}

.brand-sub {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

.icon-btn {
  background: transparent;
  border: 1px solid #334155;
  color: #cbd5e1;
  border-radius: 7px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.icon-btn:hover {
  background: #1e293b;
  color: #fff;
  border-color: #475569;
}

/* Search & Filter */
.sidebar-controls {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border-sidebar);
}

.search-input {
  width: 100%;
  background: #1e293b;
  border: 1px solid #334155;
  color: #f1f5f9;
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

.search-input::placeholder {
  color: #64748b;
}

.search-input:focus {
  border-color: #3b82f6;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.filter-pill {
  border: 1px solid #334155;
  background: transparent;
  color: #94a3b8;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-pill:hover {
  color: #e2e8f0;
  border-color: #475569;
}

.filter-pill.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

/* File list */
.file-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px 16px;
}

.file-list::-webkit-scrollbar {
  width: 6px;
}
.file-list::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 3px;
}

.file-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  margin-bottom: 4px;
  transition: background 0.12s;
  border: 1px solid transparent;
}

.file-item:hover {
  background: var(--bg-sidebar-hover);
}

.file-item.active {
  background: rgba(37, 99, 235, 0.22);
  border-color: rgba(59, 130, 246, 0.55);
}

.file-item.is-unsupported {
  opacity: 0.78;
}

.file-ext-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 5px;
  min-width: 46px;
  text-align: center;
  flex-shrink: 0;
  margin-top: 1px;
  letter-spacing: 0.3px;
}

.tag-model3d { background: rgba(59, 130, 246, 0.2); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.35); }
.tag-cad2d   { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.35); }
.tag-pdf     { background: rgba(244, 63, 94, 0.2);  color: #fda4af; border: 1px solid rgba(244, 63, 94, 0.35); }
.tag-image   { background: rgba(168, 85, 247, 0.2); color: #d8b4fe; border: 1px solid rgba(168, 85, 247, 0.35); }
.tag-unsupported { background: rgba(148, 163, 184, 0.16); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.28); }
.tag-encrypted   { background: rgba(239, 68, 68, 0.22); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.4); }

.file-meta {
  min-width: 0;
  flex: 1;
}

.file-name {
  font-size: 13px;
  font-weight: 500;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
}

.file-sub {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-footer {
  padding: 11px 14px;
  border-top: 1px solid var(--border-sidebar);
  font-size: 11px;
  color: #64748b;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.empty-list {
  text-align: center;
  color: #64748b;
  font-size: 13px;
  padding: 28px 12px;
}

/* Main Content */
.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Dashboard */
.dashboard {
  flex: 1;
  overflow-y: auto;
  padding: 28px 34px 44px;
}

.dashboard-inner {
  max-width: 1120px;
  margin: 0 auto;
}

.hero-card {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 26px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  box-shadow: var(--shadow-md);
}

.hero-card h1 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 600;
}

.hero-card p {
  margin: 0;
  font-size: 13.5px;
  color: #cbd5e1;
  line-height: 1.6;
}

.hero-path {
  margin-top: 12px;
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.12);
  padding: 4px 10px;
  border-radius: 6px;
  color: #e2e8f0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  margin-top: 6px;
  color: var(--text-primary);
}

.stat-value.ok { color: #059669; }
.stat-value.warn { color: #d97706; }

.section-title {
  margin: 28px 0 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 12px;
}

.drawing-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}

.drawing-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #93c5fd;
}

.drawing-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.badge-light {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

.badge-model3d     { background: #dbeafe; color: #1d4ed8; }
.badge-cad2d       { background: #d1fae5; color: #047857; }
.badge-pdf         { background: #ffe4e6; color: #be123c; }
.badge-image       { background: #f3e8ff; color: #7e22ce; }
.badge-unsupported { background: #f1f5f9; color: #475569; }
.badge-encrypted   { background: #fee2e2; color: #b91c1c; }

.drawing-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-all;
  line-height: 1.4;
}

.drawing-card-info {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
}

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

.format-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

.format-card h3 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.format-card .engine-chip {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 6px;
}

.ext-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.ext-chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 600;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #334155;
  padding: 2px 7px;
  border-radius: 5px;
}

.format-card p {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.alert-banner {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 13.5px;
}

/* Viewer Page */
.viewer-topbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.viewer-file-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.viewer-filename {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 360px;
}

.viewer-submeta {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.viewer-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #1e293b;
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #94a3b8;
}

.btn.active {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-ai-soon {
  background: #f8fafc;
  border: 1px dashed #94a3b8;
  color: #64748b;
  cursor: not-allowed;
}

.toolbar-sep {
  width: 1px;
  height: 20px;
  background: #e2e8f0;
  margin: 0 2px;
}

.page-indicator {
  font-size: 12.5px;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.page-input {
  width: 46px;
  text-align: center;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 3px 4px;
  font-size: 12.5px;
}

/* Viewport Workspace */
.viewer-body {
  flex: 1;
  min-height: 0;
  display: flex;
  position: relative;
  overflow: hidden;
  background: #e9edf4;
}

.viewport-stage {
  flex: 1;
  min-width: 0;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* Loading overlay */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(248, 250, 252, 0.88);
  backdrop-filter: blur(3px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 20;
  color: var(--text-primary);
  font-size: 14px;
}

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

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid #cbd5e1;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

/* 3D Viewer HUD */
#viewer3d-canvas {
  width: 100%;
  height: 100%;
  position: relative;
}

.viewport-hud-bar {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 12px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap-reverse;
  gap: 8px;
  z-index: 10;
  pointer-events: none;
}

.viewport-hud-bar .hud-pill,
.viewport-hud-bar .hud-hint {
  position: static;
  flex-wrap: wrap;
}

.hud-pill {
  position: absolute;
  left: 14px;
  bottom: 14px;
  background: rgba(15, 23, 42, 0.78);
  color: #f1f5f9;
  font-size: 12px;
  padding: 6px 11px;
  border-radius: 8px;
  backdrop-filter: blur(4px);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px 12px;
  pointer-events: none;
}

.hud-hint {
  position: absolute;
  right: 14px;
  bottom: 14px;
  background: rgba(15, 23, 42, 0.68);
  color: #cbd5e1;
  font-size: 11.5px;
  padding: 5px 10px;
  border-radius: 7px;
  z-index: 10;
  pointer-events: none;
}

/* 2D CAD Viewer */
.cad2d-stage {
  width: 100%;
  height: 100%;
  background: #181f29;
  position: relative;
  overflow: hidden;
}

.cad2d-stage.theme-light {
  background: #ffffff;
}

.cad2d-stage svg {
  width: 100%;
  height: 100%;
  display: block;
}

.info-drawer {
  width: 310px;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  overflow-y: auto;
  padding: 16px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.info-drawer.collapsed {
  display: none;
}

.drawer-section h4 {
  margin: 0 0 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.kv-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 12px;
  font-size: 12.5px;
}

.kv-key { color: var(--text-secondary); }
.kv-val { color: var(--text-primary); font-weight: 500; text-align: right; }

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.mini-tag {
  font-size: 11.5px;
  background: #f1f5f9;
  color: #334155;
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid #e2e8f0;
}

.text-extract-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.text-extract-list li {
  font-size: 12.5px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 5px 8px;
  border-radius: 6px;
  color: #0f172a;
  word-break: break-word;
}

/* PDF Viewer */
.pdf-stage {
  width: 100%;
  height: 100%;
  overflow: auto;
  background: #525659;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}

#pdf-canvas {
  background: #fff;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  display: block;
}

/* Image Viewer */
.image-stage {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  user-select: none;
}

.image-stage:active {
  cursor: grabbing;
}

#image-preview {
  max-width: none;
  transform-origin: center center;
  transition: transform 0.05s linear;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

/* Unsupported / Encrypted Card */
.unsupported-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}

.unsupported-card {
  max-width: 560px;
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 30px 32px;
  box-shadow: var(--shadow-md);
}

.unsupported-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 14px;
}

.unsupported-icon.encrypted { background: #fee2e2; color: #dc2626; }
.unsupported-icon.normal    { background: #fef3c7; color: #d97706; }

.unsupported-card h2 {
  margin: 0 0 10px;
  font-size: 19px;
  color: var(--text-primary);
}

.unsupported-note {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.7;
  white-space: pre-line;
  margin: 0 0 18px;
}

.recommend-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 13px 15px;
  font-size: 12.5px;
  color: #334155;
  line-height: 1.65;
  margin-bottom: 20px;
}

.recommend-box strong {
  color: #0f172a;
}

@media (max-width: 960px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .format-grid { grid-template-columns: 1fr; }
  .sidebar { width: 250px; min-width: 220px; }
}

/* ---------------- Phase 2: AI Analysis Drawer ---------------- */
.btn-ai-accent {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  border-color: #3b82f6;
  color: #fff;
  position: relative;
}

.btn-ai-accent:hover {
  background: linear-gradient(135deg, #1d4ed8, #4338ca);
  border-color: #2563eb;
  color: #fff;
}

.btn-ai-accent.active,
.btn-ai-accent.active:hover {
  background: linear-gradient(135deg, #1d4ed8, #4338ca);
  border-color: #1d4ed8;
  color: #fff;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
}

.ai-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  margin-left: 3px;
}

.btn-xs {
  padding: 3px 8px;
  font-size: 11.5px;
}

.hidden {
  display: none !important;
}

.ai-drawer {
  width: 470px;
  max-width: 52vw;
  background: #ffffff;
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100%;
  box-shadow: -4px 0 16px rgba(15, 23, 42, 0.06);
  z-index: 15;
}

.ai-drawer.wide {
  width: 680px;
  max-width: 65vw;
}

.ai-drawer.collapsed {
  display: none;
}

.ai-drawer-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #f8fafc;
}

.ai-drawer-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-model-pill {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 600;
  background: #e0e7ff;
  color: #3730a3;
  padding: 2px 7px;
  border-radius: 999px;
}

.ai-drawer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-config-alert {
  background: #fffbeb;
  border-bottom: 1px solid #fde68a;
  color: #92400e;
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.55;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ai-config-alert code {
  background: rgba(146, 64, 14, 0.1);
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 11.5px;
}

.ai-action-bar {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 12px 0;
  border-bottom: 1px solid var(--border-subtle);
  background: #f8fafc;
  overflow-x: auto;
}

.ai-tab {
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  color: #475569;
  font-size: 12px;
  font-weight: 500;
  padding: 7px 10px;
  border-radius: 7px 7px 0 0;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
}

.ai-tab:hover {
  color: #0f172a;
  background: #eef2f7;
}

.ai-tab.active {
  background: #ffffff;
  color: #1d4ed8;
  border-color: var(--border-subtle);
  font-weight: 600;
  margin-bottom: -1px;
  padding-bottom: 8px;
}

.ai-tab.has-data::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  margin-left: 5px;
  vertical-align: middle;
}

.ai-evidence-bar {
  padding: 7px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #eef2f7;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.ai-ev-chip {
  font-size: 11px;
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #dbeafe;
  padding: 2px 7px;
  border-radius: 999px;
}

.ai-ev-chip.muted {
  background: #f1f5f9;
  color: #64748b;
  border-color: #e2e8f0;
}

.ai-report-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}

.ai-empty-state {
  text-align: center;
  padding: 30px 18px;
  color: var(--text-secondary);
}

.ai-empty-state h4 {
  margin: 0 0 8px;
  font-size: 15px;
  color: var(--text-primary);
}

.ai-empty-state p {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.65;
}

.ai-loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 46px 16px;
  text-align: center;
}

.ai-loading-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.ai-loading-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

.ai-error-card {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.6;
}

.ai-error-card p {
  margin: 6px 0 0;
}

/* Rendered Markdown Report */
.ai-markdown {
  font-size: 13.5px;
  line-height: 1.7;
  color: #1e293b;
}

.ai-markdown h1, .ai-markdown h2 {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin: 18px 0 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid #e2e8f0;
}

.ai-markdown h1:first-child, .ai-markdown h2:first-child {
  margin-top: 0;
}

.ai-markdown h3 {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  margin: 14px 0 6px;
}

.ai-markdown p {
  margin: 0 0 10px;
}

.ai-markdown ul, .ai-markdown ol {
  margin: 0 0 10px;
  padding-left: 20px;
}

.ai-markdown li {
  margin-bottom: 4px;
}

.ai-markdown table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0 14px;
  font-size: 12.5px;
}

.ai-markdown th, .ai-markdown td {
  border: 1px solid #cbd5e1;
  padding: 6px 9px;
  text-align: left;
  vertical-align: top;
}

.ai-markdown th {
  background: #f1f5f9;
  font-weight: 600;
  color: #0f172a;
}

.ai-markdown blockquote {
  margin: 10px 0;
  padding: 8px 12px;
  border-left: 3px solid #3b82f6;
  background: #f8fafc;
  color: #475569;
  border-radius: 0 6px 6px 0;
}

.ai-markdown code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 4px;
}

.ai-stage2-banner {
  margin-top: 18px;
  padding: 14px;
  background: #f0f7ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
}

.ai-stage2-title {
  font-size: 12.5px;
  font-weight: 600;
  color: #1e3a8a;
  margin-bottom: 10px;
}

.ai-stage2-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-qa-item {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: #fafcff;
}

.ai-qa-q {
  font-size: 13px;
  font-weight: 600;
  color: #1d4ed8;
  margin-bottom: 8px;
}

.ai-qa-meta {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 6px;
}

.ai-followup-box {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border-subtle);
  background: #f8fafc;
}

.ai-quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.ai-quick-q {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #475569;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  cursor: pointer;
}

.ai-quick-q:hover {
  border-color: #3b82f6;
  color: #1d4ed8;
  background: #eff6ff;
}

.ai-followup-row {
  display: flex;
  gap: 8px;
}

.ai-followup-input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 13px;
  outline: none;
}

.ai-followup-input:focus {
  border-color: #3b82f6;
}

/* ---------------- Sidebar AI Link & AI Management Page ---------------- */
.sidebar-footer-nav {
  padding: 10px 10px 8px;
  border-top: 1px solid var(--border-sidebar);
}

.sidebar-ai-link {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 11px;
  border-radius: 9px;
  background: rgba(30, 41, 59, 0.75);
  border: 1px solid #334155;
  transition: background 0.15s, border-color 0.15s;
}

.sidebar-ai-link:hover {
  background: #1e293b;
  border-color: #475569;
}

.sidebar-ai-link.active {
  background: rgba(37, 99, 235, 0.25);
  border-color: rgba(59, 130, 246, 0.6);
}

.sidebar-ai-link-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: #f8fafc;
}

.sidebar-ai-link-sub {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sidebar-status-dot.ok   { background: #22c55e; }
.sidebar-status-dot.warn { background: #f59e0b; }

.ai-switcher-bar {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: #f8fafc;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.ai-voice-bar {
  padding: 7px 14px;
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(90deg, #f8fafc 0%, #f0f9ff 100%);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
}

.ai-ptt-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #fff;
  border: 1px solid #93c5fd;
  color: #1e40af;
  font-weight: 600;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.ai-ptt-btn:hover {
  background: #eff6ff;
  border-color: #3b82f6;
}

.ai-ptt-btn.recording {
  background: #dc2626;
  border-color: #b91c1c;
  color: #fff;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.22);
  animation: aiPttPulse 1.1s infinite;
}

@keyframes aiPttPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.25); }
  50% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0.08); }
}

.ai-kbd {
  display: inline-block;
  padding: 0 4px;
  font-size: 10.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  line-height: 1.5;
  border-radius: 4px;
  border: 1px solid currentColor;
  opacity: 0.82;
}

.ai-voice-status {
  font-size: 11.5px;
  color: #64748b;
  min-width: 0;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-voice-status.recording {
  color: #dc2626;
  font-weight: 600;
}

.ai-voice-status.busy {
  color: #2563eb;
  font-weight: 600;
}

.ai-tts-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.ai-tts-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  color: #334155;
  margin: 0;
}

.ai-tts-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.ai-tts-switch-track {
  position: relative;
  width: 30px;
  height: 17px;
  background: #cbd5e1;
  border-radius: 999px;
  transition: background 0.18s ease;
  flex-shrink: 0;
}

.ai-tts-switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.25);
  transition: transform 0.18s ease;
}

.ai-tts-switch input:checked + .ai-tts-switch-track {
  background: #10b981;
}

.ai-tts-switch input:checked + .ai-tts-switch-track::after {
  transform: translateX(13px);
}

.ai-tts-switch input:checked ~ .ai-tts-switch-text {
  color: #047857;
  font-weight: 600;
}

.ai-detail-seg {
  display: inline-flex;
  align-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f1f5f9;
  padding: 1px;
  gap: 1px;
}

.ai-detail-opt {
  border: none;
  background: transparent;
  color: #475569;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 5px;
  cursor: pointer;
  line-height: 1.4;
  transition: background 0.14s ease, color 0.14s ease;
}

.ai-detail-opt:hover {
  color: #0f172a;
}

.ai-detail-opt.active {
  background: #fff;
  color: #1d4ed8;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.ai-inline-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  color: #475569;
  font-size: 12.5px;
}

.ai-qa-pending {
  border-color: #bfdbfe !important;
  background: #f8fbff !important;
}

.ai-stream-preview {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.65;
  color: #1e293b;
  padding: 6px 2px;
}

/* Parts Library Thumbnail Column */
.part-thumb-cell {
  width: 112px;
  padding-top: 8px !important;
  padding-bottom: 8px !important;
  vertical-align: middle;
}

.part-thumb-box {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 66px;
  padding: 0;
  border-radius: 7px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  color: #475569;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.part-thumb-box:hover {
  transform: translateY(-1px);
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.16);
}

.part-thumb-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #fff;
}

.part-thumb-fallback {
  display: none;
  font-size: 11px;
  color: #64748b;
}

.part-thumb-box.is-fallback .part-thumb-fallback {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.part-thumb-badge {
  position: absolute;
  right: 3px;
  bottom: 3px;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 3px;
  background: rgba(15, 23, 42, 0.72);
  color: #f8fafc;
  letter-spacing: 0.2px;
  pointer-events: none;
}

.part-thumb-box.is-placeholder {
  background: #f1f5f9;
  border-style: dashed;
  gap: 2px;
  font-size: 16px;
}

.part-thumb-box.is-placeholder small {
  font-size: 10.5px;
  color: #64748b;
  font-weight: 600;
}

.part-thumb-box.is-placeholder.encrypted {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #be123c;
}

.part-thumb-box.is-placeholder.encrypted small {
  color: #be123c;
}

.ai-provider-select {
  flex: 1;
  min-width: 0;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  background: #fff;
  color: var(--text-primary);
}

.notice-banner {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-top: 16px;
  font-size: 13.5px;
}

.ai-mgr-hero .btn {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.ai-mgr-hero .btn:hover {
  background: rgba(255, 255, 255, 0.24);
}

.ai-mgr-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.95fr);
  gap: 20px;
  margin-top: 22px;
  align-items: start;
}

.provider-card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.provider-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

.provider-card.is-active {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.14);
}

.provider-card-head h3 {
  margin: 0 0 8px;
  font-size: 15px;
  color: var(--text-primary);
}

.provider-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge-ok-subtle {
  background: #ecfdf5;
  color: #047857;
}

.provider-meta-grid {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.provider-meta-grid > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
  word-break: break-all;
}

.pm-k {
  color: #64748b;
  min-width: 78px;
  flex-shrink: 0;
}

.provider-meta-grid code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: #f1f5f9;
  color: #0f172a;
  padding: 1px 6px;
  border-radius: 4px;
}

.provider-test-result {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1.5;
}

.provider-test-result.testing { background: #eff6ff; color: #1d4ed8; }
.provider-test-result.ok      { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.provider-test-result.err     { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

.provider-actions {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.btn-danger-ghost {
  color: #b91c1c;
  border-color: #fecaca;
}

.btn-danger-ghost:hover {
  background: #fef2f2;
  border-color: #f87171;
}

.provider-form-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}

.form-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.form-card-head h2 {
  margin: 0;
  font-size: 16px;
  color: var(--text-primary);
}

.preset-block {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 16px;
}

.preset-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preset-chip {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  font-size: 11.5px;
  padding: 4px 9px;
  border-radius: 6px;
  cursor: pointer;
}

.preset-chip:hover {
  border-color: #3b82f6;
  color: #1d4ed8;
  background: #eff6ff;
}

.ai-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-field label {
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
}

.field-hint {
  font-weight: 400;
  color: #64748b;
  font-size: 11.5px;
}

.form-field input[type="text"],
.form-field input[type="url"],
.form-field input[type="password"],
.form-field input[type="number"] {
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  width: 100%;
}

.form-field input:focus {
  border-color: #3b82f6;
}

.secret-input-wrap {
  display: flex;
  gap: 6px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  align-items: end;
}

.checkbox-label {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 7px;
  font-weight: 500 !important;
  cursor: pointer;
  padding: 6px 0;
}

.form-submit-row {
  margin-top: 4px;
}

@media (max-width: 1100px) {
  .ai-mgr-layout {
    grid-template-columns: 1fr;
  }
}

/* ---------------- Export Dropdown & Highlight Toggle ---------------- */
.export-dropdown {
  position: relative;
  display: inline-block;
}

.export-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  min-width: 175px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.14);
  padding: 5px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.export-menu-item {
  width: 100%;
  border: none;
  background: transparent;
  color: #1e293b;
  font-size: 12.5px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
}

.export-menu-item:hover {
  background: #eff6ff;
  color: #1d4ed8;
}

.export-ext {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: #64748b;
}

.ai-hl-toggle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
  user-select: none;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.ai-hl-toggle:hover {
  border-color: #cbd5e1;
  background: #f1f5f9;
}

.ai-hl-legend {
  padding: 6px 14px;
  background: #fffdf5;
  border-bottom: 1px solid #fde68a;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 11.5px;
}

.hl-legend-chip {
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 500;
}

.hl-legend-chip.key {
  background: #fef08a;
  color: #0f172a;
}

.hl-legend-chip.uncertain {
  background: #fed7aa;
  color: #9a3412;
  border-bottom: 1.5px dashed #ea580c;
}

/* Highlight marks: transparent by default, colored when .hl-active is toggled on */
.ai-markdown mark.hl-key,
.ai-markdown mark.hl-uncertain {
  background: transparent;
  color: inherit;
  padding: 0;
  border: none;
  transition: background-color 0.15s, color 0.15s;
}

.ai-drawer.hl-active .ai-markdown mark.hl-key {
  background: #fef08a;
  color: #0f172a;
  padding: 1px 4px;
  border-radius: 3px;
}

.ai-drawer.hl-active .ai-markdown mark.hl-uncertain {
  background: #fed7aa;
  color: #9a3412;
  padding: 1px 4px;
  border-radius: 3px;
  border-bottom: 1.5px dashed #ea580c;
}


/* ---------------- Phase 3: DWG/DXF to 3D Studio ---------------- */
.btn-cad3d-accent {
  background: linear-gradient(135deg, #059669, #0284c7);
  border-color: #059669;
  color: #fff;
  position: relative;
}

.btn-cad3d-accent:hover:not(:disabled) {
  background: linear-gradient(135deg, #047857, #0369a1);
  border-color: #047857;
  color: #fff;
}

.btn-cad3d-accent.active,
.btn-cad3d-accent.active:hover {
  background: linear-gradient(135deg, #047857, #0369a1);
  border-color: #047857;
  color: #fff;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.35);
}

.cad3d-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-left: 3px;
}

.cad3d-dot.dot-ok    { background: #4ade80; }
.cad3d-dot.dot-amber { background: #fbbf24; }
.cad3d-dot.dot-warn  { background: #f87171; }

.viewport-stage.cad3d-hidden-2d {
  display: none !important;
}

.cad3d-studio {
  width: 64%;
  min-width: 620px;
  max-width: 78%;
  height: 100%;
  background: #f8fafc;
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: -6px 0 22px rgba(15, 23, 42, 0.08);
  z-index: 16;
}

.cad3d-studio.fullscreen {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border-left: none;
  box-shadow: none;
}

.cad3d-studio.collapsed {
  display: none;
}

.cad3d-header {
  padding: 10px 16px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.cad3d-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cad3d-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.cad3d-status-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.cad3d-status-pill.pill-idle         { background: #f1f5f9; color: #475569; }
.cad3d-status-pill.pill-loading      { background: #e0f2fe; color: #0369a1; }
.cad3d-status-pill.pill-ready        { background: #dcfce7; color: #15803d; }
.cad3d-status-pill.pill-configurable { background: #fef3c7; color: #b45309; }
.cad3d-status-pill.pill-blocked      { background: #fee2e2; color: #b91c1c; }

.cad3d-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cad3d-body {
  flex: 1;
  min-height: 0;
  display: flex;
  position: relative;
  overflow: hidden;
}

.cad3d-center-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}

.cad3d-hero-card,
.cad3d-blocked-card {
  max-width: 560px;
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  box-shadow: var(--shadow-md);
}

.cad3d-hero-icon {
  font-size: 32px;
  margin-bottom: 10px;
}

.cad3d-hero-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
  color: var(--text-primary);
}

.cad3d-hero-card p {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.65;
}

.cad3d-feature-list {
  margin: 0 0 16px;
  padding-left: 18px;
  font-size: 12.5px;
  color: #334155;
  line-height: 1.7;
}

.cad3d-feature-list li {
  margin-bottom: 6px;
}

.cad3d-feature-list code {
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11.5px;
}

.cad3d-hint-row {
  margin-bottom: 14px;
}

.cad3d-hint-input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 12.5px;
  outline: none;
  background: #fff;
  color: var(--text-primary);
}

.cad3d-hint-input:focus {
  border-color: #0284c7;
}

.cad3d-hero-actions {
  display: flex;
  gap: 10px;
}

.cad3d-loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  max-width: 420px;
}

.cad3d-loading-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.cad3d-loading-sub {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Not Feasible / Blocked Card */
.cad3d-blocked-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
}

.cad3d-blocked-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
}

.cad3d-blocked-icon.warn  { background: #fef3c7; color: #d97706; }
.cad3d-blocked-icon.error { background: #fee2e2; color: #dc2626; margin-bottom: 12px; }

.cad3d-blocked-card h3 {
  margin: 6px 0 0;
  font-size: 16.5px;
  color: var(--text-primary);
  line-height: 1.35;
}

.cad3d-blocked-summary {
  margin: 0 0 14px;
  font-size: 13px;
  color: #334155;
  line-height: 1.65;
}

.cad3d-blocked-section {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  padding: 11px 14px;
  margin-bottom: 12px;
}

.cad3d-blocked-section h4 {
  margin: 0 0 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: #0f172a;
}

.cad3d-missing-list,
.cad3d-sugg-list {
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  line-height: 1.65;
}

.cad3d-missing-list li { color: #991b1b; margin-bottom: 3px; }
.cad3d-sugg-list li    { color: #1e40af; margin-bottom: 3px; }

.cad3d-ev-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 14px;
}

.cad3d-blocked-retry,
.cad3d-blocked-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Active 3D Workspace */
.cad3d-workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

.cad3d-viewport-col {
  flex: 1;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  background: #eef2f8;
  position: relative;
}

.cad3d-mini-toolbar {
  padding: 7px 10px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.cad3d-toolbar-spacer {
  flex: 1;
}

.export-menu-right {
  left: auto;
  right: 0;
}

.cad3d-canvas-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

#cad3d-viewer-canvas {
  width: 100%;
  height: 100%;
}

.cad3d-rebuild-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(15, 23, 42, 0.82);
  color: #f8fafc;
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  z-index: 12;
  backdrop-filter: blur(4px);
}

.mini-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.cad3d-hud-bar {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  background: rgba(15, 23, 42, 0.78);
  color: #f1f5f9;
  font-size: 11.5px;
  padding: 6px 11px;
  border-radius: 8px;
  backdrop-filter: blur(4px);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  pointer-events: none;
  z-index: 10;
}

/* Right Parameter Config Panel */
.cad3d-param-col {
  width: 330px;
  min-width: 295px;
  max-width: 380px;
  background: #ffffff;
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.cad3d-param-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cad3d-summary-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 11px 12px;
}

.cad3d-sum-head h4 {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--text-primary);
}

.cad3d-sum-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.cad3d-type-chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
}

.cad3d-type-chip.subtle {
  background: #e2e8f0;
  color: #334155;
}

.cad3d-type-chip.warn {
  background: #fee2e2;
  color: #b91c1c;
}

.cad3d-sum-desc {
  margin: 8px 0 6px;
  font-size: 12px;
  color: #475569;
  line-height: 1.55;
}

.cad3d-sum-meta {
  font-size: 11px;
  color: #64748b;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.cad3d-missing-banner {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 9px;
  padding: 9px 11px;
  font-size: 12px;
  color: #92400e;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cad3d-param-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.5;
}

.cad3d-param-group-title {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  margin: 4px 0 8px;
}

.cad3d-param-group-title.ai-group {
  color: #b45309;
}

.cad3d-param-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  padding: 9px 11px;
  margin-bottom: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.cad3d-param-card.is-ai-suggested {
  background: #fffdf5;
  border-color: #fde68a;
}

.cad3d-param-card.is-modified {
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.2);
}

.cad3d-param-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.cad3d-param-label-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  min-width: 0;
}

.cad3d-param-label {
  font-size: 12.5px;
  font-weight: 600;
  color: #0f172a;
}

.cad3d-ai-tag {
  font-size: 10px;
  font-weight: 600;
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fcd34d;
  padding: 1px 5px;
  border-radius: 4px;
}

.cad3d-param-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.cad3d-param-num {
  width: 72px;
  text-align: right;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: #0f172a;
  background: #ffffff;
  outline: none;
}

.cad3d-param-num:focus {
  border-color: #2563eb;
}

.cad3d-param-unit {
  font-size: 11px;
  color: #64748b;
  min-width: 22px;
}

.cad3d-slider-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.cad3d-range-bound {
  font-size: 10.5px;
  color: #94a3b8;
  min-width: 22px;
  text-align: center;
}

.cad3d-param-slider {
  flex: 1;
  accent-color: #0284c7;
  cursor: pointer;
}

.cad3d-param-card.is-ai-suggested .cad3d-param-slider {
  accent-color: #d97706;
}

.cad3d-param-reason {
  margin-top: 6px;
  font-size: 11px;
  color: #64748b;
  line-height: 1.45;
}

.cad3d-assumptions {
  background: #f1f5f9;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 11.5px;
  color: #475569;
}

.cad3d-assump-title {
  font-weight: 600;
  color: #334155;
  margin-bottom: 5px;
}

.cad3d-assumptions ul {
  margin: 0;
  padding-left: 16px;
  line-height: 1.55;
}

.cad3d-param-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border-subtle);
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cad3d-sync-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cad3d-sync-status {
  font-size: 11.5px;
  color: #059669;
  font-weight: 500;
}

.cad3d-regen-row {
  display: flex;
  gap: 6px;
}

@media (max-width: 1180px) {
  .cad3d-studio {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
}


/* ---------------- 3D Cross-Section Panel (X / Y / Z) ---------------- */
.section3d-btn-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2563eb;
  margin-left: 2px;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.22);
}

.section3d-panel {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 320px;
  max-width: calc(100% - 28px);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
  z-index: 15;
  color: #0f172a;
  user-select: none;
  overflow: hidden;
  transition: background 0.18s, border-color 0.18s;
}

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

.section3d-panel.is-compact {
  top: 10px;
  right: 10px;
  width: 288px;
}

.section3d-panel.is-dark {
  background: rgba(15, 23, 42, 0.88);
  border-color: rgba(71, 85, 105, 0.72);
  color: #f1f5f9;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
}

.section3d-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.85);
}

.section3d-panel.is-dark .section3d-header {
  border-bottom-color: rgba(51, 65, 85, 0.85);
}

.section3d-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.section3d-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
}

.section3d-sub {
  font-size: 10.5px;
  color: #64748b;
  line-height: 1.25;
}

.section3d-panel.is-dark .section3d-sub {
  color: #94a3b8;
}

.section3d-header-btns {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.section3d-icon-btn {
  border: 1px solid #cbd5e1;
  background: rgba(255, 255, 255, 0.8);
  color: #475569;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 7px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.14s;
}

.section3d-icon-btn:hover {
  border-color: #94a3b8;
  color: #0f172a;
}

.section3d-icon-btn.active {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
}

.section3d-panel.is-dark .section3d-icon-btn {
  background: rgba(30, 41, 59, 0.85);
  border-color: #475569;
  color: #cbd5e1;
}

.section3d-panel.is-dark .section3d-icon-btn.active {
  background: rgba(37, 99, 235, 0.3);
  border-color: #60a5fa;
  color: #bfdbfe;
}

.section3d-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section3d-axis-row {
  background: rgba(248, 250, 252, 0.9);
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  padding: 8px 10px;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.section3d-panel.is-dark .section3d-axis-row {
  background: rgba(30, 41, 59, 0.68);
  border-color: #334155;
}

.section3d-axis-row.is-active[data-axis-row="x"] {
  border-color: rgba(239, 68, 68, 0.55);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.15);
}

.section3d-axis-row.is-active[data-axis-row="y"] {
  border-color: rgba(34, 197, 94, 0.55);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.15);
}

.section3d-axis-row.is-active[data-axis-row="z"] {
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.15);
}

.section3d-axis-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}

.section3d-axis-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.14s;
}

.section3d-panel.is-dark .section3d-axis-toggle {
  background: #0f172a;
  border-color: #475569;
  color: #cbd5e1;
}

.section3d-axis-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.45;
  transition: opacity 0.14s, transform 0.14s;
}

.section3d-axis-toggle.active .section3d-axis-dot {
  opacity: 1;
  transform: scale(1.1);
}

.section3d-axis-toggle.active.axis-x {
  background: rgba(239, 68, 68, 0.12);
  border-color: #ef4444;
  color: #dc2626;
}

.section3d-axis-toggle.active.axis-y {
  background: rgba(34, 197, 94, 0.12);
  border-color: #22c55e;
  color: #15803d;
}

.section3d-axis-toggle.active.axis-z {
  background: rgba(59, 130, 246, 0.12);
  border-color: #3b82f6;
  color: #1d4ed8;
}

.section3d-panel.is-dark .section3d-axis-toggle.active.axis-x { color: #fca5a5; }
.section3d-panel.is-dark .section3d-axis-toggle.active.axis-y { color: #86efac; }
.section3d-panel.is-dark .section3d-axis-toggle.active.axis-z { color: #93c5fd; }

.section3d-axis-controls {
  display: flex;
  align-items: center;
  gap: 5px;
}

.section3d-mini-btn {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.12s;
}

.section3d-mini-btn:hover {
  border-color: #94a3b8;
  color: #0f172a;
}

.section3d-mini-btn.active {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
}

.section3d-panel.is-dark .section3d-mini-btn {
  background: #0f172a;
  border-color: #475569;
  color: #cbd5e1;
}

.section3d-num-wrap {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.section3d-num {
  width: 68px;
  text-align: right;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  padding: 2px 5px;
  background: #ffffff;
  color: #0f172a;
  outline: none;
}

.section3d-num:focus {
  border-color: #3b82f6;
}

.section3d-panel.is-dark .section3d-num {
  background: #0f172a;
  border-color: #475569;
  color: #f1f5f9;
}

.section3d-unit {
  font-size: 10.5px;
  color: #64748b;
}

.section3d-panel.is-dark .section3d-unit {
  color: #94a3b8;
}

.section3d-slider-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section3d-slider {
  flex: 1;
  height: 5px;
  cursor: pointer;
  margin: 0;
}

.section3d-slider.axis-x { accent-color: #ef4444; }
.section3d-slider.axis-y { accent-color: #22c55e; }
.section3d-slider.axis-z { accent-color: #3b82f6; }

.section3d-pct {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: #64748b;
  min-width: 34px;
  text-align: right;
}

.section3d-panel.is-dark .section3d-pct {
  color: #94a3b8;
}

.section3d-footer {
  padding: 8px 12px 10px;
  border-top: 1px solid rgba(226, 232, 240, 0.85);
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: rgba(248, 250, 252, 0.72);
}

.section3d-panel.is-dark .section3d-footer {
  border-top-color: rgba(51, 65, 85, 0.85);
  background: rgba(15, 23, 42, 0.55);
}

.section3d-tip {
  font-size: 11px;
  color: #64748b;
  line-height: 1.35;
}

.section3d-panel.is-dark .section3d-tip {
  color: #94a3b8;
}

.section3d-footer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.section3d-foot-btn {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-size: 11.5px;
  font-weight: 500;
  padding: 4px 9px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s;
}

.section3d-foot-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.section3d-foot-btn.danger {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fef2f2;
}

.section3d-foot-btn.danger:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

.section3d-panel.is-dark .section3d-foot-btn {
  background: #1e293b;
  border-color: #475569;
  color: #e2e8f0;
}

.section3d-panel.is-dark .section3d-foot-btn.danger {
  background: rgba(185, 28, 28, 0.2);
  border-color: rgba(248, 113, 113, 0.45);
  color: #fca5a5;
}


/* ---------------- 3D Assembly Detection Badges & Explorer Drawer ---------------- */
.badge-assembly   { background: #fef3c7; color: #b45309; border: 1px solid #fcd34d; }
.badge-multibody  { background: #e0e7ff; color: #4338ca; border: 1px solid #c7d2fe; }
.badge-singlepart { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }

.sidebar-asm-pill {
  font-size: 9.5px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  line-height: 1.3;
  margin-left: auto;
  flex-shrink: 0;
}

.sidebar-asm-pill.is-assembly {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.42);
}

.sidebar-asm-pill.is-multibody {
  background: rgba(99, 102, 241, 0.22);
  color: #c7d2fe;
  border: 1px solid rgba(99, 102, 241, 0.4);
}

.sidebar-asm-pill.is-single {
  background: rgba(148, 163, 184, 0.14);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.hud-assembly-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.hud-assembly-chip.badge-assembly {
  background: rgba(245, 158, 11, 0.22);
  color: #fde68a;
  border: 1px solid rgba(251, 191, 36, 0.45);
}

.hud-assembly-chip.badge-multibody {
  background: rgba(99, 102, 241, 0.25);
  color: #c7d2fe;
  border: 1px solid rgba(129, 140, 248, 0.45);
}

.hud-assembly-chip.badge-singlepart {
  background: rgba(148, 163, 184, 0.22);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.asm-btn-count {
  font-size: 10.5px;
  font-weight: 700;
  background: rgba(245, 158, 11, 0.18);
  color: #b45309;
  padding: 0 5px;
  border-radius: 999px;
  line-height: 1.5;
}

.assembly-drawer {
  width: 316px;
  min-width: 280px;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.assembly-drawer.collapsed {
  display: none;
}

.asm-drawer-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.asm-drawer-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.asm-summary-card {
  margin: 12px 12px 0;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  flex-shrink: 0;
}

.asm-summary-card.is-assembly {
  background: #fffbeb;
  border-color: #fde68a;
}

.asm-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.asm-status-row strong {
  font-size: 13px;
  color: #0f172a;
}

.asm-summary-card.is-assembly .asm-status-row strong {
  color: #92400e;
}

.asm-root-name {
  font-size: 11px;
  color: #64748b;
  max-width: 145px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.asm-metric {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 7px;
  padding: 6px 4px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.asm-metric-val {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.asm-metric-lbl {
  font-size: 10.5px;
  color: #64748b;
}

.asm-desc-box {
  margin-top: 8px;
  font-size: 11.5px;
  color: #334155;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 5px 8px;
  line-height: 1.45;
}

.asm-reason {
  margin-top: 7px;
  font-size: 11px;
  color: #64748b;
  line-height: 1.4;
}

.asm-explode-box {
  margin: 10px 12px 0;
  padding: 9px 11px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  flex-shrink: 0;
}

.asm-explode-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.asm-explode-title {
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
}

.asm-explode-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.asm-explode-pct {
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #2563eb;
  min-width: 32px;
  text-align: right;
}

.asm-explode-slider {
  width: 100%;
  accent-color: #2563eb;
  cursor: pointer;
  margin: 0;
}

.asm-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 10px 12px 0;
  flex-shrink: 0;
}

.asm-tab {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #475569;
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 6px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.14s;
}

.asm-tab:hover {
  border-color: #94a3b8;
  color: #0f172a;
}

.asm-tab.active {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
}

.asm-search-wrap {
  padding: 8px 12px 6px;
  flex-shrink: 0;
}

.asm-search-input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  padding: 6px 9px;
  font-size: 12px;
  outline: none;
  background: #ffffff;
  color: var(--text-primary);
}

.asm-search-input:focus {
  border-color: #3b82f6;
}

.asm-list-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.asm-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
}

.asm-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.asm-item.is-selected {
  background: #eff6ff;
  border-color: #3b82f6;
}

.asm-item.is-hidden {
  opacity: 0.48;
}

.asm-item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  cursor: pointer;
}

.asm-item-name {
  font-size: 12.5px;
  font-weight: 500;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.asm-qty-pill {
  font-size: 11px;
  font-weight: 700;
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #fde68a;
  padding: 1px 6px;
  border-radius: 999px;
  flex-shrink: 0;
}

.asm-tri-meta {
  font-size: 10.5px;
  color: #94a3b8;
  flex-shrink: 0;
}

.asm-item-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.asm-act-btn {
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  transition: all 0.12s;
}

.asm-act-btn:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.asm-act-btn.active {
  background: #dbeafe;
  border-color: #3b82f6;
  color: #1d4ed8;
}

.asm-act-btn.is-off {
  background: #f1f5f9;
  color: #94a3b8;
}

.asm-empty {
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
  padding: 20px 10px;
}

.asm-single-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  padding: 10px 12px;
  margin-top: 4px;
}

.asm-single-title {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 8px;
}

.asm-single-kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 10px;
  font-size: 12px;
  color: #64748b;
}

.asm-single-kv strong {
  color: #0f172a;
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}

.asm-footer {
  padding: 9px 12px;
  border-top: 1px solid var(--border-subtle);
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-shrink: 0;
}


/* ---------------- 3D Floating Explode View Panel ---------------- */
.explode3d-panel {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 308px;
  max-width: calc(100% - 28px);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(203, 213, 225, 0.92);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
  z-index: 15;
  color: #0f172a;
  user-select: none;
  overflow: hidden;
  transition: background 0.18s, border-color 0.18s;
}

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

.explode3d-panel.is-dark {
  background: rgba(15, 23, 42, 0.88);
  border-color: rgba(71, 85, 105, 0.72);
  color: #f1f5f9;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
}

.explode3d-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.85);
}

.explode3d-panel.is-dark .explode3d-header {
  border-bottom-color: rgba(51, 65, 85, 0.85);
}

.explode3d-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.explode3d-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
}

.explode3d-sub {
  font-size: 10.5px;
  color: #64748b;
  line-height: 1.25;
}

.explode3d-panel.is-dark .explode3d-sub {
  color: #94a3b8;
}

.explode3d-header-btns {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.explode3d-panel.is-dark .section3d-icon-btn {
  background: rgba(30, 41, 59, 0.85);
  border-color: #475569;
  color: #cbd5e1;
}

.explode3d-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.explode3d-row {
  background: rgba(248, 250, 252, 0.9);
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.explode3d-panel.is-dark .explode3d-row {
  background: rgba(30, 41, 59, 0.68);
  border-color: #334155;
}

.explode3d-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.explode3d-label {
  font-size: 12px;
  font-weight: 600;
}

.explode3d-val {
  font-size: 12px;
  font-weight: 700;
  color: #2563eb;
  font-variant-numeric: tabular-nums;
}

.explode3d-panel.is-dark .explode3d-val {
  color: #60a5fa;
}

.explode3d-range-num-wrap {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.explode3d-range-num {
  width: 54px;
  text-align: right;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  padding: 2px 5px;
  background: #ffffff;
  color: #0f172a;
  outline: none;
}

.explode3d-range-num:focus {
  border-color: #2563eb;
}

.explode3d-panel.is-dark .explode3d-range-num {
  background: #0f172a;
  border-color: #475569;
  color: #f1f5f9;
}

.explode3d-unit {
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
}

.explode3d-slider {
  width: 100%;
  accent-color: #2563eb;
  cursor: pointer;
  margin: 0;
}

.explode3d-slider.is-range {
  accent-color: #d97706;
}

.explode3d-presets,
.explode3d-modes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}

.explode3d-preset-btn,
.explode3d-mode-btn {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 2px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}

.explode3d-preset-btn:hover,
.explode3d-mode-btn:hover {
  border-color: #94a3b8;
  color: #0f172a;
}

.explode3d-preset-btn.active {
  background: #fffbeb;
  border-color: #f59e0b;
  color: #b45309;
}

.explode3d-mode-btn.active {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
}

.explode3d-panel.is-dark .explode3d-preset-btn,
.explode3d-panel.is-dark .explode3d-mode-btn {
  background: #0f172a;
  border-color: #475569;
  color: #cbd5e1;
}

.explode3d-panel.is-dark .explode3d-preset-btn.active {
  background: rgba(245, 158, 11, 0.22);
  border-color: #fbbf24;
  color: #fde68a;
}

.explode3d-panel.is-dark .explode3d-mode-btn.active {
  background: rgba(37, 99, 235, 0.3);
  border-color: #60a5fa;
  color: #bfdbfe;
}

.explode3d-footer {
  padding: 8px 12px 10px;
  border-top: 1px solid rgba(226, 232, 240, 0.85);
  background: rgba(248, 250, 252, 0.72);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.explode3d-panel.is-dark .explode3d-footer {
  border-top-color: rgba(51, 65, 85, 0.85);
  background: rgba(15, 23, 42, 0.55);
}

.explode3d-act-btn {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 8px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.14s;
}

.explode3d-act-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.explode3d-act-btn.primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.explode3d-act-btn.primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.explode3d-panel.is-dark .explode3d-act-btn:not(.primary) {
  background: #1e293b;
  border-color: #475569;
  color: #e2e8f0;
}

.asm-range-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #e2e8f0;
}

.asm-range-lbl {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
}

.asm-range-slider {
  flex: 1;
  accent-color: #d97706;
  cursor: pointer;
  margin: 0;
}

.asm-range-val {
  font-size: 11px;
  font-weight: 700;
  color: #b45309;
  min-width: 30px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}


/* ---------------- 3D Dimension Rulers, Interactive Measure & STEP Feature Callouts ---------------- */
.measure3d-svg-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 8;
  overflow: visible;
}

.measure3d-label-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 9;
  overflow: hidden;
}

.m3d-ext-line {
  stroke-width: 1.25;
  stroke-dasharray: 3 3;
  opacity: 0.72;
}

.m3d-dim-line {
  stroke-width: 2;
  opacity: 0.95;
}

.m3d-line-dist {
  stroke: #0ea5e9;
  stroke-width: 2.2;
}

.m3d-line-preview {
  stroke: #0ea5e9;
  stroke-width: 1.8;
  stroke-dasharray: 5 4;
}

.m3d-line-diam {
  stroke-width: 1.75;
  stroke-dasharray: 3 2;
}

.m3d-line-face {
  stroke: #a855f7;
  stroke-width: 2.2;
}

.m3d-line-face-dash {
  stroke: #a855f7;
  stroke-width: 1.8;
  stroke-dasharray: 5 3;
}

.m3d-dot-dist { fill: #0ea5e9; stroke: #ffffff; stroke-width: 1.5; }
.m3d-dot-diam { fill: #10b981; stroke: #ffffff; stroke-width: 1.2; }
.m3d-dot-face { fill: #a855f7; stroke: #ffffff; stroke-width: 1.5; }
.m3d-dot-pending { fill: #f59e0b; stroke: #ffffff; stroke-width: 1.8; }
.m3d-snap-vertex { fill: rgba(250, 204, 21, 0.35); stroke: #eab308; stroke-width: 2.2; }
.m3d-snap-surface { fill: rgba(14, 165, 233, 0.35); stroke: #0ea5e9; stroke-width: 1.8; }

.measure3d-tag {
  position: absolute;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.24);
  pointer-events: auto;
  user-select: none;
}

.measure3d-tag.tag-dim-x { background: rgba(239, 68, 68, 0.92); color: #ffffff; pointer-events: none; }
.measure3d-tag.tag-dim-y { background: rgba(22, 163, 74, 0.92); color: #ffffff; pointer-events: none; }
.measure3d-tag.tag-dim-z { background: rgba(37, 99, 235, 0.92); color: #ffffff; pointer-events: none; }
.measure3d-tag.tag-dist  { background: rgba(2, 132, 199, 0.94); color: #ffffff; }
.measure3d-tag.tag-diam  { background: rgba(5, 150, 105, 0.94); color: #ffffff; }
.measure3d-tag.tag-face  { background: rgba(147, 51, 234, 0.94); color: #ffffff; }
.measure3d-tag.tag-feat  { background: rgba(217, 119, 6, 0.92); color: #ffffff; pointer-events: none; font-size: 10.5px; }
.measure3d-tag.tag-preview { background: rgba(15, 23, 42, 0.82); color: #38bdf8; pointer-events: none; border: 1px solid rgba(56, 189, 248, 0.5); }

.measure3d-tag-del {
  border: none;
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.measure3d-tag-del:hover {
  background: rgba(255, 255, 255, 0.42);
}

/* Floating Measure Panel */
.measure3d-panel {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 316px;
  max-width: calc(100% - 28px);
  max-height: calc(100% - 92px);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(203, 213, 225, 0.92);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
  z-index: 15;
  color: #0f172a;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
}

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

.measure3d-panel.is-dark {
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(71, 85, 105, 0.72);
  color: #f1f5f9;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
}

.measure3d-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.85);
  flex-shrink: 0;
}

.measure3d-panel.is-dark .measure3d-header {
  border-bottom-color: rgba(51, 65, 85, 0.85);
}

.measure3d-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.measure3d-title {
  font-size: 13px;
  font-weight: 700;
}

.measure3d-sub {
  font-size: 10.5px;
  color: #64748b;
}

.measure3d-panel.is-dark .measure3d-sub {
  color: #94a3b8;
}

.measure3d-header-btns {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.measure3d-panel.is-dark .section3d-icon-btn {
  background: rgba(30, 41, 59, 0.85);
  border-color: #475569;
  color: #cbd5e1;
}

.measure3d-panel.is-dark .section3d-icon-btn.active {
  background: rgba(37, 99, 235, 0.3);
  border-color: #60a5fa;
  color: #bfdbfe;
}

.measure3d-modes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 9px 10px 6px;
  flex-shrink: 0;
}

.measure3d-mode-btn {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 2px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}

.measure3d-mode-btn:hover {
  border-color: #94a3b8;
  color: #0f172a;
}

.measure3d-mode-btn.active {
  background: #eff6ff;
  border-color: #2563eb;
  color: #1d4ed8;
}

.measure3d-panel.is-dark .measure3d-mode-btn {
  background: #0f172a;
  border-color: #475569;
  color: #cbd5e1;
}

.measure3d-panel.is-dark .measure3d-mode-btn.active {
  background: rgba(37, 99, 235, 0.3);
  border-color: #60a5fa;
  color: #bfdbfe;
}

.measure3d-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 12px 8px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.85);
  flex-shrink: 0;
}

.measure3d-panel.is-dark .measure3d-status-bar {
  border-bottom-color: rgba(51, 65, 85, 0.85);
}

.measure3d-status-text {
  font-size: 11px;
  color: #0369a1;
  line-height: 1.35;
  flex: 1;
}

.measure3d-panel.is-dark .measure3d-status-text {
  color: #7dd3fc;
}

.measure3d-snap-chk {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #475569;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.measure3d-panel.is-dark .measure3d-snap-chk {
  color: #cbd5e1;
}

.measure3d-section {
  padding: 8px 12px 10px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}

.measure3d-section:last-child {
  border-bottom: none;
}

.measure3d-section.hidden {
  display: none;
}

.measure3d-panel.is-dark .measure3d-section {
  border-bottom-color: rgba(51, 65, 85, 0.8);
}

.measure3d-sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 600;
  color: #475569;
}

.measure3d-panel.is-dark .measure3d-sec-head {
  color: #cbd5e1;
}

.measure3d-link-btn {
  border: none;
  background: transparent;
  color: #2563eb;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  padding: 0 2px;
}

.measure3d-link-btn:hover {
  text-decoration: underline;
}

.measure3d-panel.is-dark .measure3d-link-btn {
  color: #60a5fa;
}

.measure3d-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 155px;
  overflow-y: auto;
}

.measure3d-empty {
  font-size: 11.5px;
  color: #94a3b8;
  text-align: center;
  padding: 8px 4px;
}

.measure3d-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  padding: 6px 8px;
}

.measure3d-panel.is-dark .measure3d-card {
  background: rgba(30, 41, 59, 0.72);
  border-color: #334155;
}

.measure3d-card-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.measure3d-card-top strong {
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  flex: 1;
}

.measure3d-card-del {
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 14px;
  cursor: pointer;
  padding: 0 3px;
  line-height: 1;
}

.measure3d-card-del:hover {
  color: #ef4444;
}

.measure3d-card-sub {
  margin-top: 3px;
  font-size: 10.5px;
  color: #64748b;
  font-variant-numeric: tabular-nums;
}

.measure3d-panel.is-dark .measure3d-card-sub {
  color: #94a3b8;
}

.m3d-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
}

.m3d-badge.dist { background: #e0f2fe; color: #0369a1; }
.m3d-badge.diam { background: #d1fae5; color: #047857; }
.m3d-badge.face { background: #f3e8ff; color: #7e22ce; }

.measure3d-feat-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 112px;
  overflow-y: auto;
}

.measure3d-feat-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 3px 7px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.12s;
}

.measure3d-feat-chip:hover {
  border-color: #f59e0b;
  color: #b45309;
}

.measure3d-feat-chip.active {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #b45309;
}

.measure3d-feat-qty {
  font-size: 10px;
  color: #64748b;
}

.measure3d-feat-chip.active .measure3d-feat-qty {
  color: #92400e;
}

.measure3d-panel.is-dark .measure3d-feat-chip {
  background: #0f172a;
  border-color: #475569;
  color: #cbd5e1;
}

.measure3d-panel.is-dark .measure3d-feat-chip.active {
  background: rgba(245, 158, 11, 0.25);
  border-color: #fbbf24;
  color: #fde68a;
}


/* ---------------- 3D Viewing Tools Dropdown ("看图工具") ---------------- */
.tools3d-dropdown {
  position: relative;
  display: inline-block;
}

.tools3d-active-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 999px;
  background: #2563eb;
  color: #ffffff;
  line-height: 1;
}

.tools3d-active-badge.hidden {
  display: none;
}

.tools3d-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 224px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
  padding: 6px;
  z-index: 45;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tools3d-menu.hidden {
  display: none;
}

.tools3d-menu-group {
  font-size: 10.5px;
  font-weight: 700;
  color: #94a3b8;
  padding: 4px 8px 2px;
  letter-spacing: 0.3px;
}

.tools3d-menu-sep {
  height: 1px;
  background: #e2e8f0;
  margin: 4px 4px;
}

.tools3d-menu-item {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: #1e293b;
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 9px;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.tools3d-menu-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.tools3d-menu-item.active {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.tools3d-item-left {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tools3d-item-sub {
  font-size: 10.5px;
  color: #64748b;
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 999px;
  white-space: nowrap;
}

.tools3d-menu-item.active .tools3d-item-sub {
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 600;
}
