@font-face {
  font-family: "Pretendard Variable";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/PretendardVariable.woff2") format("woff2");
}

:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --surface-hover: #eff6ff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #dbe3ef;
  --line-strong: #cbd5e1;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #eff6ff;
  --danger: #dc2626;
  --warn: #d97706;
  --ok: #16a34a;
  --left-w: 296px;
  --insp-w: 380px;
  --drawer-h: 225px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 13px/1.5 "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }

.studio-shell {
  display: grid;
  grid-template-rows: 44px 30px minmax(0, 1fr) 24px;
  height: 100vh;
  width: 100vw;
}

.lucide { vertical-align: middle; flex-shrink: 0; }
kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface-alt);
  color: var(--ink-2);
  font-size: 10.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- Top Bar (Fixed 44px) ---------- */
.topbar {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  min-width: 0;
  z-index: 32;
}

.top-left, .top-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: #0f172a;
  color: #fff;
}

.brand-name {
  font-size: 12px;
  letter-spacing: .7px;
  color: var(--ink);
  font-weight: 700;
}
.brand-badge {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border: 1px solid #bfdbfe;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

.divider-v { width: 1px; height: 18px; background: var(--line); margin: 0 3px; }

.top-select {
  height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  max-width: 260px;
}

.dirty-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  flex-shrink: 0;
}
.dirty-dot[hidden] { display: none; }

.tbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.tbtn:hover { background: var(--surface-alt); border-color: #94a3b8; color: var(--ink); }
.tbtn.icon-only { width: 28px; padding: 0; }
.tbtn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.tbtn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.tbtn:disabled { opacity: .45; cursor: not-allowed; }

.nl-trigger {
  background: var(--surface-alt);
  color: var(--ink);
}
.nl-trigger .kbd-hint {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font-weight: 600;
}

/* ---------- Desktop Menu Bar (30px) ---------- */
.menubar {
  height: 30px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  z-index: 30;
}
.menu-item { position: relative; }
.menu-trigger {
  height: 24px;
  padding: 0 9px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.menu-trigger:hover { background: var(--surface-alt); color: var(--ink); }
.menu-trigger[aria-expanded="true"] { background: #e2e8f0; color: var(--ink); font-weight: 600; }

.menu-popup {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 4px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .12);
  z-index: 90;
}
.menu-popup[hidden] { display: none; }
.mitem {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 6px 9px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.mitem:hover { background: var(--accent-soft); color: var(--accent-dark); }
.mitem kbd { font-size: 10px; padding: 0 4px; }
.msep { height: 1px; background: var(--line); margin: 4px 2px; }

/* ---------- Workspace Layout ---------- */
.workspace {
  display: flex;
  min-height: 0;
  min-width: 0;
  position: relative;
  overflow: hidden;
}

/* Left Panel */
.left-panel {
  width: var(--left-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.workspace.left-collapsed .left-panel,
.workspace.left-collapsed #left-resizer { display: none; }

.workspace.left-autohide #left-resizer { display: none; }
.workspace.left-autohide .left-panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  box-shadow: 8px 0 28px rgba(15, 23, 42, .14);
  transform: translateX(-100%);
  transition: transform .16s ease;
  z-index: 18;
}
.workspace.left-autohide.left-peek .left-panel { transform: translateX(0); }

.workspace.left-floating #left-resizer { display: none; }
.workspace.left-floating .left-panel {
  position: fixed;
  top: var(--left-float-y, 84px);
  left: var(--left-float-x, 18px);
  height: min(76vh, 720px);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, .18);
  z-index: 40;
}

.left-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-alt);
  flex-shrink: 0;
}

.left-autohide-edge {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  padding: 12px 5px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-dark);
  box-shadow: 2px 2px 10px rgba(15, 23, 42, .08);
  z-index: 15;
  cursor: pointer;
}

.left-panel-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.left-panel-body > * {
  flex-shrink: 0;
}

.v-resizer {
  width: 5px;
  flex-shrink: 0;
  cursor: col-resize;
  background: transparent;
  position: relative;
  z-index: 12;
}
.v-resizer:hover, .v-resizer.dragging { background: #93c5fd; }

.h-resizer {
  height: 5px;
  flex-shrink: 0;
  cursor: row-resize;
  background: transparent;
  border-top: 1px solid var(--line);
}
.h-resizer:hover, .h-resizer.dragging { background: #93c5fd; }

/* ---------- Center Workspace ---------- */
.center-pane {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.canvas-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.canvas-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.ctab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}
.ctab:hover { background: var(--surface-alt); color: var(--ink); }
.ctab[aria-selected="true"] {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-color: #bfdbfe;
}

.canvas-tools { display: flex; align-items: center; gap: 5px; }
.zoom-lbl { font-size: 11px; color: var(--muted); min-width: 38px; text-align: center; font-variant-numeric: tabular-nums; }

.canvas-viewport {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 20px;
  background-color: #eef3f9;
  background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
  background-size: 18px 18px;
  position: relative;
}
.canvas-viewport.drop-active { outline: 2px dashed var(--accent); outline-offset: -8px; background-color: #eff6ff; }

.drawing-sheet {
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--line-strong);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .08);
  border-radius: 3px;
}
.drawing-sheet svg {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-select: none;
}
.df-stage, .canvas-stage {
  user-select: none;
  -webkit-user-select: none;
}
.drawing-sheet [data-df-obj] .df-asm-grab-tab {
  opacity: 0;
  transition: opacity .12s ease;
  cursor: grab;
}
.drawing-sheet [data-df-obj]:hover .df-asm-grab-tab,
.drawing-sheet [data-df-obj][data-selected="true"] .df-asm-grab-tab {
  opacity: 1;
}
.drawing-sheet [data-select] { cursor: pointer; }
.drawing-sheet [data-drag] { cursor: grab; }
.drawing-sheet [data-drag]:active { cursor: grabbing; }
.drawing-sheet [data-select]:hover { opacity: .88; }
.drawing-sheet [data-selected="true"]:not([data-df-frameless="1"]) > rect,
.drawing-sheet [data-selected="true"]:not([data-df-frameless="1"]) > circle,
.drawing-sheet [data-selected="true"]:not([data-df-frameless="1"]) > path {
  stroke: #2563eb;
  filter: drop-shadow(0 0 4px rgba(37, 99, 235, .45));
}
.drawing-sheet [data-df-obj][data-selected="true"] > .df-sel-rect {
  stroke: #2563eb;
  stroke-width: 1.2px;
}
.drawing-sheet [data-df-frameless="1"][data-selected="true"] .conn-art-body {
  filter: drop-shadow(0 0 3.5px rgba(37, 99, 235, .6));
}
.drawing-sheet [data-select^="pin:"][data-selected="true"] { cursor: crosshair; }
.drawing-sheet [data-select^="pin:"][data-wire-drop-hover="true"] > rect,
.drawing-sheet [data-select^="pin:"][data-wire-drop-hover="true"] > circle {
  stroke: #16a34a;
  stroke-width: 2.2px;
  fill: #dcfce7;
  filter: drop-shadow(0 0 5px rgba(22, 163, 74, .55));
}
.wire-drag-preview { pointer-events: none; }
body.wire-dragging {
  user-select: none;
  cursor: crosshair;
}
.drawing-sheet [data-edit-seg] { cursor: pointer; }
.drawing-sheet [data-wedit] {
  cursor: text;
  transition: fill .12s ease, opacity .12s ease;
}
.drawing-sheet [data-wedit]:hover {
  fill: #2563eb;
  text-decoration: underline;
  text-decoration-style: dotted;
}
.svg-inline-editor {
  position: absolute;
  z-index: 40;
  font-family: var(--font, 'Pretendard Variable', 'Malgun Gothic', sans-serif);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  background: #ffffff;
  border: 2px solid var(--accent);
  border-radius: 5px;
  padding: 2px 7px;
  box-shadow: 0 4px 16px rgba(37, 99, 235, .25);
  outline: none;
}

/* Bottom Drawer */
.bottom-drawer {
  height: var(--drawer-h);
  flex-shrink: 0;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-height: 32px;
}
.bottom-drawer.collapsed { height: 32px; }
.bottom-drawer.collapsed .drawer-body { display: none; }

.drawer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  height: 32px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-alt);
  flex-shrink: 0;
}
.drawer-tabs { display: flex; gap: 4px; }
.dtab {
  border: 0;
  background: transparent;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.dtab[aria-selected="true"] { color: var(--accent-dark); border-bottom-color: var(--accent); }
.badge {
  font-size: 10px;
  background: #e2e8f0;
  color: var(--ink-2);
  padding: 1px 5px;
  border-radius: 99px;
}
.dtab[aria-selected="true"] .badge { background: #dbeafe; color: var(--accent-dark); }

.drawer-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0;
}

/* ---------- Right Property Inspector ---------- */
.inspector-shell {
  width: var(--insp-w);
  height: 100%;
  max-height: 100%;
  flex-shrink: 0;
  background: var(--surface);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  z-index: 18;
}

.workspace.inspector-closed .inspector-shell,
.workspace.inspector-closed #inspector-resizer { display: none; }

.workspace.inspector-autohide #inspector-resizer { display: none; }
.workspace.inspector-autohide .inspector-shell {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  box-shadow: -8px 0 28px rgba(15, 23, 42, .14);
  transform: translateX(100%);
  transition: transform .16s ease;
}
.workspace.inspector-autohide.inspector-peek .inspector-shell {
  transform: translateX(0);
}

.workspace.inspector-floating #inspector-resizer { display: none; }
.workspace.inspector-floating .inspector-shell {
  position: fixed;
  top: var(--float-y, 84px);
  left: var(--float-x, auto);
  right: var(--float-r, 20px);
  height: min(76vh, 720px);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, .18);
  z-index: 40;
}

.autohide-edge {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  padding: 12px 5px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-right: 0;
  border-radius: 8px 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-dark);
  box-shadow: -2px 2px 10px rgba(15, 23, 42, .08);
  z-index: 15;
}

.inspector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-alt);
  flex-shrink: 0;
}
.insp-title-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.insp-grip { color: var(--muted); cursor: move; font-size: 13px; user-select: none; }
.insp-title-row strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.insp-actions { display: flex; gap: 3px; }
.ibtn {
  width: 26px;
  height: 26px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.ibtn:hover { background: #e2e8f0; color: var(--ink); }
.ibtn[aria-pressed="true"] { background: var(--accent-soft); border-color: #93c5fd; color: var(--accent-dark); }

.insp-tabs {
  display: flex;
  gap: 4px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  background: var(--surface);
  flex-shrink: 0;
}
.insp-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--surface-alt);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.insp-tab.active { background: var(--accent-soft); border-color: #93c5fd; color: var(--accent-dark); }
.insp-tab-close { border: 0; background: transparent; padding: 0 2px; font-size: 11px; color: var(--muted); }
.insp-tab-close:hover { color: var(--danger); }

.insp-breadcrumb {
  padding: 5px 12px;
  font-size: 11px;
  color: var(--muted);
  background: #fafcff;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.insp-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  padding: 10px 12px 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.insp-body > * {
  flex-shrink: 0;
}

/* ---------- Inspector & Panel Widgets ---------- */
.sec-card {
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}
.pin-color-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--muted);
}
.pin-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  vertical-align: -1px;
  margin-right: 3px;
  border: 1px solid rgba(15, 23, 42, .25);
}
.pin-legend-dot.dup {
  background: #f59e0b;
  border-color: #b45309;
}
.pin-in-num.has-wire {
  font-weight: 700;
}
.pin-in-num.dup-pin {
  background: #f59e0b !important;
  color: #1c1917 !important;
  border-color: #b45309 !important;
  font-weight: 800;
}
.pin-mini-btn.dup {
  background: #fef3c7 !important;
  color: #b45309 !important;
  border-color: #f59e0b !important;
  font-weight: 700;
}
.sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
}
.sec-card.collapsed .sec-head { border-bottom: 0; }
.sec-card.collapsed .sec-body { display: none; }
.sec-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; }

.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fgrid .span-2 { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field > label, .field > span { font-size: 11px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 5px 8px;
  font-size: 12px;
  background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid #93c5fd;
  outline-offset: 0;
  border-color: var(--accent);
}
.field textarea { resize: vertical; min-height: 54px; }

.check-row { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); }
.check-row input[type="checkbox"] { accent-color: var(--accent); width: 14px; height: 14px; }

.btn-row { display: flex; flex-wrap: wrap; gap: 6px; }
.sec-title-wrap { display: inline-flex; align-items: center; gap: 5px; }
.sec-chev { display: inline-flex; color: var(--muted); }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; }

.sbtn {
  padding: 5px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-2);
}
.sbtn.icon-btn { display: inline-flex; align-items: center; gap: 4px; }
.sbtn:hover { background: var(--surface-alt); border-color: #94a3b8; color: var(--ink); }
.sbtn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.sbtn.primary:hover { background: var(--accent-dark); color: #fff; }
.sbtn.danger { color: var(--danger); border-color: #fecaca; }
.sbtn.danger:hover { background: #fef2f2; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent-dark);
}
.pill.ok { background: #dcfce7; color: #166534; }
.pill.warn { background: #fef3c7; color: #92400e; }
.pill.err { background: #fee2e2; color: #991b1b; }

.swatch { vertical-align: middle; flex-shrink: 0; }

/* Pin mini grid & Inline Editable Pin Table inside Inspector */
.pin-edit-table {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 290px;
  overflow-y: auto;
  padding-right: 2px;
}
.pin-edit-head {
  display: grid;
  grid-template-columns: 62px 1fr 68px;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  padding: 0 2px;
}
.pin-edit-row {
  display: grid;
  grid-template-columns: 62px 1fr 68px;
  gap: 5px;
  align-items: center;
}
.pin-edit-row input {
  width: 100%;
  min-width: 0;
  padding: 4px 6px;
  font-size: 11.5px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #fff;
}
.pin-edit-row input.pin-in-num {
  font-weight: 700;
  text-align: center;
  background: #f8fafc;
}
.pin-edit-row input:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(37, 99, 235, .15);
}
.pin-row-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  justify-content: flex-end;
}
.pin-mini-btn {
  padding: 4px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface-alt);
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.pin-mini-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.pin-mini-btn.used { border-color: #93c5fd; background: #eff6ff; color: var(--accent-dark); }
.pin-mini-btn.empty { color: var(--muted); border-style: dashed; }
.pin-mini-del {
  width: 20px;
  height: 22px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.pin-mini-del:hover { color: #dc2626; background: #fee2e2; border-color: #fecaca; }

.pin-mini-grid {
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
}
.pin-chip {
  padding: 5px 4px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface-alt);
  text-align: center;
  font-size: 11px;
  font-weight: 700;
}
.pin-chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.pin-chip.used { border-color: #93c5fd; background: #eff6ff; color: var(--accent-dark); }
.pin-chip.empty { color: var(--muted); border-style: dashed; }
.pin-chip.selected { outline: 2px solid var(--accent); }

/* Top view preview box */
.tv-preview {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: repeating-conic-gradient(#f1f5f9 0% 25%, #fff 0% 50%) 50% / 14px 14px;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 92px;
}
.tv-preview img,
.tv-preview svg { max-width: 100%; max-height: 110px; width: auto; height: auto; object-fit: contain; }

/* 6-view orthographic thumbnail picker in inspector */
.pv-6v-wrap { display: flex; flex-direction: column; gap: 6px; }
.pv-6v-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 11px; font-weight: 700; color: var(--ink-2); }
.pv-6v-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.pv-6v-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 5px 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-alt);
  cursor: pointer;
  color: var(--ink-2);
  transition: border-color .12s ease, background .12s ease;
}
.pv-6v-tile:hover:not(:disabled) { border-color: var(--accent); background: #eff6ff; }
.pv-6v-tile[aria-pressed="true"] {
  border-color: var(--accent);
  background: #dbeafe;
  color: var(--accent-ink);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.pv-6v-tile:disabled { opacity: .42; cursor: not-allowed; }
.pv-6v-thumb {
  width: 100%;
  height: 44px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  overflow: hidden;
}
.pv-6v-thumb svg,
.pv-6v-thumb img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.pv-6v-lbl { font-size: 10px; font-weight: 600; line-height: 1.2; white-space: nowrap; }

/* Left panel cards & lists */
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.panel-head h2 { font-size: 13px; margin: 0; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip-btn {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-alt);
  font-size: 11px;
  color: var(--ink-2);
}
.chip-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

.list-stack { display: flex; flex-direction: column; gap: 5px; }
.lib-card {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 9px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
}
.lib-card:hover { border-color: #94a3b8; background: var(--surface-alt); }
.lib-card.active { border-color: var(--accent); background: var(--accent-soft); }
.lib-card-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.lib-card-top strong { font-size: 12px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-card small { font-size: 11px; color: var(--muted); }
.lib-card-term { font-size: 10.5px; color: var(--accent-dark); font-weight: 600; }

/* Tables in Drawer and Matrix */
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th {
  position: sticky;
  top: 0;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--line-strong);
  text-align: left;
  padding: 6px 8px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
  z-index: 2;
}
.data-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #eef2f6;
  white-space: nowrap;
}
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover { background: #f8fbff; }
.data-table tbody tr.selected { background: #eff6ff; }
.data-table input, .data-table select {
  padding: 3px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 11px;
  background: #fff;
}

/* PDF Split & Cropper View */
.pdf-split {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 14px;
  height: 100%;
  min-height: 460px;
}
.pdf-stage-pane, .pdf-side-pane {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.pane-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.crop-scroll { flex: 1; overflow: auto; padding: 12px; background: #e2e8f0; display: flex; justify-content: center; align-items: flex-start; }
.crop-box { position: relative; display: inline-block; user-select: none; box-shadow: 0 4px 16px rgba(0, 0, 0, .15); }
.crop-box img { display: block; max-width: 100%; height: auto; }
.crop-box.cropping { cursor: crosshair; }
.crop-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.crop-rect { fill: rgba(37, 99, 235, .18); stroke: #2563eb; stroke-width: .004; stroke-dasharray: .01 .006; }
.detected-rect { fill: rgba(22, 163, 74, .12); stroke: #16a34a; stroke-width: .003; }
.pdf-side-scroll { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }

/* Status Bar */
.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}
.status-msg[data-error="true"] { color: var(--danger); font-weight: 600; }
.status-right { display: flex; align-items: center; gap: 12px; }
.status-pill { padding: 1px 6px; border-radius: 4px; background: var(--surface-alt); border: 1px solid var(--line); }

/* Modal */
.modal-dialog {
  border: 0;
  padding: 0;
  border-radius: 12px;
  width: min(760px, 94vw);
  max-height: 88vh;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .25);
}
.modal-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.modal-box { display: flex; flex-direction: column; max-height: 88vh; background: #fff; }
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.eyebrow { font-size: 10px; letter-spacing: 1.4px; color: var(--accent); font-weight: 700; display: block; }
.modal-head h2 { margin: 2px 0 0; font-size: 16px; }
.modal-body { padding: 16px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }

.provider-tabs { display: flex; gap: 6px; }
.ptab {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface-alt);
  font-weight: 600;
  text-align: center;
}
.ptab.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-dark); }
.code-box {
  background: #0f172a;
  color: #e2e8f0;
  padding: 10px 12px;
  border-radius: 7px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  overflow-x: auto;
  white-space: pre;
}

.warning-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  padding: 7px 10px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
}
.warning-row:hover { background: #f8fbff; }
.warning-row.active {
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
  padding-left: 7px;
}
.warning-msg { font-weight: 600; color: var(--ink); }
.drc-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border-radius: 5px;
  background: #f1f5f9;
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 10.5px;
}
.drc-chip b { color: var(--accent-dark); font-weight: 700; }
.drc-focus-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 10px;
  background: #fffbeb;
  border-bottom: 1px solid #fde68a;
  font-size: 11px;
  color: #78350f;
}
.drc-focus-left { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.drc-focus-badge {
  font-weight: 700;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #f59e0b;
  color: #ffffff;
}
.drc-focus-actions { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; }

.muted-box {
  padding: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 11.5px;
  color: var(--muted);
}

/* ---------- Left Segmented Explorer & Slim Drawing Toolbar ---------- */
.left-seg-header {
  padding: 6px 8px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.seg-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  padding: 2px;
  background: #e2e8f0;
  border-radius: 6px;
}
.seg-btn {
  height: 24px;
  padding: 0 4px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn[aria-selected="true"] {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
}

.sub-seg-row {
  display: flex;
  gap: 2px;
  padding: 2px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 5px;
}
.sub-seg-btn {
  flex: 1;
  height: 22px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.sub-seg-btn:hover { color: var(--ink); }
.sub-seg-btn[aria-pressed="true"] {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
}

.center-split-body {
  display: flex;
  flex: 1;
  min-height: 0;
  min-width: 0;
}
.draw-rail {
  width: 42px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px;
  gap: 4px;
  z-index: 8;
}
.dtool-btn {
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.dtool-btn:hover { background: var(--surface-alt); color: var(--ink); border-color: var(--line); }
.dtool-btn[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #93c5fd;
}
.draw-sep { width: 24px; height: 1px; background: var(--line); margin: 3px 0; }
.draw-spacer { flex: 1; }
.center-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.modal-nl { width: min(560px, 94vw); }

/* ---------- Explorer Folder Tree & DB Cards ---------- */
.fld-head-btns { display: flex; gap: 4px; }
.primary-chip { background: var(--accent-soft); border-color: #bfdbfe; color: var(--accent-dark); font-weight: 700; }

.folder-tree {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 195px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px;
  background: var(--surface-alt);
}
.folder-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 5px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 11.5px;
}
.folder-row:hover { background: #e8effa; }
.folder-row.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 700; }
.folder-row.drop-target { outline: 2px dashed var(--accent); background: #dbeafe; }
.folder-depth-0 { padding-left: 4px; }
.folder-depth-1 { padding-left: 16px; }
.folder-depth-2 { padding-left: 28px; }
.folder-depth-3 { padding-left: 40px; }
.folder-depth-4 { padding-left: 52px; }
.fld-chev {
  border: 0;
  background: transparent;
  width: 16px;
  height: 16px;
  padding: 0;
  font-size: 10px;
  color: var(--muted);
  flex-shrink: 0;
}
.fld-chev.invisible { visibility: hidden; }
.fld-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fld-actions { display: none; gap: 2px; }
.folder-row:hover .fld-actions { display: inline-flex; }
.fld-mini {
  border: 0;
  background: rgba(255, 255, 255, .8);
  border-radius: 3px;
  width: 17px;
  height: 17px;
  padding: 0;
  font-size: 11px;
  line-height: 1;
}
.fld-mini:hover { background: #fff; color: var(--accent); }
.fld-mini.danger:hover { color: var(--danger); }
.exp-proj-title {
  font-size: 11.5px;
  color: var(--ink-2);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- VS Code Multi-View Editor Groups & Tab Bars ---------- */
.editor-groups-stage {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--line);
}
.editor-groups-stage.split-vertical { flex-direction: row; }
.editor-groups-stage.split-horizontal { flex-direction: column; }

.editor-group {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid transparent;
}
.editor-group.active { border-color: #93c5fd; }

.editor-group.minimized {
  flex: 0 0 auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
}
.editor-groups-stage.split-vertical .editor-group.minimized { width: 175px; }
.editor-groups-stage.split-horizontal .editor-group.minimized { height: 32px; }
.eg-min-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  cursor: pointer;
  background: var(--surface-alt);
  font-size: 11.5px;
  width: 100%;
  height: 100%;
}
.eg-min-bar:hover { background: #e2e8f0; color: var(--ink); }
.eg-min-bar small { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }

.eg-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #edf2f8;
  border-bottom: 1px solid var(--line);
  min-height: 31px;
  padding: 0 4px 0 6px;
  gap: 6px;
}
.eg-tabs-scroll {
  display: flex;
  align-items: center;
  gap: 3px;
  overflow-x: auto;
  flex: 1;
  min-width: 0;
  padding-top: 3px;
}
.eg-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 210px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: #e2e8f0;
  color: var(--ink-2);
  font-size: 11.5px;
  cursor: pointer;
  flex-shrink: 0;
}
.eg-tab:hover { background: #f8fafc; }
.eg-tab.active {
  background: var(--surface);
  color: var(--accent-dark);
  border-color: var(--line);
  font-weight: 700;
}
.eg-tab-pn { font-weight: 700; white-space: nowrap; }
.eg-tab-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 400;
  color: var(--muted);
  font-size: 11px;
}
.eg-dirty { color: var(--accent); font-size: 10px; line-height: 1; }
.eg-tab-close {
  border: 0;
  background: transparent;
  padding: 0 2px;
  font-size: 12px;
  color: var(--muted);
  border-radius: 3px;
}
.eg-tab-close:hover { background: #fee2e2; color: var(--danger); }

.eg-win-btns { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.ibtn.sm { width: 22px; height: 22px; font-size: 11px; }

.eg-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.drawer-win-btns { display: flex; align-items: center; gap: 3px; }

/* Workspace Maximization States */
.workspace.max-canvas #bottom-drawer,
.workspace.max-canvas #drawer-resizer,
.workspace.max-canvas #inspector-resizer { display: none; }

.workspace.max-drawer #editor-groups-stage,
.workspace.max-drawer #drawer-resizer { display: none; }
.workspace.max-drawer #bottom-drawer { flex: 1; height: auto; }

/* ---------- Project Bundle Subfiles, BOM Workspace & Draftsman Sheet ---------- */
.proj-subfiles {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding-top: 4px;
  border-top: 1px dashed var(--line);
}
.proj-subfiles .chip-btn {
  font-size: 10px;
  padding: 2px 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.bom-work-wrap {
  max-width: 1220px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bom-work-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
}
.bom-work-title h2 { font-size: 15px; margin: 0 0 2px; color: var(--ink); }
.bom-work-title small { font-size: 11.5px; color: var(--muted); }
.bom-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
}
.bom-stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.bom-stat span { font-size: 11px; color: var(--muted); }
.bom-stat strong { font-size: 15px; color: var(--ink); }
.bom-col-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
}
.bom-table-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
}
.bom-edit-table .tbl-in {
  width: 100%;
  min-width: 72px;
  padding: 3px 6px;
  font-size: 11.5px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
}
.bom-edit-table .tbl-in.num { max-width: 58px; text-align: right; }
.bom-edit-table tr.row-muted { opacity: .55; }

.df-bar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 10px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.df-bar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}
.df-bar-row .btn-row { display: flex; align-items: center; gap: 4px; flex-wrap: nowrap; }
.df-bar-row > .btn-row:last-child { margin-left: auto; }
.df-bar .top-select.compact {
  height: 26px;
  font-size: 11px;
  max-width: 220px;
  box-sizing: border-box;
}
.df-bar .sbtn,
.df-bar .chip-btn {
  height: 26px;
  padding: 0 7px;
  font-size: 11px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.df-sheet-tabs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.df-stage { padding: 20px 28px; }
.df-stage .drawing-sheet svg { overflow: visible; }
.df-stage [data-df-drag-obj] { cursor: grab; }
.df-stage [data-df-resize-obj] { cursor: nwse-resize; }
.df-stage [data-df-dim-drag] { cursor: grab; }
.df-stage [data-df-dim-drag]:active { cursor: grabbing; }
.df-stage [data-df-dim-rail] { cursor: ns-resize; }
.df-stage [data-df-dim-p1],
.df-stage [data-df-dim-p2],
.df-stage [data-df-lbl-anchor],
.df-stage [data-df-lbl-flag] { cursor: move; }

/* ---------- 2D Datasheet -> 2D DWG / 3D STEP Reconstructor Workbench ---------- */
.cb-split {
  display: grid;
  grid-template-columns: minmax(320px, 410px) minmax(420px, 1fr);
  gap: 12px;
  align-items: start;
}
.cb-left, .cb-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.cb-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.cb-3d-wrap {
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f6 100%);
  border-top: 1px solid var(--line);
  padding: 6px;
}
.cad-3d-canvas {
  width: 100%;
  height: 300px;
  display: block;
  cursor: grab;
  border-radius: 6px;
}
.cad-3d-canvas:active { cursor: grabbing; }
.cb-2d-sheet {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  overflow: auto;
  padding: 6px;
}
.cb-2d-sheet svg {
  width: 100%;
  height: auto;
  display: block;
}
.cb-ortho-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.cb-ortho-card {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cb-ortho-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-2);
}
.cb-ortho-title small { color: var(--muted); font-weight: 500; }
.cb-ortho-svg {
  min-height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border-radius: 5px;
  padding: 6px;
}
.cb-ortho-svg svg { max-width: 100%; max-height: 135px; }
.cb-spec-summary {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--ink);
}
.cb-adv-details {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}
.cb-adv-details > summary {
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}
.cb-adv-details[open] > summary {
  border-bottom: 1px solid var(--line);
}
.cb-adv-details-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cb-example-pill {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  font-weight: 700;
}
.cb-credit-est-box {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--line);
  margin: 8px 0;
  font-size: 12px;
}
.cb-credit-est-box div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cb-credit-est-box small { color: var(--muted); font-size: 11px; }
.cb-credit-est-box strong { color: var(--ink); font-size: 13.5px; }
.cb-credit-warn {
  padding: 8px 10px;
  border-radius: 6px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 12px;
  margin-top: 6px;
}
.cb-credit-hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}
.cb-db-table-wrap {
  max-height: 310px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}
.cb-db-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}
.cb-db-table th {
  position: sticky;
  top: 0;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--line);
  padding: 6px 8px;
  text-align: left;
  font-weight: 700;
  color: var(--ink-2);
  white-space: nowrap;
}
.cb-db-table td {
  padding: 5px 8px;
  border-bottom: 1px solid #f1f5f9;
  white-space: nowrap;
}
.cb-db-table tr { cursor: pointer; }
.cb-db-table tbody tr:hover { background: #f8fbff; }
.cb-db-table tbody tr.active { background: var(--accent-soft); font-weight: 700; }

/* Canvas Right-Click Context Menu & Interactive CAD Tool States */
.ctx-menu {
  position: fixed;
  min-width: 214px;
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 5px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .18);
  z-index: 220;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.ctx-menu[hidden] { display: none; }
.ctx-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 9px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.ctx-item:hover { background: var(--accent-soft); color: var(--accent-dark); }
.ctx-item.danger:hover { background: #fee2e2; color: #b91c1c; }
.ctx-item-left { display: inline-flex; align-items: center; gap: 7px; }
.ctx-item kbd { font-size: 10px; padding: 0 4px; }
.ctx-sep { height: 1px; background: var(--line); margin: 4px 3px; }
.ctx-head {
  font-size: 10.5px;
  font-weight: 700;
  color: #475569;
  padding: 4px 10px 5px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 3px;
}
.ctx-sub-wrap { position: relative; }
.ctx-submenu {
  position: absolute;
  left: calc(100% + 2px);
  top: -4px;
  min-width: 190px;
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 5px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .18);
  display: none;
  flex-direction: column;
  gap: 1px;
  z-index: 225;
}
.ctx-sub-wrap:hover > .ctx-submenu,
.ctx-sub-wrap:focus-within > .ctx-submenu { display: flex; }

body.cad-pick-move .canvas-viewport,
body.cad-move-active .canvas-viewport,
body.cad-bundle-mode .canvas-viewport { cursor: crosshair; }
body.cad-text-mode .canvas-viewport { cursor: text; }
body.cad-wire-exit-drag .canvas-viewport { cursor: grabbing; }
[data-wir-resize], [data-layout-resize] { cursor: nwse-resize; }
[data-wir-resize]:hover, [data-layout-resize]:hover { fill: #1d4ed8; }
[data-wire-exit-drag] { cursor: grab; }
[data-wire-exit-drag]:hover rect { stroke: #2563eb; stroke-width: 2; }
[data-drag-balloon] { cursor: grab; }
[data-drag-balloon]:hover circle { stroke: #2563eb; stroke-width: 2; }
.cad-italic { font-style: italic; }

/* Layout Sub-View Bar (Pinmap / Borderless 2D Physical / Both) */
.eg-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 10px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}
.subbar-left { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.subbar-lbl { font-weight: 700; color: var(--ink-2); font-size: 11px; }
.subbar-pills { display: inline-flex; gap: 3px; background: #e2e8f0; padding: 2px; border-radius: 6px; }
.subbar-pill {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 5px;
  cursor: pointer;
}
.subbar-pill:hover { background: rgba(255, 255, 255, .7); color: var(--ink); }
.subbar-pill[aria-pressed="true"] {
  background: #ffffff;
  color: var(--accent-dark);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .12);
}
.subbar-hint { color: var(--muted); font-size: 10.5px; }

/* Reference 6-view toggles in Inspector */
.pv-ref-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.pv-ref-chip {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink-2);
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
}
.pv-ref-chip[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}
.pv-ref-chip:disabled { opacity: .4; cursor: not-allowed; }

/* Near-Mouse Floating Rich Text Formatting Toolbar */
.text-fmt-popover {
  position: fixed;
  z-index: 260;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 7px;
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, .2);
}
.tf-select {
  height: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
  padding: 0 4px;
}
.tf-btn {
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}
.tf-btn:hover { background: var(--surface-alt); }
.tf-btn[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-color: #93c5fd;
}
.tf-btn-italic { font-style: italic; font-family: Georgia, serif; }
.tf-btn-under { text-decoration: underline; }
.tf-sep { width: 1px; height: 16px; background: var(--line); margin: 0 2px; }
.tf-swatch {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  box-shadow: 0 0 0 1px #94a3b8;
  cursor: pointer;
  padding: 0;
}
.tf-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--accent); }
.tf-swatch[data-tc="#0f172a"] { background: #0f172a; }
.tf-swatch[data-tc="#1d4ed8"] { background: #1d4ed8; }
.tf-swatch[data-tc="#dc2626"] { background: #dc2626; }
.tf-swatch[data-tc="#16a34a"] { background: #16a34a; }
.tf-swatch[data-tc="#b45309"] { background: #b45309; }
.tf-swatch[data-tc="#7c3aed"] { background: #7c3aed; }
.tf-color-in {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}

.cad-italic { font-style: italic; }

/* Dedicated Library Manager Modal & Multi-Document Queue */
.modal-library {
  width: min(1340px, 95vw);
  max-height: 92vh;
}
.modal-library::backdrop {
  background: rgba(15, 23, 42, .58);
  backdrop-filter: blur(2px);
}
.modal-library .modal-box { max-height: 92vh; }
.lib-manager-body {
  background: #f1f5f9;
  padding: 14px 16px;
}
.cb-dropzone {
  border: 1.5px dashed #93c5fd;
  background: #f8fafc;
  border-radius: 8px;
  padding: 12px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.cb-dropzone:hover, .cb-dropzone.dragover {
  background: #eff6ff;
  border-color: var(--accent);
}
.cb-dropzone-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}
.cb-dropzone-sub {
  font-size: 11px;
  color: var(--muted);
}
.cb-pdf-table-wrap {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: auto;
  max-height: 180px;
  background: #ffffff;
}
.cb-pdf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}
.cb-pdf-table th, .cb-pdf-table td {
  padding: 5px 7px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}
.cb-pdf-table th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: var(--muted);
  font-weight: 700;
  font-size: 10.5px;
}
.cb-pdf-table tbody tr { cursor: pointer; }
.cb-pdf-table tbody tr:hover { background: #f8fafc; }
.cb-pdf-table tbody tr.active { background: #eff6ff; }
.cb-pdf-fname {
  max-width: 145px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}
.cb-prog-cell {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 78px;
}
.cb-prog {
  width: 48px;
  height: 7px;
  border-radius: 99px;
  accent-color: var(--accent);
}
.cb-prog-pct {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-soft);
  min-width: 30px;
}
.cb-model-table-wrap {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: auto;
  max-height: 290px;
  background: #ffffff;
}
.cb-model-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}
.cb-model-table th, .cb-model-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}
.cb-model-table th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: var(--muted);
  font-weight: 700;
  font-size: 10.5px;
}
.cb-model-table tbody tr { cursor: pointer; }
.cb-model-table tbody tr:hover { background: #f8fafc; }
.cb-model-table tbody tr.active { background: #eff6ff; font-weight: 600; }
.cb-dl-cell { display: flex; align-items: center; gap: 4px; }
.cb-mini-dl {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--accent-dark);
  font-size: 10.5px;
  font-weight: 700;
  text-decoration: none;
}
.cb-mini-dl:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.pf-alias-hint {
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}
.pf-photo-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.pf-photo-thumb {
  width: 96px;
  height: 76px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.pf-photo-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.cb-ortho-card { cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease; }
.cb-ortho-card:hover { border-color: #93c5fd; box-shadow: 0 1px 4px rgba(37, 99, 235, .1); }
.cb-ortho-card.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(37, 99, 235, .18); }
.cb-ortho-svg img { max-width: 100%; max-height: 115px; object-fit: contain; }
.cb-ve-panel {
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px 12px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cb-ve-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.cb-ve-stage {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  overflow: hidden;
}
.cb-ve-canvas {
  display: block;
  width: 100%;
  max-width: 560px;
  height: 300px;
  background-image: linear-gradient(45deg, #f1f5f9 25%, transparent 25%),
    linear-gradient(-45deg, #f1f5f9 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f1f5f9 75%),
    linear-gradient(-45deg, transparent 75%, #f1f5f9 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  border-radius: 4px;
  cursor: grab;
}
.cb-ve-canvas.crop-mode { cursor: crosshair; }

/* Center Part Detail Showcase View */
.part-center-view {
  max-width: 1160px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.part-hero-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .05);
}
.part-hero-title h2 { margin: 2px 0 4px; font-size: 18px; }
.part-showcase-grid {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(360px, 1fr);
  gap: 12px;
  align-items: start;
}
.part-meta-dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  font-size: 12px;
}
.part-meta-dl dt { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.part-meta-dl dd { margin: 1px 0 0; font-weight: 700; color: var(--ink); word-break: break-word; }
.part-photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}
.part-photo-box {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 110px;
}
.part-photo-box img { max-width: 100%; max-height: 160px; object-fit: contain; }
.part-6v-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.part-6v-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.part-6v-svg {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border-radius: 5px;
  overflow: hidden;
}
.part-6v-svg svg, .part-6v-svg img { max-width: 100%; max-height: 112px; object-fit: contain; }

/* ---------- Priority 1-3: Project Stage Tree, Office Templates, Visual Catalog & Slim Inspector ---------- */
.proj-tree-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 8px;
}
.proj-tree-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}
.proj-tree-steps {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.proj-step-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--ink-2);
  font-size: 11.5px;
  text-align: left;
  cursor: pointer;
}
.proj-step-btn:hover { background: #e8eef7; color: var(--ink); }
.proj-step-btn.active {
  background: #eff6ff;
  border-color: #93c5fd;
  color: var(--accent-dark);
  font-weight: 700;
}
.proj-tree-conns {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.insp-adv {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}
.insp-adv summary {
  padding: 6px 9px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}
.insp-adv-body { padding: 6px 9px 9px; border-top: 1px solid var(--line); }

.ot-modal-dialog, .vcat-modal-dialog {
  width: min(1140px, 95vw);
  max-width: 1140px;
}
.ot-shell {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 14px;
  min-height: 540px;
  max-height: 76vh;
}
.ot-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding-right: 4px;
}
.ot-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding-right: 4px;
}
.ot-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 14px 10px;
  border: 1.5px dashed #94a3b8;
  border-radius: 9px;
  background: #f8fafc;
  text-align: center;
  cursor: pointer;
}
.ot-dropzone:hover, .ot-dropzone.dragover {
  border-color: var(--accent);
  background: #eff6ff;
}
.ot-dropzone span { font-size: 11px; color: var(--muted); }
.cb-chk-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--ink-2);
  cursor: pointer;
}
.ot-inv-box {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ot-inv-head { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; }
.ot-inv-head small { color: var(--muted); }
.ot-inv-group { display: flex; flex-direction: column; gap: 4px; }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 4px; }
.ot-map-tbl input, .ot-map-tbl select { width: 100%; font-size: 11.5px; }
.ot-num-in { width: 64px; }
.ot-footer-actions {
  justify-content: flex-end;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.vcat-head-actions { display: flex; align-items: center; gap: 8px; }
.vcat-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 290px;
  gap: 12px;
  min-height: 520px;
  max-height: 75vh;
}
.vcat-tree, .vcat-gallery, .vcat-detail {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface);
}
.vcat-search-bar input { width: 100%; }
.vcat-tree-scroll { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.vcat-mfg-btn, .vcat-series-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  text-align: left;
}
.vcat-mfg-btn:hover, .vcat-series-btn:hover { background: var(--surface-alt); }
.vcat-mfg-btn.active { background: #eff6ff; color: var(--accent-dark); }
.vcat-series-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 14px;
  margin-top: 2px;
}
.vcat-series-btn.active {
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #0369a1;
  font-weight: 700;
}
.vcat-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
  gap: 8px;
}
.vcat-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
}
.vcat-card:hover { border-color: #93c5fd; }
.vcat-card.active { border-color: var(--accent); background: #eff6ff; }
.vcat-thumb {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border-radius: 6px;
  overflow: hidden;
}
.vcat-thumb img { max-width: 100%; max-height: 72px; object-fit: contain; }
.vcat-no-img { font-size: 13px; font-weight: 700; color: var(--muted); }
.vcat-preview-box {
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px;
}
.vcat-preview-box img { max-width: 100%; max-height: 138px; object-fit: contain; }
.vcat-meta-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  margin: 0;
  font-size: 11.5px;
}
.vcat-meta-list div { display: contents; }
.vcat-meta-list dt { color: var(--muted); font-weight: 600; }
.vcat-meta-list dd { margin: 0; color: var(--ink); word-break: break-word; }
.vcat-detail-actions { margin-top: auto; }

.vcat-wire-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 14px;
  min-height: 460px;
}
.vcat-wire-left, .vcat-wire-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface);
}
.vcat-wire-svg {
  width: 100%;
  max-height: 148px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.df-logo-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 6px 10px;
  background: #ffffff;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
}
.df-logo-box img {
  max-width: 100%;
  max-height: 44px;
  object-fit: contain;
}
.df-logo-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.lbl-kind-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 4px;
}
.lbl-kind-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  text-align: left;
  cursor: pointer;
}
.lbl-kind-card[aria-pressed="true"] {
  border-color: var(--accent);
  background: #eff6ff;
  box-shadow: 0 0 0 1px var(--accent);
}
.lbl-kind-card strong {
  font-size: 11px;
  color: var(--text);
}
.lbl-kind-card small {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.25;
}
.lbl-kind-thumb {
  width: 100%;
  display: flex;
  justify-content: center;
}
.lbl-kind-thumb svg {
  width: 100%;
  height: auto;
  max-height: 44px;
}
.cov-kind-grid .lbl-kind-thumb svg {
  max-height: 52px;
}

.lbl-swatch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  margin-top: 4px;
}
.lbl-swatch-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  font-size: 11px;
  color: var(--text);
  cursor: pointer;
}
.lbl-swatch-btn[aria-pressed="true"] {
  border-color: var(--accent);
  background: #eff6ff;
  font-weight: 700;
}

/* ---------- VS Code Explorer-style Unified Compact Left Sidebar ---------- */
.vsc-toolbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  height: 30px;
  padding: 0 8px 0 10px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--line);
}
.vsc-title {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--ink-2);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vsc-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 15px;
  padding: 0 4px;
  border-radius: 99px;
  background: #e2e8f0;
  color: var(--ink-2);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.vsc-tool-icons {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.vsc-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.vsc-icon-btn:hover {
  background: #e2e8f0;
  color: var(--ink);
}

.vsc-search-bar {
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.vsc-pdf-cta-wrap {
  padding: 6px 8px 4px;
  background: var(--surface);
}
.vsc-pdf-cta {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 7px 9px;
  border: 1.5px dashed #93c5fd;
  border-radius: 7px;
  background: #eff6ff;
  color: var(--accent-dark);
  text-align: left;
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.vsc-pdf-cta:hover,
.vsc-pdf-cta.drop-target {
  background: #dbeafe;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .14);
}
.vsc-pdf-cta-top {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  line-height: 1.25;
}
.vsc-pdf-cta-top b {
  font-weight: 700;
}
.vsc-pdf-cta-tag {
  font-size: 10.5px;
  font-weight: 600;
  color: #3b82f6;
}
.vsc-pdf-cta-sub {
  padding-left: 18px;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.2;
}
.vsc-pin-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  height: 16px;
  padding: 0 5px;
  border-radius: 99px;
  background: #f1f5f9;
  color: var(--ink-2);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.vsc-row.selected .vsc-pin-badge {
  background: #bfdbfe;
  color: #1e3a8a;
}
.vsc-row:hover .vsc-pin-badge,
.vsc-row:focus-within .vsc-pin-badge {
  display: none;
}
.vsc-part-leaf.search-hit {
  background: #fefce8;
}
.vsc-part-leaf.search-hit:hover {
  background: #fef9c3;
}
.vsc-part-leaf.search-hit.selected {
  background: #dbeafe;
}
.vsc-hl {
  background: #fde047;
  color: #0f172a;
  padding: 0 1px;
  border-radius: 2px;
}
.vsc-search-in {
  width: 100%;
  height: 25px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface-alt);
  color: var(--ink);
  font-size: 11.5px;
  outline: none;
}
.vsc-search-in:focus {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .12);
}

.vsc-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.vsc-vendor-row {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.vsc-vendor-row::-webkit-scrollbar { display: none; }
.vsc-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 21px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-alt);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.vsc-chip:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: #bfdbfe;
  color: var(--ink);
}
.vsc-chip[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: #93c5fd;
  color: var(--accent-dark);
  font-weight: 700;
}
.vsc-chip:disabled {
  cursor: not-allowed;
}

/* Unified Explorer Tree */
.vsc-tree {
  display: flex;
  flex-direction: column;
  padding: 2px 0 8px;
  background: var(--surface);
}
.vsc-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  height: 26px;
  min-height: 26px;
  padding: 0 8px 0 6px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.2;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
}
.vsc-row:hover:not(:disabled) {
  background: #f1f5f9;
}
.vsc-row.active {
  background: #eff6ff;
  color: var(--accent-dark);
}
.vsc-row.selected {
  background: #dbeafe;
  color: #1e3a8a;
}
.vsc-row.vsc-folder {
  font-weight: 600;
  color: var(--ink-2);
}
.vsc-row.vsc-folder.drop-target {
  background: #dbeafe;
  outline: 1px dashed var(--accent);
  outline-offset: -1px;
}
.vsc-row.vsc-group {
  font-weight: 600;
  color: var(--ink-2);
}
.vsc-row.vsc-action-row {
  padding: 0 10px;
  border-bottom-color: #f1f5f9;
}
.vsc-row:disabled {
  cursor: not-allowed;
}

.vsc-chev {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  flex-shrink: 0;
  cursor: pointer;
}
.vsc-chev.invisible {
  visibility: hidden;
  pointer-events: none;
}
.vsc-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  color: var(--muted);
  flex-shrink: 0;
}
.vsc-row.active .vsc-ico,
.vsc-row.selected .vsc-ico {
  color: var(--accent);
}
.vsc-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vsc-label b {
  font-weight: 600;
}
.vsc-sub {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}
.vsc-meta {
  flex-shrink: 0;
  font-size: 10.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.vsc-count {
  flex-shrink: 0;
  min-width: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.vsc-empty-leaf {
  padding: 6px 10px;
  font-size: 11px;
  color: var(--muted);
}

/* Inline Hover Actions (Hidden until row/item hover) */
.vsc-row-actions {
  display: none;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  margin-left: 4px;
}
.vsc-row:hover .vsc-row-actions,
.vsc-row:focus-within .vsc-row-actions,
.vsc-item:hover .vsc-row-actions,
.vsc-item:focus-within .vsc-row-actions {
  display: inline-flex;
}
.vsc-row:hover .vsc-count,
.vsc-row:focus-within .vsc-count {
  display: none;
}
.vsc-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: rgba(255, 255, 255, .82);
  color: var(--ink-2);
  cursor: pointer;
}
.vsc-act:hover {
  background: #e2e8f0;
  color: var(--ink);
}
.vsc-act.primary {
  background: var(--accent-soft);
  color: var(--accent-dark);
}
.vsc-act.primary:hover {
  background: var(--accent);
  color: #fff;
}
.vsc-act.danger:hover {
  background: #fee2e2;
  color: var(--danger);
}
.vsc-act.pinned {
  color: #d97706;
}

/* Compact 1~2-Line List (Parts / Wires) */
.vsc-list {
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.vsc-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px 5px 10px;
  border-bottom: 1px solid #eef2f7;
  background: transparent;
  cursor: pointer;
  user-select: none;
}
.vsc-item:hover {
  background: #f1f5f9;
}
.vsc-item.selected {
  background: #dbeafe;
}
.vsc-item-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.vsc-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
}
.vsc-item-pn {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vsc-item-sub {
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vsc-tags {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}
.vsc-tag {
  display: inline-flex;
  align-items: center;
  height: 15px;
  padding: 0 4px;
  border-radius: 3px;
  background: #f1f5f9;
  color: var(--ink-2);
  font-size: 9.5px;
  font-weight: 700;
}
.vsc-tag.pv {
  background: #e0e7ff;
  color: #3730a3;
}
.vsc-tag.ok {
  background: #dcfce7;
  color: #166534;
}
.vsc-tag.warn {
  background: #fef3c7;
  color: #92400e;
}

/* Wire / Covering Compact Section Headers & Selection-Aware Disabled State */
.vsc-sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  background: var(--surface-alt);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-2);
}
.vsc-state-pill {
  display: inline-flex;
  align-items: center;
  height: 16px;
  padding: 0 6px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 600;
}
.vsc-state-pill.muted {
  background: #e2e8f0;
  color: var(--muted);
}
.vsc-state-pill.active {
  background: #dbeafe;
  color: var(--accent-dark);
}
.vsc-color-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 8px;
  background: var(--surface);
}
.vsc-seg-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 6px 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.vsc-seg-btn {
  height: 24px;
  padding: 0 6px;
  border-radius: 5px;
  border: 1px solid var(--line-strong);
  background: var(--surface-alt);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.vsc-seg-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.vsc-awg-list {
  max-height: 176px;
  overflow-y: auto;
}
.vsc-awg-row.active {
  background: #eff6ff;
  color: var(--accent-dark);
}
.vsc-awg-color-box {
  border-top: 1px solid var(--line);
  background: #f8fafc;
}
.vsc-awg-spec-bar {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 10px 2px;
  font-size: 10.5px;
  color: var(--ink-2);
}
.vsc-awg-spec-bar b {
  color: var(--accent-dark);
  font-size: 11px;
}
.is-disabled {
  opacity: 0.45;
  filter: grayscale(0.25);
}

/* ---------- First-Time Welcome Modal & Interactive 8-Step Tutorial ---------- */
.tut-welcome-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(2px);
  animation: tutFadeIn .18s ease;
}
.tut-welcome-card {
  width: 470px;
  max-width: 100%;
  padding: 18px 20px 16px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .26);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tut-welcome-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tut-welcome-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 700;
}
.tut-welcome-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.01em;
}
.tut-welcome-sub {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-2);
}
.tut-flow-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-2);
}
.tut-flow-arr {
  color: var(--muted);
  font-weight: 400;
}
.tut-welcome-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}
.tut-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-weight: 700;
}
.tut-welcome-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
  flex-wrap: wrap;
}
.tut-noshow-lbl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.tut-noshow-lbl input {
  margin: 0;
  accent-color: var(--accent);
}
.tut-reopen-hint {
  font-size: 11px;
  color: var(--muted);
}

/* Non-blocking Spotlight Ring around Active UI Target */
.tut-spotlight {
  position: fixed;
  z-index: 9990;
  pointer-events: none;
  border: 2.5px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .20), 0 0 22px rgba(37, 99, 235, .28);
  transition: left .2s ease, top .2s ease, width .2s ease, height .2s ease;
  animation: tutPulse 1.8s ease-in-out infinite;
}

/* Floating Interactive Coachmark Card */
.tut-card {
  position: fixed;
  z-index: 9995;
  width: 368px;
  max-width: calc(100vw - 24px);
  background: var(--surface);
  border: 1px solid #93c5fd;
  border-radius: 12px;
  box-shadow: 0 20px 48px rgba(15, 23, 42, .22);
  overflow: hidden;
  transition: left .18s ease, top .18s ease;
  animation: tutFadeIn .16s ease;
}
.tut-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  background: linear-gradient(90deg, #eff6ff 0%, #f8fafc 100%);
  border-bottom: 1px solid var(--line);
  cursor: grab;
  user-select: none;
}
.tut-head:active { cursor: grabbing; }
.tut-head-left {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.tut-step-pill {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 7px;
  border-radius: 99px;
  background: var(--accent);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.tut-stage {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tut-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.tut-close:hover {
  background: #e2e8f0;
  color: var(--ink);
}
.tut-progress {
  height: 3px;
  background: #e2e8f0;
  overflow: hidden;
}
.tut-progress-bar {
  height: 100%;
  background: var(--accent);
  transition: width .24s ease;
}
.tut-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.tut-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.tut-desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink-2);
}
.tut-desc code {
  padding: 1px 4px;
  border-radius: 3px;
  background: #f1f5f9;
  font-size: 11px;
  color: var(--accent-dark);
}
.tut-mission {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  font-size: 11.5px;
  color: #1e3a8a;
  transition: background .2s ease, border-color .2s ease;
}
.tut-mission.done {
  background: #f0fdf4;
  border-color: #86efac;
  color: #166534;
}
.tut-mission-ico {
  flex-shrink: 0;
  margin-top: 1px;
}
.tut-mission-txt {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.4;
}
.tut-mission-txt strong {
  font-size: 11px;
}
.tut-quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tut-quick-btn {
  padding: 4px 9px;
  border: 1px solid #93c5fd;
  border-radius: 6px;
  background: var(--surface);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.tut-quick-btn:hover {
  background: var(--accent-soft);
}
.tut-tip {
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--surface-alt);
}
.tut-tip b {
  color: var(--ink-2);
  margin-right: 3px;
}
.tut-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border-top: 1px solid var(--line);
  background: var(--surface-alt);
}
.tut-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.tut-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 99px;
  background: #cbd5e1;
  cursor: pointer;
  transition: width .18s ease, background .18s ease;
}
.tut-dot.done {
  background: #22c55e;
}
.tut-dot.current {
  width: 18px;
  background: var(--accent);
}
.tut-nav-btns {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tut-sandbox-foot {
  padding: 5px 12px;
  background: #fefce8;
  border-top: 1px solid #fde68a;
  color: #854d0e;
  font-size: 10.5px;
  font-weight: 600;
  text-align: center;
}

@keyframes tutFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes tutPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(37, 99, 235, .20), 0 0 18px rgba(37, 99, 235, .24); }
  50% { box-shadow: 0 0 0 7px rgba(37, 99, 235, .10), 0 0 26px rgba(37, 99, 235, .36); }
}

/* ---------- Dedicated CAD Error Alert & Before/After 6-View Diff Modals ---------- */
.cad-subdialog {
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 64px rgba(15, 23, 42, .32);
  overflow: hidden;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
}
.cad-subdialog::backdrop {
  background: rgba(15, 23, 42, .48);
  backdrop-filter: blur(2px);
}
.cad-alert-dialog {
  width: 470px;
}
.cad-alert-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  background: #fef2f2;
  border-bottom: 1px solid #fecaca;
}
.cad-alert-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #fee2e2;
  color: var(--danger);
  flex-shrink: 0;
}
.cad-alert-titles {
  flex: 1 1 auto;
  min-width: 0;
}
.cad-alert-titles h3 {
  margin: 2px 0 0;
  font-size: 14.5px;
  font-weight: 700;
  color: #7f1d1d;
}
.cad-alert-code {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: #e2e8f0;
  color: #334155;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
}
.cad-alert-head .cad-alert-code {
  background: #fecaca;
  color: #991b1b;
}
.cad-alert-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cad-alert-msg {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-2);
}
.cad-alert-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  font-size: 11.5px;
}
.cad-alert-meta > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.cad-alert-meta span {
  color: var(--muted);
  flex-shrink: 0;
}
.cad-alert-meta b {
  color: var(--ink);
  text-align: right;
  word-break: break-all;
}
.cad-err-num {
  color: var(--danger) !important;
}
.cad-alert-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface-alt);
  border-top: 1px solid var(--line);
}

/* Before vs. After 6-View Comparison Modal */
.cad-diff-dialog {
  width: 960px;
  display: flex;
  flex-direction: column;
}
.cad-diff-dialog:not([open]) { display: none; }
.cad-diff-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(90deg, #eff6ff 0%, #f8fafc 100%);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.cad-diff-head h3 {
  margin: 3px 0 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.cad-diff-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 8px 16px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.cad-diff-cols-head {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.cad-diff-col-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 12px;
}
.cad-diff-col-title.before {
  background: #fefce8;
  border: 1px solid #fde68a;
  color: #854d0e;
}
.cad-diff-col-title.after {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
}
.cad-diff-col-title small {
  font-size: 10.5px;
  opacity: .85;
}
.cad-diff-grid {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 58vh;
  background: var(--bg);
}
.cad-diff-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.cad-diff-cell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.cad-diff-cell.before { border-color: #fde68a; }
.cad-diff-cell.after { border-color: #bfdbfe; }
.cad-diff-lbl {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-2);
}
.cad-diff-svg {
  height: 118px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border-radius: 5px;
  overflow: hidden;
}
.cad-diff-svg svg {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}
.cad-diff-empty {
  height: 118px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--muted);
  background: var(--surface-alt);
  border-radius: 5px;
}
.cad-diff-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  background: var(--surface-alt);
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  flex-wrap: wrap;
}

@media print {
  .topbar, .menubar, .draw-rail, .left-panel, #left-resizer, .canvas-bar, #drawer-resizer, .bottom-drawer,
  #inspector-resizer, .inspector-shell, .autohide-edge, .statusbar,
  .tut-spotlight, .tut-card, .tut-welcome-backdrop { display: none !important; }
  .studio-shell, .workspace, .center-pane, .canvas-viewport {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
    padding: 0 !important;
    background: #fff !important;
  }
  .drawing-sheet { box-shadow: none !important; border: 0 !important; width: 100% !important; }
}

/* ---------- Right Inspector 3D STEP & 6-View Preview + Layout Projected Views ---------- */
.insp-3d-ctrls {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}
.insp-3d-wrap {
  width: 100%;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
}
.insp-3d-canvas {
  display: block;
  width: 100%;
  height: 205px;
  cursor: grab;
}
.insp-3d-canvas:active {
  cursor: grabbing;
}
.insp-6v-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}
.insp-6v-cell {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.insp-6v-thumb {
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #f8fafc;
  border-radius: 3px;
}
.insp-6v-thumb svg,
.insp-6v-thumb img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
}
.insp-6v-cap {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.15;
  font-size: 10px;
  color: var(--ink);
}
.insp-6v-cap span {
  font-size: 9px;
  color: var(--muted);
}
.pv-ctrl-btn {
  cursor: pointer;
}
.pv-ctrl-btn:hover circle {
  filter: brightness(1.1);
}
