/* Parametric part modeller (js/ui/part-modeler.js): ribbon, model browser, 3D view, feature panel, status bar. */
.pm { position: fixed; inset: 0; z-index: 58; display: flex; flex-direction: column; background: var(--bg); color: var(--fg); font-size: 13px; }
body.pm-open { overflow: hidden; }
.pm-head { display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 10px; background: var(--fc-navy, #0B1E3A); color: #fff; flex: none; }
.pm-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-t1 { font-weight: 700; }
.pm-t2 { opacity: .8; }
.pm-qa { display: flex; align-items: center; gap: 6px; }
.pm-qa .btn.ghost { color: #fff; }
.pm-qa .btn.ghost:disabled { opacity: .4; }
.pm-qa .btn.small:not(.ghost):not(.primary) { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .25); }
.pm-qa .btn.outline { color: #fff; border-color: rgba(255, 255, 255, .35); }
.pm-qa .pm-finish-qa { background: #15803D; color: #fff; border-color: #15803D; }
.pm-qa .pm-finish-qa svg { stroke: #fff; }

/* ribbon */
.pm-ribbon { flex: none; background: var(--bg2); border-bottom: 1px solid var(--line); }
.pm-tabs { display: flex; gap: 2px; padding: 4px 8px 0; }
.pm-tab { border: 1px solid transparent; border-bottom: none; background: none; padding: 6px 14px; border-radius: 6px 6px 0 0; font: inherit; color: var(--fg2); cursor: pointer; }
.pm-tab.active { background: var(--bg); border-color: var(--line); color: var(--fg); font-weight: 600; }
.pm-rpanels { display: flex; align-items: stretch; gap: 0; padding: 6px 6px 2px; overflow-x: auto; background: var(--bg); border-top: 1px solid var(--line); min-height: 86px; }
.pm-group { display: flex; flex-direction: column; justify-content: space-between; padding: 0 8px; border-right: 1px solid var(--line); }
.pm-group:last-child { border-right: none; }
.pm-grow { display: flex; align-items: flex-start; gap: 2px; }
.pm-stack { display: flex; flex-direction: column; gap: 1px; }
.pm-gt { text-align: center; font-size: 11px; color: var(--fg2); padding-top: 2px; }
.pm-big { flex-direction: column; height: 62px; min-width: 62px; padding: 4px 6px; gap: 2px; border: 1px solid transparent; background: none; font-size: 11px; line-height: 1.15; white-space: normal; text-align: center; }
.pm-big svg { width: 26px; height: 26px; }
.pm-small { height: 20px; padding: 0 5px; gap: 4px; border: 1px solid transparent; background: none; font-size: 12px; justify-content: flex-start; white-space: nowrap; }
.pm-group { padding: 0 6px; }
.pm-small svg { width: 15px; height: 15px; }
.pm-small.pm-icon { width: 26px; padding: 0; justify-content: center; }
.pm-small.pm-icon .lbl { display: none; }
.pm-small.pm-icon svg { width: 17px; height: 17px; }
.pm-rpanels.pm-compact .pm-small .lbl { display: none; }
.pm-rpanels.pm-compact .pm-small { width: 26px; padding: 0; justify-content: center; }
.pm-big:hover, .pm-small:hover { background: var(--bg3, #e8eef6); border-color: var(--line); }
.pm-big.active, .pm-small.active { background: rgba(47, 125, 246, .14); border-color: var(--accent); }
.pm-finish { color: var(--ok); }
.pm-finish svg { stroke: #15803D; }

/* main */
.pm-main { flex: 1; min-height: 0; display: flex; }
.pm-browser { width: 250px; flex: none; border-right: 1px solid var(--line); background: var(--bg2); overflow: auto; }
.pm-bhead { padding: 8px 10px; font-weight: 700; border-bottom: 1px solid var(--line); }
.pm-tree { padding: 4px 0 20px; }
.pm-node { display: flex; align-items: center; gap: 6px; height: 26px; padding-right: 8px; cursor: default; white-space: nowrap; user-select: none; }
.pm-node svg { width: 16px; height: 16px; flex: none; }
.pm-node:hover { background: var(--bg3, #e8eef6); }
.pm-node.sel { background: rgba(47, 125, 246, .16); }
.pm-node.editing { background: rgba(21, 128, 61, .14); font-weight: 600; }
.pm-node.suppressed .pm-nl { text-decoration: line-through; color: var(--fg2); }
.pm-node.rolled { opacity: .45; }
.pm-nl { overflow: hidden; text-overflow: ellipsis; }
.pm-err { margin-left: auto; width: 16px; height: 16px; border-radius: 50%; background: #DC2626; color: #fff; font-weight: 700; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; }
.pm-eop { color: var(--warn); cursor: ns-resize; font-weight: 600; padding-left: 8px; border-top: 1px dashed #F59E0B; border-bottom: 1px dashed #F59E0B; }
.pm-eop svg { stroke: #B45309; }
.pm-root { font-weight: 700; }
.pm-view { flex: 1; min-width: 0; position: relative; overflow: hidden; }
.pm-canvas { display: block; width: 100%; height: 100%; outline: none; touch-action: none; }
.pm-nav { position: absolute; top: 8px; right: 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 4px; box-shadow: var(--shadow); }
.pm-navrow { display: flex; gap: 2px; }
.pm-cubebox { width: 84px; height: 84px; }
.pm.pm-insketch .pm-cubebox { display: none; }
.pm-cube { width: 84px; height: 84px; display: block; cursor: var(--cur-grab); touch-action: none; }
.pm-v-ortho.active { background: rgba(47, 125, 246, .14); border-color: var(--accent); }
.pm-chip { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; gap: 6px; background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 6px; box-shadow: var(--shadow); }
.pm-chip .btn { height: 36px; border-radius: 999px; }
.pm-prompt.warn { color: var(--warn); font-weight: 600; }
.pm-node.pm-folder svg { transition: transform .15s; }
.pm-node.pm-folder.open svg { transform: rotate(90deg); }
.pm-node.pm-dragging { opacity: .5; }
.pm-node.pm-drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.pm-node.pm-drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
@media (max-width: 900px) { .pm-cubebox, .pm-cube { width: 72px; height: 72px; } }
.pm-labels { position: absolute; inset: 0; pointer-events: none; }
.pm-dim { position: absolute; left: 0; top: 0; pointer-events: auto; padding: 1px 5px; border-radius: 4px; background: rgba(255, 255, 255, .92); border: 1px solid #0F766E; color: #0F766E; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.pm-dim.driven { border-style: dashed; color: var(--ink3); border-color: #9CA3AF; }
.pm-dim.sel { background: #2563EB; color: #fff; border-color: #2563EB; }
.pm-dim.glyph { border-color: #6B7280; color: var(--ink2); font-size: 11px; padding: 0 4px; }
.pm-snap { position: absolute; left: -6px; top: -6px; width: 12px; height: 12px; border: 2px solid #16A34A; border-radius: 50%; pointer-events: none; }
.pm-snap.line, .pm-snap.circle, .pm-snap.arc { border-radius: 2px; border-color: #2563EB; transform-origin: center; }
.pm-dyn { position: absolute; left: 0; top: 0; pointer-events: auto; display: flex; gap: 4px; background: rgba(255, 255, 255, .95); border: 1px solid var(--line2); border-radius: 8px; padding: 4px 6px; box-shadow: var(--shadow); }
.pm-dynf { display: flex; align-items: center; gap: 3px; font-size: 12px; color: var(--fg2); }
.pm-dynf.locked .pm-dyn-in { border-color: var(--accent); background: rgba(47, 125, 246, .08); font-weight: 600; }
.pm-dynl { min-width: 12px; text-align: right; }
.pm-dynu { color: var(--fg3); }
.pm-dyn-in { width: 78px; height: 26px; font-size: 12px; padding: 0 6px; }
.pm-infer { position: absolute; left: 0; top: 0; pointer-events: none; font-size: 12px; font-weight: 700; color: var(--accent); background: rgba(255, 255, 255, .9); border: 1px solid #93C5FD; border-radius: 4px; padding: 0 4px; line-height: 18px; }
.pm-marquee { position: absolute; border: 1px solid #2563EB; background: rgba(37, 99, 235, .10); pointer-events: none; }
.pm-marquee.crossing { border-style: dashed; border-color: #16A34A; background: rgba(22, 163, 74, .10); }
.pm-dim.preview { border-color: #9CA3AF; color: var(--ink2); background: rgba(255, 255, 255, .8); pointer-events: none; }
.pm-dim { cursor: move; }
.pm-valbox { position: fixed; z-index: 2000; display: flex; align-items: center; gap: 4px; background: var(--bg2); border: 1px solid var(--accent); border-radius: 8px; padding: 4px; box-shadow: var(--shadow); width: 190px; }
.pm-valbox .inp { flex: 1; min-width: 0; height: 30px; }
.pm-vname { font-size: 12px; color: var(--fg2); }

/* feature panel */
.pm-dialog { width: 300px; flex: none; border-left: 1px solid var(--line); background: var(--bg2); display: flex; flex-direction: column; }
.pm-dialog[hidden] { display: none; }
.pm-dh { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.pm-dh svg { width: 22px; height: 22px; }
.pm-dh h3 { margin: 0; font-size: 16px; }
.pm-db { flex: 1; overflow: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.pm-db .field { margin: 0; }
.pm-db .field > label { font-size: 12px; }
.pm-pname { color: var(--fg2); font-weight: 400; }
.pm-seg { display: flex; flex-wrap: wrap; gap: 2px; }
.pm-seg .btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pm-seg .btn.active svg { stroke: #fff; }
.pm-pick .btn.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(47, 125, 246, .25); }
.pm-db .pm-pick .btn { max-width: 100%; height: auto; min-height: 28px; padding: 4px 8px; white-space: normal; text-align: left; line-height: 1.25; }
.pm-checks { display: flex; flex-direction: column; gap: 4px; max-height: 160px; overflow: auto; }
.pm-checks .chk { display: flex; align-items: center; gap: 6px; }
.pm-df { display: flex; justify-content: flex-end; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--line); }
.pm-derr { margin-top: 4px; }

/* status */
.pm-status { flex: none; height: 28px; display: flex; align-items: center; gap: 16px; padding: 0 10px; border-top: 1px solid var(--line); background: var(--bg2); font-size: 12px; }
.pm-prompt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-dof.under { color: var(--warn); }
.pm-dof.full { color: var(--ok); font-weight: 600; }
.pm-kernel { color: var(--fg2); }
.pm-kernel.loading, .pm-kernel.busy { color: var(--accent); }
.pm-kernel.error { color: var(--err); font-weight: 600; }

/* parameters */
.pm-ptbl { width: 100%; }
.pm-ptbl .inp { height: 28px; font-size: 12px; }
.pm-ptbl td { padding: 2px 4px; vertical-align: middle; }
.pm-ptbl th { position: static; }
.pm-ptbl tr.err .pm-pexpr { border-color: #DC2626; }
.pm-psec td { font-weight: 700; background: var(--bg3, #eef2f7); padding: 4px 6px; }
.pm-padd { margin-top: 8px; }
.pm-props .pm-prow { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid var(--line); }

@media (max-width: 900px) {
  .pm-browser { width: 190px; }
  .pm-dialog { position: absolute; right: 0; top: 0; bottom: 0; z-index: 3; box-shadow: var(--shadow); }
  .pm-main { position: relative; }
  .pm-qa .lbl { display: none; }
}
