/* P2 desktop shell - styles for the modules under frontend/studio/{tasks,dialogs,status,layout,
   properties,toolbars}. Only the studio's own tokens (--chrome, --line, --text, --accent ...);
   sizes follow the desktop where the inventory records them (Tasks dock minimum 210 px,
   TaskEditControl margin 9 / spacing 6, 9 pt Segoe UI = 12 px). */

/* ── layout ───────────────────────────────────────────────────────────────── */
/* P12: the main grid - its columns, rows and the Tasks width - is index.html's .main (layout.json) */
/* P4: ComboView = TreePanel over PropertyView in a vertical splitter; the PropertyView's tabs
   are South (PropertyView.cpp:101): dock tabs / tree / splitter handle / editors / View|Data */
.main.desktop-shell > .dock { grid-template-rows: 23px minmax(0, 1fr) 5px var(--prop-h, 210px) 23px; }
.splitter-handle { cursor: ns-resize; }
.prop-splitter { background: var(--line); cursor: ns-resize; }
.prop-tabs-south { border-bottom: 0; border-top: 1px solid var(--line); }
.task-dock[data-features="Movable|Floatable"] .dock-x { opacity: .35; cursor: not-allowed; }

/* ── task view ────────────────────────────────────────────────────────────── */
.taskview { display: flex; flex-direction: column; min-height: 0; }
.task-dialog-layout { display: flex; flex-direction: column; gap: 6px; }
.task-panel { display: flex; flex-direction: column; gap: 6px; }
.task-panel:empty { display: none; }
.task-stretch { flex: 1; }
.task-edit-control { display: flex; padding: 9px; gap: 6px; }
.dialog-button-box { display: flex; gap: 6px; justify-content: flex-end; }
.dialog-button-box.center, .task-edit-control .dialog-button-box { justify-content: center; width: 100%; }
.qbtn { min-width: 72px; padding: 3px 10px; }
.qbtn.default { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

.taskbox { border: 1px solid var(--line); background: var(--chrome-3); }
.taskbox-hd { display: flex; align-items: center; gap: 6px; width: 100%; padding: 4px 6px;
  background: var(--chrome-2); border: 0; border-bottom: 1px solid var(--line); color: var(--text);
  font: inherit; font-weight: 700; font-size: 12px; text-align: left; cursor: default; }
.taskbox-hd .tb-ic { width: 16px; height: 16px; flex: none; }
.taskbox-chev { margin-left: auto; color: var(--text-3); font-size: 11px; }
.taskbox.collapsed .taskbox-bd { display: none; }
.taskbox.collapsed .taskbox-hd { border-bottom: 0; }
.taskbox-bd { padding: 6px 8px; display: flex; flex-direction: column; gap: 3px; }

.action-label { display: flex; align-items: center; gap: 8px; padding: 3px 4px; background: none; border: 0;
  color: var(--accent-ink); font: inherit; font-size: 12px; text-align: left; cursor: pointer; text-decoration: none; }
.action-label .ic { width: 16px; height: 16px; flex: none; }
.action-label:hover:not(:disabled) { text-decoration: underline; background: var(--sel); }
.action-label:disabled { color: var(--text-3); cursor: default; filter: grayscale(1); opacity: .6; }

/* ── rendered .ui widgets ──────────────────────────────────────────────────── */
.qui { display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.qlayout.qv { display: flex; flex-direction: column; gap: 6px; }
.qlayout.qh { display: flex; flex-direction: row; gap: 6px; align-items: center; }
.qlayout.qgrid { display: grid; grid-template-columns: auto 1fr; gap: 4px 8px; align-items: center; }
.qspacer { flex: 1; min-height: 4px; }
.qlabel { white-space: pre-line; line-height: 1.35; }
.qline { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.qlist { border: 1px solid var(--line); background: var(--chrome-3); max-height: 200px; overflow: auto; display: flex; flex-direction: column; }
.qlist-row { display: block; width: 100%; padding: 3px 6px; background: none; border: 0; color: var(--text); font: inherit; font-size: 12px; text-align: left; cursor: default; }
.qlist-row:hover { background: var(--sel); }
.qlist-row.on { background: var(--accent-tint); box-shadow: inset 2px 0 0 var(--accent); }
.qcheck, .qradio { display: flex; align-items: center; gap: 6px; }
.qradio input:disabled + *, .qcheck input:disabled + * { color: var(--text-3); }
.qgroup { border: 1px solid var(--line); padding: 6px 8px; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.qgroup > legend { padding: 0 4px; font-weight: 600; }
.qgroup.unchecked > :not(legend) { opacity: .5; pointer-events: none; }
.qframe { display: flex; flex-direction: column; gap: 4px; }
.qunknown { color: var(--text-3); font-size: 11px; border: 1px dashed var(--line); padding: 2px 4px; }
.qedit, .qspin, .qcombo { padding: 2px 4px; border: 1px solid var(--line); background: var(--chrome-3); color: var(--text); font: inherit; }

/* ── QDialog / QMessageBox overlays ───────────────────────────────────────── */
.qdialog-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 70; display: flex; align-items: center; justify-content: center; }
.qdialog { background: var(--chrome); border: 1px solid var(--line); min-width: 320px; max-width: 480px;
  box-shadow: 0 8px 30px rgba(0,0,0,.25); font-size: 12px; color: var(--text); }
.qdialog-title { padding: 6px 10px; border-bottom: 1px solid var(--line); font-weight: 600; }
.qdialog > .qui { padding: 10px 12px; }
.qdialog .dialog-button-box { padding: 8px 0 0; }
.msgbox-body { display: flex; gap: 12px; padding: 12px; align-items: flex-start; }
.msgbox-icon { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 50%;
  border: 2px solid var(--text-2); color: var(--text-2); font-weight: 700; font-size: 16px; }
.msgbox[data-icon="warning"] .msgbox-icon { border-color: var(--text); color: var(--text); }
.msgbox-main { font-weight: 600; }
.msgbox-info { margin-top: 6px; color: var(--text-2); }
.msgbox .dialog-button-box { padding: 8px 10px; border-top: 1px solid var(--line); }

/* ── status bar permanent widgets ─────────────────────────────────────────── */
.statusbar { position: relative; }
.sb-permanent { margin-left: auto; display: flex; align-items: center; gap: 6px; height: 100%; position: relative; }
.sb-area { min-width: 0; }
.sb-label { color: var(--text-2); font-size: 11px; min-width: 6px; }
.sb-btn { display: flex; align-items: center; gap: 4px; padding: 0 6px; height: 18px; background: none; border: 1px solid transparent;
  color: var(--text-2); font: inherit; font-size: 11px; cursor: default; white-space: nowrap; }
.sb-btn:hover { border-color: var(--line); background: var(--chrome-3); }
.sb-btn .ic { width: 14px; height: 14px; }
.sb-notif.has-unread .count { color: var(--accent-ink); font-weight: 700; }
.sb-menu { position: absolute; bottom: 22px; right: 0; background: var(--chrome); border: 1px solid var(--line);
  box-shadow: 0 6px 24px rgba(0,0,0,.25); padding: 4px 0; min-width: 180px; max-height: 320px; overflow: auto; z-index: 80; }
.sb-menu .mi { width: 100%; }
.sb-notif-table { border-collapse: collapse; font-size: 11px; min-width: 360px; }
.sb-notif-table th, .sb-notif-table td { text-align: left; padding: 2px 8px; border-bottom: 1px solid var(--line-2); }
.sb-filter { display: flex; align-items: center; gap: 3px; padding: 0 4px; font-size: 11px; color: var(--text-2); }
.sb-filter select { min-width: 115px; max-height: 22px; font: inherit; font-size: 11px; background: var(--chrome-3); color: var(--text); border: 1px solid var(--line); }
.sb-progress { width: 120px; height: 10px; }
#presel.sb-temporary[data-kind="err"] { color: var(--red); font-weight: 600; }
#presel.sb-temporary[data-kind="wrn"] { color: var(--accent-ink); }

/* ── toolbars (managed rows) ──────────────────────────────────────────────── */
.tgroup[data-toolbar] .twidget { padding: 0 6px; color: var(--text-3); font-size: 11px; }
.tbtn.checkable.on { background: var(--accent-tint); border-color: var(--accent); }

/* ── property view ────────────────────────────────────────────────────────── */
.propview { width: 100%; }
.propview tr.obj td { font-weight: 600; padding: 4px 6px 2px; color: var(--text); border-bottom: 1px solid var(--line); }
.propview tr[data-default="true"] td.v { color: var(--text-3); font-style: italic; }
.propview tr[data-expression="true"] td.k::after { content: ' ƒ'; color: var(--accent-ink); }
.propview .prop-edit { width: 70px; padding: 1px 3px; border: 1px solid var(--line); background: var(--chrome-3); color: var(--text); font: inherit; }
.prop-params-head { padding: 4px 0 2px; text-transform: uppercase; letter-spacing: .08em; font-size: 10px; }

/* ── tree ─────────────────────────────────────────────────────────────────── */
.tnode.presel { outline: 1px dashed var(--accent); outline-offset: -1px; }
.tnode.active-body > .nm { font-weight: 700; }

/* ── icon merge (BitmapFactory::merge) ────────────────────────────────────── */
.ic-merge { position: relative; display: inline-flex; }
.ic-merge .ic-overlay { position: absolute; width: 10px; height: 10px; }
.ic-merge.pos-TopLeft .ic-overlay { left: 0; top: 0; }
.ic-merge.pos-TopRight .ic-overlay { right: 0; top: 0; }
.ic-merge.pos-BottomLeft .ic-overlay { left: 0; bottom: 0; }
.ic-merge.pos-BottomRight .ic-overlay { right: 0; bottom: 0; }

/* ── P3 model tree (Gui/Tree.cpp over the BNC Theme Light stylesheet) ───────────────────
   row pitch 20 px, indentation from the stylesheet (qproperty-indentation: 12), icon 16 px
   with the visibility eye in front (TreeParams::VisibilityIcon), Segoe UI 9 pt = 12 px,
   selected = the QSS QTreeView::item:selected gradient, active object = TreeActiveColor +
   bold, edited object = TreeEditColor, invisible object = disabled icon and text colour. */
.tree-p3 { outline: none; font-size: 12px; --tree-row: 20px; --tree-disabled-text: #9d9d9d; }
.tree-p3 .tnode { display: flex; align-items: center; gap: 0; height: var(--tree-row); padding: 0 4px 0 calc(var(--depth, 0) * var(--tree-indent, 12px));
  font-size: 12px; cursor: default; border: 0; white-space: nowrap; }
.tree-p3 .tnode .tw { width: 12px; flex: none; text-align: center; color: var(--text-3); font-size: 10px; }
.tree-p3 .tnode .eye { width: var(--tree-icon, 16px); height: var(--tree-icon, 16px); flex: none; margin-right: 6px; display: inline-flex; }   /* PM_LayoutHorizontalSpacing 6: the 38 px composite in tree.json */
.tree-p3 .tnode .eye .ic { width: 100%; height: 100%; }
.tree-p3 .tnode .eye[data-vis="none"] { visibility: hidden; }
.tree-p3 .tnode .ic-merge { width: var(--tree-icon, 16px); height: var(--tree-icon, 16px); flex: none; margin-right: 4px; position: relative; display: inline-flex; }
.tree-p3 .tnode .ic-merge .obj-ic { width: 100%; height: 100%; }
.tree-p3 .tnode .ic-merge.disabled .obj-ic { filter: grayscale(1); opacity: .45; }
.tree-p3 .tnode .ic-merge .ic-overlay { position: absolute; width: 10px; height: 10px; }
/* P16.99: a link's overlay - 12 x 12 px merged at the bottom-left (ViewProviderLink.cpp LinkInfo::getIcon) */
.tree-p3 .tnode .ic-merge .ic-overlay.pos-BottomLeft { left: 0; bottom: 0; width: 12px; height: 12px; }
.tree-p3 .tnode .nm { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.tree-p3 .tnode.invisible .nm { color: var(--tree-disabled-text); }
.tree-p3 .tnode .ty { margin-left: 8px; color: var(--text-3); font-size: 11px; }
.tree-p3 .tnode:hover { background: var(--sel); }
.tree-p3 .tnode.sel, .tree-p3 .tnode.body-sel { background: linear-gradient(var(--tree-sel-a, #22b8b0), var(--tree-sel-b, #067a75)); box-shadow: none; }
.tree-p3 .tnode.sel .nm, .tree-p3 .tnode.body-sel .nm, .tree-p3 .tnode.sel .tw, .tree-p3 .tnode.sel .ty { color: var(--tree-sel-fg, #ffffff); font-weight: inherit; }
.tree-p3 .tnode.active-body:not(.sel) { background: var(--tree-active-bg); }
.tree-p3 .tnode.active-body > .nm { font-weight: 700; color: var(--text); }
.tree-p3 .tnode.doc > .nm { font-weight: 400; }
.tree-p3 .tnode.doc.active > .nm { font-weight: 700; color: var(--text); }   /* slotActiveDocument: only the active document bold, in the text colour */
.tree-p3 .tnode.editing:not(.sel) { background: var(--tree-edit-bg); }
.tree-p3 .tnode.editing .nm { font-weight: inherit; }
.tree-p3 .tnode.current { outline: 1px dotted var(--text-3); outline-offset: -1px; }
.tree-p3 .tnode.off .nm { opacity: .6; }
.tree-p3 .tnode.dragging { opacity: .5; }
.tree-p3 .tnode.drop-ok { box-shadow: inset 0 0 0 1px var(--accent); }
.tree-p3 .tnode.drop-no { box-shadow: inset 0 0 0 1px var(--red); }
.tree-p3 .tnode .acts, .tree-p3 .tnode.sel .acts, .tree-p3 .ti.sel .acts { display: none; margin-left: auto; }   /* the desktop's selected row shows nothing extra */
/* the action strip (up, down, suppress, edit, delete) floats over the END of the hovered row. In flow it took 100-120 px of a
   200 px dock, the name shrank to 2 px and a double-click on it landed on "Move earlier". */
.tree-p3 .tnode { position: relative; }
.tree-p3 .tnode:hover .acts { display: flex; position: absolute; right: 0; top: 0; bottom: 0; align-items: center; margin: 0; background: var(--chrome-2); }
/* ... and it is only a small handle until the pointer goes to it. Floating the whole strip over the row still covered the middle of a
   short name in a 200 px dock (measured: "Pad" 94-116 px, strip from 100 px), so a double-click on the name landed on "Move earlier".
   The five buttons now open from the handle at the end of the row, so a name is never under a button the pointer did not go to. */
.tree-p3 .tnode .acts::before { content: '\22EF'; padding: 0 5px; color: var(--text-3); font-size: 13px; line-height: 1; }
.tree-p3 .tnode:hover .acts > button { display: none; }
.tree-p3 .tnode:hover .acts:hover > button { display: block; }
.tree-p3 .tnode:hover .acts:hover::before { display: none; }
.tree-p3 .tnode .tree-edit { width: 100%; min-width: 80px; font: inherit; padding: 0 2px; border: 1px solid var(--accent); background: var(--chrome-3); color: var(--text); }
.tree-p3 .tkids { margin-left: 0; }
.tree-search { padding: 2px 4px; border-top: 1px solid var(--line); }
.tree-search input { width: 100%; font: inherit; font-size: 12px; padding: 2px 4px; border: 1px solid var(--line); background: var(--chrome-3); color: var(--text); }

/* ── P4 property editor (Gui::PropertyEditor::PropertyEditor as the running ANVIL CAD paints it) ─
   Colours are the runtime palette the capture read from the widget (captures/propertyview.json
   view.palette / groupBackground / groupTextColor) and the row pixels of its grab (rows alternate
   #1e1e1e / #2b2b2b, grid lines black, disabled column-1 text #9d9d9d, current row's column 0 on
   the highlight #0f8f89, hover = the stylesheet's QTreeView::item:!selected:hover gradient).
   Geometry: rows 21 px (sizeHint + 5), indentation 12, first column 100 px, Segoe UI 9 pt. */
.pv-editor { --pv-bg: #1e1e1e; --pv-alt: #2b2b2b; --pv-group-bg: #1e1e1e; --pv-group-fg: #faa683; --pv-text: #ffffff;
  --pv-disabled: #9d9d9d; --pv-highlight: #0f8f89; --pv-grid: #000000; --pv-sel-a: #22b8b0; --pv-sel-b: #067a75;
  font: 12px 'Segoe UI', system-ui, sans-serif; color: var(--pv-text); background: var(--pv-bg); outline: none; user-select: none; }
.pv-editor[data-empty="1"] { display: none; }
.pv-row { display: grid; grid-template-columns: var(--pv-col0, 100px) minmax(0, 1fr); height: var(--pv-row, 21px); align-items: stretch;
  box-shadow: inset 0 -1px 0 var(--pv-grid); cursor: default; }
.pv-row:nth-child(even) { background: var(--pv-alt); }
.pv-row.pv-group { grid-template-columns: 1fr; background: var(--pv-group-bg); font-weight: 700; color: var(--pv-group-fg); }
.pv-name, .pv-value { display: flex; align-items: center; min-width: 0; white-space: nowrap; overflow: hidden; }
.pv-name { box-shadow: inset -1px 0 0 var(--pv-grid); padding-right: 4px; }
.pv-row.pv-group .pv-name { box-shadow: none; }
.pv-tw { width: 12px; flex: none; text-align: center; font-size: 11px; }
.pv-label { overflow: hidden; text-overflow: ellipsis; padding-left: 2px; }
.pv-value { padding: 0 4px; }
.pv-value.ro { color: var(--pv-disabled); }
.pv-row:not(.pv-group):not(.editing):hover { background: linear-gradient(var(--pv-sel-a), var(--pv-sel-b)); color: #fff; }
.pv-row:not(.pv-group):not(.editing):hover .pv-value.ro { color: #e6e6e6; }
.pv-row.current .pv-name { background: var(--pv-highlight); color: #fff; }
.pv-check { width: 13px; height: 13px; flex: none; border: 1px solid var(--pv-disabled); background: #fff; margin-right: 6px; box-sizing: border-box; position: relative; }
.pv-check.on::after { content: ''; position: absolute; left: 3px; top: 0; width: 4px; height: 8px; border: solid #1e1e1e; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.pv-swatch { width: 16px; height: 16px; flex: none; margin-right: 4px; border: 1px solid var(--pv-grid); }
.pv-input { width: 100%; height: 19px; box-sizing: border-box; font: inherit; color: var(--pv-text); background: #2d2d2d; border: 1px solid #555; padding: 0 3px; }
.pv-input:focus { outline: none; border-color: var(--pv-highlight); }
.pv-input[data-valid="false"] { color: var(--pv-text); }   /* invalid input is not styled on the desktop (capture invalid-input); it is simply never applied */
.pv-checkbox { width: 13px; height: 13px; }
.pv-color { padding: 0; height: 17px; width: 40px; }
#propData > .pv-editor, #propView > .pv-editor { margin: 0; }

/* ── P5 task panel (Gui::TaskView::TaskView + QSint::ActionPanel / ActionGroup as captured) ────
   captures/taskview.json: the TaskEditControl 42 px tall (QDialogButtonBox at 9,9, buttons
   24 px, centred, OK 106 px wide) ABOVE the scroll area (TaskDialog.cpp:13 North); the
   TaskPanel margins 4/8 and spacing 8 (box at x 4, y 8; the next 8 px below); a TaskBox header
   26 px (font height 16 + 10), its ActionLabel (icon + bold title) at 5,3, the fold QLabel
   16 px at the right (margin 8); the content frame with the box's widget at 5,4; header
   gradient / borders / content ground = the stylesheet's QSint--ActionGroup rules
   (BNC Theme Light.qss:1545-1592 over the theme's PrimaryColor #e3e3e3). */
.task-dock { position: relative; }
.task-dock-edge { position: absolute; left: 0; top: 0; bottom: 0; width: 5px; cursor: ew-resize; z-index: 2; }
.taskview { min-width: 200px; }                                           /* scrollArea->setMinimumWidth(200) */
.task-dialog-layout { gap: 0; }
.task-panel { padding: 8px 4px; gap: 8px; }                               /* ActionPanel margins 4/8/4/8, spacing 8 */
.task-panel:empty { display: none; }
.task-edit-control { height: 42px; padding: 9px; box-sizing: border-box; align-items: center; }
.task-edit-control .dialog-button-box { height: 24px; gap: 6px; }
.task-edit-control .qbtn { min-width: 106px; height: 24px; padding: 0 10px; }
.taskbox { border: 1px solid var(--line); border-radius: 3px; background: var(--chrome); }
.taskbox-hd { height: 26px; padding: 2px 8px 2px 4px; gap: 0; align-items: center;
  background: linear-gradient(#f4f4f4, #d6d6d6); border: 0; border-bottom: 1px solid var(--line); border-radius: 3px 3px 0 0;
  color: var(--text); font-size: 12px; font-weight: 700; }
[data-theme="dark"] .taskbox-hd { background: linear-gradient(var(--chrome-2), var(--chrome)); }
.taskbox-hd .tb-ic { width: 16px; height: 16px; flex: none; margin: 0 4px 0 1px; }
.taskbox-title { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.taskbox-fold { width: 16px; height: 16px; flex: none; margin-left: auto; padding: 2px; box-sizing: border-box; position: relative; }
.taskbox-fold::after { content: ''; position: absolute; left: 4px; top: 5px; width: 6px; height: 6px; border: solid #a8a8a8; border-width: 2px 0 0 2px; transform: rotate(45deg); }   /* arrow-up-lightgray */
.taskbox-fold[data-fold="false"]::after { top: 2px; transform: rotate(225deg); }                                                        /* arrow-down-lightgray */
.taskbox-hd:hover .taskbox-fold::after { border-color: #000; }                                                                           /* :hover -> arrow-...-black */
.taskbox.collapsed .taskbox-hd { border-bottom: 0; border-radius: 3px; }
.taskbox-bd { padding: 4px 5px; gap: 6px; }
.taskbox[data-expandable="false"] .taskbox-hd { cursor: default; }
.taskbox .qui { gap: 6px; }
.taskbox .qlayout.qgrid { grid-template-columns: 1fr 1fr; gap: 6px 6px; }
.taskbox .qlabel { min-height: 24px; display: flex; align-items: center; }
.taskbox .qcombo, .taskbox .qedit { height: 24px; box-sizing: border-box; }
.taskbox .qspin { height: 26px; box-sizing: border-box; }
.taskbox .hbtn.on { background: var(--accent-tint); border-color: var(--accent); }
.taskbox .qlist-row.bold { font-weight: 700; }
.taskbox .qlist-row:disabled { color: var(--text-3); cursor: default; }
.taskbox .qgroup.inactive { opacity: .6; }
.taskbox .qgroup:disabled > :not(legend) { pointer-events: none; }
.taskbox .qgroup legend { font-weight: 400; }
.taskbox .qlayout.qh > .hbtn { flex: none; }
.taskbox .qlayout.qh > .qedit { flex: 1; }

/* ── P6 general dialogs (Qt QDialog / QMessageBox / QInputDialog as the capture measured them:
   captures/dialogs.json - Segoe UI 9 pt = 12 px, layout margins 11, spacing 6, push buttons
   106 x 24, the title bar 31 px (PM_TitleBarHeight), the message-box icon 32 px at (11, 11) with
   the text at x 62, the informative text under it) ──────────────────────────────────────── */
:root { --qlink: #0000ff; }
:root[data-theme="dark"] { --qlink: #71b6fb; }
.qdialog { padding: 0; min-width: 240px; max-width: none; font-size: 12px; }
.qdialog-title { height: 31px; box-sizing: border-box; display: flex; align-items: center; padding: 0 10px; font-weight: 400; background: var(--chrome-2); user-select: none; cursor: default; }
.qdialog > .qui { padding: 11px; gap: 6px; }
.qdialog .dialog-button-box { padding: 0; gap: 6px; align-items: center; }
.qdialog .qbtn, .msgbox .qbtn { min-width: 106px; height: 24px; box-sizing: border-box; padding: 0 10px; }
.qbb-stretch { flex: 1; min-height: 0; min-width: 0; }
.qdialog-float, .qdialog-popup { position: fixed; box-shadow: 0 8px 30px rgba(0,0,0,.3); }
.qdialog-x { position: absolute; top: 0; right: 0; width: 22px; height: 20px; padding: 0; border: 0; background: none; color: inherit;
             font-size: 15px; line-height: 18px; cursor: default; z-index: 2; }
.qdialog-x:hover { background: var(--sel); }
.qdialog-popup { border: 1px solid var(--line); }
.qdialog.dragged { margin: 0; }
.qdialog-overlay { background: rgba(0,0,0,.12); }
.qlayout.qv, .qlayout.qh { gap: 6px; }
.qlayout.qgrid { gap: 6px 6px; }
.qlayout.qgrid.qform { grid-template-columns: auto 1fr; align-items: center; }
.qspacer-v { flex: 1; min-height: 6px; }
.qframe-panel { border: 1px solid var(--line); padding: 2px; }
.qgroup { padding: 9px; }
.qgroup.untitled > legend { display: none; }
.qstack-page[hidden] { display: none; }
.qedit, .qcombo { height: 24px; box-sizing: border-box; }
.qlabel { min-height: 16px; line-height: 16px; }
.qlabel.qpixmap { display: flex; align-items: center; justify-content: center; }
.qtextedit { min-height: 80px; padding: 3px 4px; border: 1px solid var(--line); background: var(--chrome-3); color: var(--text); font: inherit; resize: none; }
.qlabel.error, .qlabel[data-color="red"] { color: #ff0000; }
.ic-48 { width: 48px; height: 48px; }

/* QMessageBox */
.msgbox { min-width: 258px; max-width: 520px; }
.msgbox-grid { display: grid; grid-template-columns: 32px 1fr; column-gap: 19px; row-gap: 6px; padding: 11px; align-items: start; }
.msgbox.no-icon .msgbox-grid { grid-template-columns: 2px 1fr; }
.msgbox-icon { width: 32px; height: 32px; grid-row: 1 / span 2; border: 0; border-radius: 0; color: inherit; display: grid; place-items: center; }
.msgbox-icon.none { width: 2px; }
.msgbox-icon img { display: block; width: 32px; height: 32px; }
.msgbox-icon.glyph { border: 2px solid var(--text-2); border-radius: 50%; width: 28px; height: 28px; }
.msgbox-main { grid-column: 2; font-weight: 400; min-height: 16px; line-height: 16px; white-space: pre-wrap; }
.msgbox-info { grid-column: 2; margin: 0; color: var(--text); white-space: pre-wrap; line-height: 15px; }
.msgbox-check { grid-column: 2; }
.msgbox-details { grid-column: 1 / -1; }
.msgbox .dialog-button-box { grid-column: 1 / -1; padding: 9px 0 0; border-top: 0; }

/* QInputDialog */
.qinput { width: 240px; }
.qinput.multiline { width: 278px; }
.qinput-body { padding: 11px; gap: 6px; }
.qinput-field .qedit, .qinput-field .qcombo, .qinput-field .qspin { width: 100%; height: 24px; box-sizing: border-box; }
.qinput-field .qtextedit { width: 100%; height: 192px; box-sizing: border-box; }

/* QTreeWidget */
.qtree { border: 1px solid var(--line); background: var(--chrome-3); overflow: auto; height: 334px; font-size: 12px; }
.qtree[data-name="typeTree"] { height: 120px; }
.qtree-row { display: flex; align-items: center; gap: 4px; height: 20px; cursor: default; white-space: nowrap; }
.qtree-row:hover { background: var(--sel); }
.qtree-row.on { background: var(--accent-tint); box-shadow: inset 2px 0 0 var(--accent); }
.qtree-row.bold { font-weight: 700; }
.qtree-row.disabled { color: var(--text-3); }
.qtree-tw { width: 12px; flex: none; color: var(--text-3); font-size: 11px; text-align: center; }
.qtree-ic { width: 16px; height: 16px; flex: none; display: inline-flex; }
.qtree-ic .ic { width: 16px; height: 16px; }
.qtree-sub { margin-left: auto; padding-right: 8px; color: var(--text-2); }

/* the property editor's dialog-backed editors: LinkLabel / LabelButton / LabelEditor (label + the browse button) */
.qlinklabel, .qlabelbutton, .qlabeleditor { display: flex; align-items: center; gap: 1px; height: 19px; width: 100%; box-sizing: border-box; }
.qlinklabel-text, .qlabelbutton-text { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 0 3px; font-size: 12px; }
.qlabeleditor .qedit { flex: 1; min-width: 0; height: 19px; }
.qbrowse { width: 19px; min-width: 19px; height: 19px; padding: 0; flex: none; line-height: 1; }
.qlink { color: var(--qlink); text-decoration: underline; cursor: pointer; }
.pv-input.qlinklabel, .pv-input.qlabelbutton, .pv-input.qlabeleditor { background: none; border: 0; padding: 0; }

/* the expression binding of a spin box: the f(x) label at the right (ExpressionSpinBox) */
.pv-spin-host { display: flex; width: 100%; }
.qexpr-wrap { position: relative; display: flex; flex: 1; min-width: 0; }
.qexpr-wrap input { flex: 1; min-width: 0; padding-right: 20px; }
.qexpr-icon { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; cursor: default; display: inline-flex; }
.qexpr-icon .ic { width: 16px; height: 16px; }
input.expr-bound { color: var(--qlink); }
input.expr-invalid { color: #ff0000; }
.pv-row.pv-bound .pv-text { color: var(--qlink); }
.qdialog[data-class="Gui::Dialog::DlgExpressionInput"] > .qui { padding: 9px; gap: 3px; }
.qdialog[data-class="Gui::Dialog::DlgExpressionInput"] .qtextedit[data-name="expression"] { height: 80px; min-height: 80px; }
.qdialog[data-class="Gui::Dialog::DlgExpressionInput"] [data-name="ctrlArea"] { padding: 2px; }
.qdialog[data-class="Gui::Dialog::DlgExpressionInput"] [data-name="ctrlArea"] .qlayout.qh { gap: 4px; }
.qexpr-completer { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.qexpr-cand { font: inherit; font-size: 11px; padding: 1px 6px; border: 1px solid var(--line); background: var(--chrome-2); color: var(--text); cursor: pointer; }

/* the "List" editor: line numbers + the plain text (PropertyListEditor) */
.qlisteditor { display: flex; border: 1px solid var(--line); height: 192px; background: var(--chrome-3); }
.qlisteditor-gutter { width: 28px; flex: none; background: var(--chrome-2); color: var(--text-3); text-align: right; padding: 3px 4px; box-sizing: border-box; font: 12px ui-monospace, Consolas, monospace; overflow: hidden; }
.qlisteditor-gutter div { height: 16px; line-height: 16px; }
.qlisteditor .qtextedit { flex: 1; border: 0; min-height: 0; height: 100%; box-sizing: border-box; font: 12px ui-monospace, Consolas, monospace; line-height: 16px; }
.qlist-dialog { gap: 6px; }

/* DlgAddProperty */
.qdialog[data-class="Gui::Dialog::DlgAddProperty"] .qcombo-edit, .qdialog[data-class="Gui::Dialog::DlgAddProperty"] .qcombo, .qdialog[data-class="Gui::Dialog::DlgAddProperty"] .qedit { width: 100%; box-sizing: border-box; }
.qaddprop-value .qspin, .qaddprop-value .qedit { width: 100%; height: 24px; box-sizing: border-box; }
.qaddprop-noeditor { color: var(--text-3); }

/* the Placement task box: Translation | Center side by side, Rotation under them, Reset 86 x 22 */
.taskbox [data-name="Gui::Dialog::Placement"] > .qlayout.qgrid { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.taskbox [data-name="Gui::Dialog::Placement"] > .qlayout.qgrid > * { grid-column: auto !important; grid-row: auto !important; min-width: 0; }
.taskbox [data-name="Gui::Dialog::Placement"] .qspin { min-width: 0; width: 100%; box-sizing: border-box; }
.taskbox [data-name="Gui::Dialog::Placement"] .qgroup .qlayout.qgrid { grid-template-columns: auto 1fr; }
.taskbox [data-name="Gui::Dialog::Placement"] [data-name="resetButton"] { min-width: 86px; height: 22px; }
.taskbox [data-name="Gui::Dialog::Placement"] .qcheck { white-space: nowrap; }

/* DlgCheckableMessageBox: the pixmap beside the message, the check box centred */
.qdialog[data-class="Gui::Dialog::DlgCheckableMessageBox"] [data-name="pixmapLabel"] { width: 32px; height: 32px; }
.qdialog[data-class="Gui::Dialog::DlgCheckableMessageBox"] [data-name="messageLabel"] { white-space: pre-wrap; }

/* ── P7: the Sketcher edit mode (tasks/sketcheredit.js) ─────────────────────────────── */
/* the edit-mode palette is set on :root from the live profile (sketcher.json); the canvas reads it */
.sketch[data-desktop-palette] svg .ln { stroke-width: var(--sk-w-curve, 2px); }
.sketch[data-desktop-palette] svg .ln.cons { stroke-width: var(--sk-w-cons, 2px); }
.sketch[data-desktop-palette] svg .ln.ly-ext, .sketch[data-desktop-palette] svg .cr.ly-ext { stroke-width: var(--sk-w-ext, 2px); }
.sketch[data-desktop-palette] svg .grid { stroke: var(--sk-grid, #b2b2b2); stroke-width: var(--sk-grid-w, 1px); }
.sk-messages .qlayout.qh { align-items: center; gap: 6px; }
.sk-status { flex: none; }
.sk-status-link { flex: 1; min-width: 0; }
.sk-status-link a { color: var(--qlink); text-decoration: underline; cursor: pointer; }
.sk-status[data-state="fully_constrained"] { color: green; }
.sk-status[data-state="conflicting_constraints"] { color: orangered; }
.sk-status[data-state="redundant_constraints"], .sk-status[data-state="malformed_constraints"], .sk-status[data-state="solver_failed"] { color: red; }
.sk-status[data-state="partially_redundant_constraints"] { color: royalblue; }
.sk-iconbtn { min-width: 24px; height: 24px; padding: 0 4px; display: inline-flex; align-items: center; justify-content: center; gap: 2px; }
.sk-iconbtn .ic { width: 16px; height: 16px; }
.sk-iconbtn .dd, .sk-constraints .split .dd, .sk-elements .split .dd { font-size: 9px; margin-left: 2px; }
.sk-constraints .qlayout.qh, .sk-elements .qlayout.qh { align-items: center; gap: 6px; }
.sk-constraints .qlayout.qh > .qtool[data-name="filterButton"], .sk-elements .qlayout.qh > .qtool[data-name="filterButton"] { flex: 1; text-align: left; }
.sk-list { display: flex; flex-direction: column; gap: 1px; max-height: 190px; overflow: auto; border: 1px solid var(--line); background: var(--chrome-3, #fff); padding: 2px; }
.sk-row { display: flex; align-items: center; gap: 4px; padding: 2px 4px; cursor: default; user-select: none; }
.sk-row:hover { background: var(--sel); }
.sk-row.on { background: var(--accent-tint); box-shadow: inset 2px 0 0 var(--accent); }
.sk-row.off .sk-ic { filter: grayscale(1); opacity: .45; }
.sk-row .sk-ic .ic, .sk-row .sk-part .ic { width: 16px; height: 16px; display: block; }
.sk-row .sk-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sk-row .sk-vs { margin: 0; }
.sk-part { background: none; border: 0; padding: 0 1px; line-height: 0; opacity: .7; cursor: pointer; }
.sk-part:hover { opacity: 1; }
.sk-part.on { opacity: 1; outline: 1px solid var(--accent); background: var(--sel); }
.sk-rename { width: 100%; }
.sk-filter-popup .qui, .sk-settings-popup .qui { min-width: 210px; }
.sk-filterlist { max-height: 60vh; overflow: auto; display: flex; flex-direction: column; gap: 0; }
.sk-filter-item { display: flex; align-items: center; gap: 6px; padding: 2px 6px; white-space: pre; }
.sk-filter-item:hover { background: var(--sel); }
.sk-settings-popup .qlayout.qh { align-items: center; gap: 8px; }
.sk-settings-popup .qspin { width: 110px; }
.sk-renderlist .qlist-row { cursor: pointer; }
.sk-datum .qgrid { grid-template-columns: auto 1fr; }
/* P16.99: a link's borrowed rows - the linked object's properties, named in green (PropertyItem.cpp:658-662) */
.pv-row.pv-linked .pv-label { color: #20aa20; }

/* P16.99 batch 145 - Gui::ActionSelector (Gui/Widgets.cpp): two trees with four 30 x 30 buttons between them */
.qactionsel { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; align-items: stretch; min-height: 160px; }
.qactionsel-col { display: flex; flex-direction: column; min-width: 0; }
.qactionsel-col .qtree { flex: 1; min-height: 120px; }
.qactionsel-btns { display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.qactionsel-btn { width: 30px; height: 30px; min-width: 30px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.qactionsel-btn .ic { width: 16px; height: 16px; }
.qslider { width: 100%; }
.qslider-v { writing-mode: vertical-lr; direction: rtl; width: auto; height: 100px; }
/* the DlgFilletEdges edge table inside its QTreeView, and the Boolean dialog's check boxes */
.qtree .fl-row { display: grid; grid-template-columns: 18px 1fr 92px 92px; gap: 4px; align-items: center; padding: 1px 4px; }
.qtree .fl-hd { font-weight: 600; border-bottom: 1px solid rgba(128,128,128,.35); }
.qtree .fl-row .qspin { width: 100%; min-width: 0; }
.qtree .qtree-check { margin: 0 4px 0 0; }
.qtree.disabled { opacity: .55; pointer-events: none; }
