/* Fusion to Vendor local app. Neutral greys, one accent, no gradients. */
:root {
  --bg: #eceef0;
  --panel: #ffffff;
  --panel-2: #f6f7f8;
  --line: #d3d7dc;
  --line-2: #e4e7ea;
  --text: #1d2126;
  --muted: #5d6671;
  --accent: #1f5fbf;
  --accent-weak: #e3ecf9;
  --danger: #b3261e;
  --danger-weak: #fbe9e7;
  --warn: #8a5a00;
  --warn-weak: #fff4d6;
  --ok: #1a7f37;
  --st-unchanged: #b9bec5;
  --st-changed: #e09b13;
  --st-ambiguous: #8a56d8;
  --st-orphaned: #cf3a30;
  --st-new: #2f9e55;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 12.5px/1.4 "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  color: var(--text); background: var(--bg);
  display: flex; flex-direction: column; overflow: hidden;
}
h2, h3, h4 { margin: 0; font-weight: 600; }
h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
a { color: var(--accent); }
[hidden] { display: none !important; }

/* controls */
button, input, select, textarea { font: inherit; color: inherit; }
button {
  background: var(--panel); border: 1px solid var(--line); border-radius: 3px;
  padding: 3px 9px; cursor: pointer; white-space: nowrap; line-height: 1.35;
}
button:hover:not(:disabled) { background: var(--panel-2); border-color: #b4bac2; }
button:disabled { color: #9aa1a9; cursor: not-allowed; background: var(--panel-2); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover:not(:disabled) { background: #194f9f; border-color: #194f9f; }
button.primary:disabled { background: #a9bcd9; border-color: #a9bcd9; color: #fff; }
button.danger { color: var(--danger); }
button.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
button.small { padding: 1px 6px; font-size: 11.5px; }
button.on { background: var(--accent-weak); border-color: var(--accent); color: var(--accent); }
input[type=text], input[type=number], select, textarea {
  border: 1px solid var(--line); border-radius: 3px; padding: 3px 6px; background: #fff;
  min-width: 0; width: 100%;
}
input[type=color] { width: 30px; height: 24px; padding: 0 1px; border: 1px solid var(--line); border-radius: 3px; background: #fff; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }
input:disabled, select:disabled, textarea:disabled { background: var(--panel-2); color: #8b929a; }
textarea { resize: vertical; min-height: 26px; line-height: 1.3; }
label { color: var(--muted); font-size: 11.5px; }
.row { display: flex; gap: 6px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.right { margin-left: auto; }
.nowrap { white-space: nowrap; }

/* top bar */
#topbar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px;
  background: #2b3037; color: #e8eaed; border-bottom: 1px solid #1c2025;
}
#topbar .brand { font-weight: 600; letter-spacing: .02em; }
#topbar #ctx { color: #b8bfc8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#topbar #ctx b { color: #fff; font-weight: 600; }
#topbar button { background: #3a4049; border-color: #4c535d; color: #e8eaed; }
#topbar button:hover:not(:disabled) { background: #464d57; border-color: #5d6570; }
#topbar button:disabled { color: #808894; background: #333840; }
#topbar button.on { background: #4a5462; border-color: #7f8b9a; color: #fff; }
#topbar button.primary { background: var(--accent); border-color: #3b76cf; }
#topbar button.primary:disabled { background: #39485f; border-color: #39485f; color: #8f9aab; }
#busy { color: #b8bfc8; font-size: 11.5px; min-width: 64px; text-align: right; }
#blocked {
  flex: 0 0 auto; padding: 4px 10px; background: var(--warn-weak); color: var(--warn);
  border-bottom: 1px solid #ecd9a0; font-size: 12px;
}

/* layout */
main { flex: 1 1 auto; display: flex; min-height: 0; }
aside { flex: 0 0 auto; background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
#left { width: 286px; border-right: 1px solid var(--line); }
#right { width: 336px; border-left: 1px solid var(--line); }
.tabs { display: flex; flex: 0 0 auto; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.tabs button {
  flex: 1; border: 0; border-right: 1px solid var(--line); border-radius: 0; background: transparent;
  padding: 6px 4px; color: var(--muted); border-bottom: 2px solid transparent;
}
.tabs button:last-child { border-right: 0; }
.tabs button.on { background: var(--panel); color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tabs .count { display: inline-block; min-width: 16px; padding: 0 4px; margin-left: 3px; border-radius: 8px; background: var(--st-changed); color: #fff; font-size: 10.5px; font-weight: 600; }
.pane { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; min-height: 0; }
.sec { padding: 8px 10px 10px; border-bottom: 1px solid var(--line-2); }
.sec > h3 { margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.sec > h3 .right { text-transform: none; letter-spacing: 0; font-weight: 400; }
details.sec > summary { cursor: pointer; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; margin-bottom: 0; }
details.sec[open] > summary { margin-bottom: 6px; }
.empty { color: var(--muted); padding: 4px 0; }
.form-grid { display: grid; grid-template-columns: 78px 1fr; gap: 4px 6px; align-items: center; }
.form-grid.wide { grid-template-columns: 96px 1fr; }
.hint { font-size: 11.5px; color: var(--muted); }
.err { color: var(--danger); font-size: 11.5px; }
.badge { display: inline-block; padding: 0 5px; border-radius: 3px; font-size: 10.5px; font-weight: 600; border: 1px solid var(--line); color: var(--muted); background: var(--panel-2); text-transform: uppercase; letter-spacing: .03em; }
.badge.warn { color: var(--warn); background: var(--warn-weak); border-color: #ecd9a0; }
.badge.bad { color: var(--danger); background: var(--danger-weak); border-color: #f0c2bd; }
.badge.ok { color: var(--ok); background: #e6f4ea; border-color: #b9dfc4; }
.badge.accent { color: var(--accent); background: var(--accent-weak); border-color: #b9cdea; }

/* lists */
.list { display: flex; flex-direction: column; }
.item { padding: 5px 6px; border: 1px solid var(--line-2); border-radius: 3px; margin-bottom: 4px; background: #fff; }
.item.click { cursor: pointer; }
.item.click:hover { border-color: #b4bac2; }
.item.active { border-color: var(--accent); background: var(--accent-weak); }
.item .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.item .sub { color: var(--muted); font-size: 11.5px; overflow-wrap: anywhere; }
.item .actions { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
table.grid { width: 100%; border-collapse: collapse; font-size: 11.5px; }
table.grid th, table.grid td { text-align: left; padding: 2px 4px; border-bottom: 1px solid var(--line-2); vertical-align: top; overflow-wrap: anywhere; }
table.grid th { color: var(--muted); font-weight: 600; }

/* notes editor */
.note-row { display: grid; grid-template-columns: 18px 1fr auto; gap: 4px; align-items: start; margin-bottom: 4px; }
.note-row .n { color: var(--muted); text-align: right; padding-top: 4px; font-size: 11.5px; }
.note-row .btns { display: flex; flex-direction: column; gap: 2px; }
.note-row .btns button { padding: 0 5px; font-size: 10.5px; line-height: 1.3; }
.swatch { display: inline-block; width: 12px; height: 12px; border: 1px solid rgba(0,0,0,.35); border-radius: 2px; vertical-align: -2px; flex: 0 0 auto; }
.swatch.none { background: #fff !important; border-style: dashed; border-color: #8b929a; }

/* centre */
#centre { flex: 1 1 auto; display: flex; min-width: 0; min-height: 0; background: #dfe2e6; }
#view3d { position: relative; flex: 1 1 0; min-width: 120px; overflow: hidden; background: #e9ebee; }
#view3d canvas { display: block; width: 100%; height: 100%; outline: none; }
#divider { flex: 0 0 6px; cursor: col-resize; background: var(--line); border-left: 1px solid #bfc5cc; border-right: 1px solid #bfc5cc; }
#divider:hover, #divider.drag { background: var(--accent); }
#drawing { flex: 1 1 0; min-width: 120px; display: flex; flex-direction: column; background: #cfd3d8; overflow: hidden; }
.toolbar { display: flex; gap: 4px; align-items: center; padding: 4px 6px; flex-wrap: wrap; }
#view-top { position: absolute; top: 0; left: 0; right: 0; z-index: 2; pointer-events: none; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
#view-top > * { pointer-events: auto; }
#view3d .toolbar { pointer-events: none; align-self: stretch; }
#view3d .toolbar > * { pointer-events: auto; }
#view3d .toolbar label.chk { background: rgba(255,255,255,.9); border: 1px solid var(--line); border-radius: 3px; padding: 2px 7px; color: var(--text); font-size: 12.5px; display: inline-flex; gap: 4px; align-items: center; cursor: pointer; }
#drawing .toolbar { background: var(--panel); border-bottom: 1px solid var(--line); flex: 0 0 auto; }
#view-bottom { position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 2; display: flex; flex-wrap: wrap-reverse; gap: 6px; align-items: flex-end; justify-content: space-between; pointer-events: none; }
#sel-label {
  max-width: 100%;
  background: rgba(255,255,255,.93); border: 1px solid var(--line); border-radius: 3px; padding: 4px 8px;
  pointer-events: none;
}
#sel-label .hov { color: var(--muted); }
#sel-label .nav { color: #747c86; font-size: 11px; }
#legend {
  margin-left: auto; background: rgba(255,255,255,.93);
  border: 1px solid var(--line); border-radius: 3px; padding: 5px 8px; font-size: 11.5px; max-width: 240px;
}
#legend .lg { display: flex; align-items: center; gap: 6px; }
#legend h4 { font-size: 10.5px; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; margin-bottom: 2px; }
#pick-banner {
  margin: 0 8px;
  background: var(--accent); color: #fff; border-radius: 3px; padding: 5px 8px; display: flex; gap: 8px; align-items: center;
  max-width: calc(100% - 16px); flex-wrap: wrap;
}
#pick-banner button { border-color: #fff; color: var(--text); }
#pick-banner button:disabled { color: #8b929a; }
#view-note { margin: 0 8px; background: var(--warn-weak); color: var(--warn); border: 1px solid #ecd9a0; border-radius: 3px; padding: 3px 8px; }
#view-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); text-align: center; padding: 40px; pointer-events: none; }
#dwg-view { position: relative; flex: 1 1 auto; overflow: hidden; min-height: 0; background: #c7ccd2; }
#dwg-view .sheet-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; touch-action: none; user-select: none; }
#dwg-view .sheet-svg.panning { cursor: grabbing; }
#dwg-view .sheet-svg text { user-select: none; }
#dwg-tools { padding-top: 0; }
#dwg-hint { flex: 0 0 auto; height: 44px; overflow: auto; line-height: 1.35; align-content: center; padding: 4px 8px; background: #2b3037; color: #e8eaed; font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
#dwg-hint.warn { background: var(--warn-weak); color: var(--warn); }
#dwg-hint .muted { color: #9aa3ad; }
#dwg-hint button { background: #3a4049; border-color: #59616c; color: #e8eaed; }
#dwg-hint button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
#dwg-hint button.primary { background: var(--accent); border-color: var(--accent); }
#dwg-hint .inline-num { width: 64px; padding: 1px 4px; color: var(--text); }
#dwg-hint .inline-sel { width: auto; padding: 1px 4px; color: var(--text); }
.marks rect { fill: none; vector-effect: non-scaling-stroke; }
.marks .f-hover { stroke: var(--accent); stroke-width: 1.2; stroke-dasharray: 4 3; }
.marks .f-sel { stroke: var(--accent); stroke-width: 2; fill: rgba(31,95,191,.05); }
.marks .f-warn { stroke: #c98a00; stroke-width: 1.5; stroke-dasharray: 3 2; fill: rgba(201,138,0,.06); }
.marks .f-bad { stroke: var(--danger); stroke-width: 2; fill: rgba(179,38,30,.07); }
.marks .f-dim { stroke: #c2408f; stroke-width: 1.2; fill: rgba(194,64,143,.10); }
.marks .f-parent { stroke: #d9541e; stroke-width: 1.5; stroke-dasharray: 6 3; }
.marks .f-tag { fill: var(--accent); font-family: "Segoe UI", Arial, sans-serif; }
.over * { vector-effect: non-scaling-stroke; }
.over .ghost { fill: rgba(31,95,191,.08); stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 6 4; }
.over .g-line { fill: none; stroke: #d9541e; stroke-width: 1.5; }
.over .g-cut path { fill: none; stroke: #d9541e; stroke-width: 2; stroke-dasharray: 10 3 2 3; }
.over .g-cut .arrow-stem { stroke-dasharray: none; stroke-width: 1.5; }
.over .g-cut .arrow-head { fill: #d9541e; stroke: none; }
.over .pt { fill: #fff; stroke: #d9541e; stroke-width: 1.5; }
.over .g-break { stroke: #d9541e; stroke-width: 1.5; fill: none; stroke-dasharray: 5 3; }
.over .band { fill: rgba(217,84,30,.16); stroke: none; }
.over .h-handle { fill: #fff; stroke: var(--accent); stroke-width: 1.5; cursor: move; }
.over .snap * { fill: none; stroke: #0f8f8a; stroke-width: 1.6; }
.over .readout rect { fill: rgba(43,48,55,.9); stroke: none; }
.over .readout text { fill: #fff; font-family: "Segoe UI", Arial, sans-serif; }
#dwg-props { position: absolute; top: 8px; right: 8px; z-index: 3; width: 268px; max-width: calc(100% - 16px); max-height: calc(100% - 16px); overflow: auto;
  background: var(--panel); border: 1px solid #9aa1a9; border-radius: 4px; box-shadow: 0 3px 12px rgba(0,0,0,.18); padding: 6px 8px 8px; font-size: 12px; }
#dwg-props .ph { display: flex; gap: 4px; align-items: center; padding-bottom: 4px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
#dwg-props .pgrid { display: grid; grid-template-columns: 74px 1fr; gap: 5px 6px; align-items: center; margin-top: 4px; }
#dwg-props .pv { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-width: 0; }
#dwg-props .col { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; width: 100%; }
#dwg-props label.chk { color: var(--text); display: inline-flex; gap: 3px; align-items: center; cursor: pointer; }
#dwg-props select { width: auto; max-width: 100%; }
#dwg-props .num { width: 62px; }
#dwg-props .brk { display: flex; gap: 3px; align-items: center; flex-wrap: wrap; }
#dwg-props .brk .num { width: 52px; }
#dwg-props.left { right: auto; left: 8px; }
.callout.bad { background: var(--danger-weak); border-color: #f0c2bd; color: var(--danger); }
#dwg-info { flex: 0 0 auto; max-height: 34%; overflow: auto; background: var(--panel); border-top: 1px solid var(--line); padding: 4px 8px; font-size: 11.5px; }
#dwg-info ul { margin: 2px 0 4px 16px; padding: 0; }

/* tolerances */
.seg { display: flex; margin-bottom: 6px; }
.seg button { flex: 1; border-radius: 0; margin-left: -1px; }
.seg button:first-child { border-radius: 3px 0 0 3px; margin-left: 0; }
.seg button:last-child { border-radius: 0 3px 3px 0; }
.sel-face { display: flex; gap: 6px; align-items: baseline; padding: 1px 0; }
.sel-face .dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.tol-text { font-family: var(--mono); font-size: 12.5px; }
.tol-id { font-family: var(--mono); color: var(--muted); font-size: 11px; }
.fcf { display: inline-flex; border: 1.3px solid var(--text); vertical-align: middle; background: #fff; font-family: var(--mono); font-size: 12.5px; line-height: 1; }
.fcf .cell { display: inline-flex; align-items: center; gap: 2px; padding: 3px 5px; border-right: 1.3px solid var(--text); min-height: 22px; }
.fcf .cell:last-child { border-right: 0; }
.fcf svg { width: 24px; height: 16px; display: block; }
.circ { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; border: 1.1px solid currentColor; border-radius: 50%; font-size: 9.5px; font-weight: 600; margin-left: 2px; }
.datum-sym { display: inline-flex; align-items: center; vertical-align: middle; gap: 0; }
.datum-sym .box { border: 1.3px solid var(--text); padding: 3px 6px; font-family: var(--mono); font-size: 12.5px; line-height: 1; min-height: 22px; display: inline-flex; align-items: center; background: #fff; }
.datum-sym svg { width: 20px; height: 14px; }
.st-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: 0; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.chips button { padding: 1px 7px; font-size: 11.5px; border-radius: 10px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 1px 8px; font-size: 11.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* toasts */
#toasts { position: fixed; right: 12px; bottom: 12px; z-index: 50; display: flex; flex-direction: column; gap: 6px; max-width: 460px; }
.toast { background: #2b3037; color: #fff; border-radius: 3px; padding: 7px 10px; display: flex; gap: 10px; align-items: flex-start; box-shadow: 0 2px 8px rgba(0,0,0,.25); border-left: 4px solid #7f8b9a; }
.toast.error { border-left-color: #f0564a; }
.toast.ok { border-left-color: #4cc274; }
.toast .msg { flex: 1; overflow-wrap: anywhere; white-space: pre-wrap; }
.toast button { background: transparent; border: 0; color: #c8ced6; padding: 0 2px; }
.toast button:hover:not(:disabled) { background: transparent; color: #fff; }

/* dialog */
#modal { position: fixed; inset: 0; z-index: 40; background: rgba(20,24,28,.45); display: flex; align-items: center; justify-content: center; }
#modal .dlg { background: var(--panel); border-radius: 4px; border: 1px solid #9aa1a9; width: 440px; max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 8px 30px rgba(0,0,0,.3); }
#modal .dlg h2 { font-size: 14px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
#modal .dlg .body { padding: 10px 14px; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
#modal .dlg .body p { margin: 0; }
#modal .dlg .body .fld { display: flex; flex-direction: column; gap: 2px; }
#modal .dlg .foot { padding: 8px 14px; border-top: 1px solid var(--line-2); display: flex; gap: 6px; justify-content: flex-end; background: var(--panel-2); border-radius: 0 0 4px 4px; }
.callout { background: var(--warn-weak); border: 1px solid #ecd9a0; color: var(--warn); padding: 6px 8px; border-radius: 3px; }

@media (max-width: 1400px) {
  #left { width: 270px; }
  #right { width: 322px; }
}

/* drafting symbols (symbols.js): inline SVG in text, a font stack that has the glyphs in fields */
svg.sym { width: .82em; height: .82em; vertical-align: -.06em; margin: 0 .06em; fill: none; stroke: currentColor; stroke-width: 1.05; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.symtext { white-space: pre-wrap; }
.symfont, textarea, input[type=text] { font-family: "Segoe UI", "Segoe UI Symbol", "Cambria Math", Arial, sans-serif; }

/* sheet editor, step 2: dimensions edited by hand (dims.js) */
#dwg-tools .tsep { width: 1px; align-self: stretch; background: var(--line); margin: 0 3px; }
#dwg-tools kbd { font: 10px var(--mono); color: var(--muted); margin-left: 2px; }
#dwg-tools button.on kbd { color: var(--accent); }
#face-menu { position: absolute; z-index: 5; background: var(--panel); border: 1px solid #9aa1a9; border-radius: 4px;
  padding: 4px 6px; box-shadow: 0 2px 8px rgba(0,0,0,.18); max-width: 330px; display: flex; flex-direction: column; gap: 4px; }
#face-menu .db-row { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
#face-menu .db-grid { display: grid; grid-template-columns: 58px 240px; gap: 3px 4px; align-items: center; }
#face-menu .db-sub { display: flex; flex-direction: column; gap: 4px; }
#face-menu .tf { padding: 1px 4px; }
#face-menu textarea { width: 100%; }
#dim-bar { position: absolute; z-index: 4; background: var(--panel); border: 1px solid #9aa1a9; border-radius: 4px;
  box-shadow: 0 3px 12px rgba(0,0,0,.2); padding: 3px 4px; font-size: 12px; max-width: calc(100% - 8px); }
#dim-bar .db-row { display: flex; gap: 3px; align-items: center; flex-wrap: wrap; }
#dim-bar .db-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0 4px 0 2px; }
#dim-bar .small-sel { width: auto; padding: 0 2px; font-size: 11.5px; height: 20px; }
#dim-bar .db-sub, #note-box { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 4px; }
#dim-bar .db-grid { display: grid; grid-template-columns: 58px 240px; gap: 3px 4px; align-items: center; }
#dim-bar .db-grid label { color: var(--text); }
#dim-bar .tf { padding: 1px 4px; }
#dim-bar .callout { padding: 3px 6px; font-size: 11.5px; max-width: 420px; }
.db-actions { display: flex; gap: 4px; align-items: center; }
.palette { display: flex; gap: 2px; flex-wrap: wrap; }
.palette .sym-btn { min-width: 22px; padding: 0 4px; font-family: "Segoe UI", "Segoe UI Symbol", "Cambria Math", Arial, sans-serif; }
#note-box { position: absolute; z-index: 5; width: 300px; max-width: calc(100% - 8px); background: var(--panel); border: 1px solid var(--accent);
  border-radius: 4px; box-shadow: 0 3px 12px rgba(0,0,0,.22); padding: 6px; margin: 0; }
#note-box textarea { min-height: 58px; }
#dwg-ann { flex: 0 0 auto; max-height: 24%; overflow: auto; background: var(--panel); border-top: 1px solid var(--line); padding: 2px 8px; font-size: 11.5px; }
#dwg-ann .ann-sec > summary { cursor: pointer; font-weight: 600; padding: 2px 0; }
#dwg-ann .ann-sec.bad > summary { color: var(--danger); }
#dwg-ann .ann-sec.warn > summary { color: var(--warn); }
#dwg-ann .ann-row { display: flex; gap: 4px; align-items: center; padding: 1px 0 1px 12px; }
#dwg-hint .warnline { color: #ffcf7a; }
.marks .f-dimsel { stroke: #c2408f; stroke-width: 2; fill: rgba(194,64,143,.07); }
.over .pv-line { fill: none; stroke: #d9541e; stroke-width: 1.6; }
.over .pv-ext { fill: none; stroke: #d9541e; stroke-width: 1; stroke-dasharray: 4 3; }
.over .pv-head { fill: #d9541e; stroke: none; }
.over .pv-text rect { fill: rgba(217,84,30,.94); stroke: none; }
.over .pv-text text { fill: #fff; font-family: "Segoe UI", "Segoe UI Symbol", "Cambria Math", Arial, sans-serif; }
.over .picked * { fill: none; stroke: #c2408f; stroke-width: 2.4; }
.over .snap .snap-line { stroke-width: 3; stroke: rgba(15,143,138,.55); }
#dim-bar .db-name .symtext { white-space: nowrap; }


/* Stage 3: stack-up and completeness panels (js/stackup.js, js/completeness.js) */
.tabs[data-tabs=right] button { padding: 6px 2px; font-size: 11.5px; }
.su-link .su-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.su-link.unconf { border-left: 3px solid var(--st-changed); }
.su-sign { min-width: 22px; font-weight: 700; }
.su-bars { gap: 4px; margin-top: 3px; }
.su-bar { position: relative; flex: 1 1 0; height: 12px; border: 1px solid var(--line); border-radius: 2px; background: var(--panel-2); }
.su-bar span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); opacity: .8; }
.su-bar.rss span { background: #6b8fd0; }
.su-bar em { position: absolute; right: 3px; top: -1px; font-size: 9.5px; font-style: normal; color: var(--text); }
.su-assume { background: var(--warn-weak); border: 1px solid #ecd9a0; border-radius: 3px; padding: 4px 6px; margin: 4px 0 6px; font-size: 11.5px; }
.su-assume ul { margin: 2px 0 0; padding-left: 16px; }
#su-tighten ul { margin: 2px 0; padding-left: 16px; font-size: 11.5px; }
.ck-rule { margin-bottom: 6px; }
.ck-rule .ck-finding { margin: 3px 0 0 8px; font-size: 11.5px; }
.ck-finding.block { border-left: 3px solid var(--st-changed); }   /* "would block (off for now)": a warning (S1) */
.ck-finding.warn { border-left: 3px solid var(--st-changed); }

/* loading indicator for slow actions (js/busy.js) */
#busy-bar { position: fixed; left: 0; right: 0; top: 0; height: 3px; z-index: 90; overflow: hidden; background: rgba(32,107,196,.18); }
#busy-bar::after { content: ""; position: absolute; top: 0; bottom: 0; width: 30%; background: var(--accent, #206bc4); animation: busy-slide 1.1s ease-in-out infinite; }
@keyframes busy-slide { from { left: -30%; } to { left: 100%; } }
#busy-card { position: fixed; top: 46px; left: 50%; transform: translateX(-50%); z-index: 90; min-width: 300px; max-width: min(520px, calc(100vw - 32px));
  background: var(--panel, #fff); border: 1px solid var(--line, #d0d5db); border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.16); padding: 8px 12px; font-size: 13px; }
#busy-card .busy-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
#busy-card .busy-time { margin-left: auto; color: var(--muted, #6b7280); font-variant-numeric: tabular-nums; padding-left: 12px; }
#busy-card .busy-hint { margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--line-2, #e5e7eb); color: var(--muted, #6b7280); font-size: 12px; }
.busy-spin { width: 14px; height: 14px; flex: none; border-radius: 50%; border: 2px solid rgba(32,107,196,.25); border-top-color: var(--accent, #206bc4); animation: busy-rot .8s linear infinite; }
@keyframes busy-rot { to { transform: rotate(360deg); } }
button.is-loading { position: relative; color: transparent !important; pointer-events: none; }
button.is-loading::after { content: ""; position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -7px 0 0 -7px; border-radius: 50%;
  border: 2px solid rgba(127,127,127,.35); border-top-color: currentColor; border-top-color: var(--accent, #206bc4); animation: busy-rot .8s linear infinite; }
@media (prefers-reduced-motion: reduce) { #busy-bar::after, .busy-spin, button.is-loading::after { animation-duration: 3s; } }

/* library page (js/library.js, docs/library.md) */
.lib-wrap { display: grid; grid-template-columns: 230px minmax(0, 1fr) 290px; flex: 1; min-height: 0; width: 100%; }
.lib-tree { border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.lib-tree-head { display: flex; gap: 6px; align-items: center; padding: 6px 8px; border-bottom: 1px solid var(--line-2); }
.lib-nodes { overflow: auto; flex: 1; padding: 4px 0; }
.lib-node { display: flex; align-items: center; gap: 4px; padding: 3px 6px; cursor: pointer; user-select: none; }
.lib-node:hover { background: var(--panel-2); }
.lib-node.on { background: var(--accent-weak); color: var(--accent); font-weight: 600; }
.lib-node.drop { outline: 2px dashed var(--accent); outline-offset: -2px; }
.lib-node.archived .nm { color: var(--muted); text-decoration: line-through; }
.lib-node .tw { width: 12px; color: var(--muted); flex: none; text-align: center; }
.lib-node .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-node .cnt { color: var(--muted); font-size: 11px; }
.lib-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: auto; padding: 8px 10px; gap: 6px; }
.lib-head-row, .lib-filters { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.lib-head-row .crumbs { font-size: 14px; font-weight: 600; }
.lib-filters .lib-q { flex: 1 1 260px; min-width: 180px; width: auto; }
.lib-filters select, .lib-filters input[type=checkbox] { width: auto; }
.lib-filters .seg button.on { background: var(--accent-weak); border-color: var(--accent); color: var(--accent); }
.lib-node-info, .lib-owners { background: var(--panel); border: 1px solid var(--line-2); border-radius: 4px; padding: 5px 8px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.lib-card { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; cursor: pointer; min-width: 0; display: flex; flex-direction: column; }
.lib-card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.lib-card .thumb { height: 110px; background: #e9ebee; display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--line-2); }
.lib-card .thumb img { max-width: 100%; max-height: 100%; }
.lib-card .cbody { padding: 5px 7px; display: flex; flex-direction: column; gap: 2px; }
.lib-card .row { display: flex; gap: 4px; align-items: center; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.small { font-size: 11px; }
button.ghost { border-color: transparent; background: transparent; }
.tags { display: flex; gap: 3px; flex-wrap: wrap; }
.tag { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 0 6px; font-size: 11px; }
.lib-list { overflow: auto; }
.lib-list img.mini { width: 48px; height: 36px; object-fit: contain; display: block; }
.lib-list tr { cursor: pointer; }
.lib-list tr.on td { background: var(--accent-weak); }
.lib-side { border-left: 1px solid var(--line); background: var(--panel); overflow: auto; padding: 8px 10px; min-width: 0; }
.lib-side h3 { margin: 10px 0 4px; }
.lib-side img.big { width: 100%; border: 1px solid var(--line-2); border-radius: 3px; margin: 6px 0; }
.lib-side-head { display: flex; flex-direction: column; gap: 4px; }
.lib-dl { display: grid; grid-template-columns: 72px 1fr; gap: 3px 6px; margin: 0; }
.lib-dl dt { color: var(--muted); }
.lib-dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.lib-files { margin: 0; padding-left: 16px; }
.lib-hist .timeline li { font-size: 11.5px; }
.lib-menu { position: fixed; z-index: 80; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 4px 14px rgba(0,0,0,.15); padding: 3px; min-width: 210px; }
.lib-menu button { display: block; width: 100%; text-align: left; border: 0; }
.lib-head { color: var(--muted); }
@media (max-width: 1400px) { .lib-wrap { grid-template-columns: 210px minmax(0, 1fr) 250px; } }

/* read-only roles (procurement, technician): every part opens, write controls are hidden; the server refuses writes anyway */
body.readonly #btn-release, body.readonly #btn-drawing, body.readonly #dwg-tools, body.readonly #dwg-reset,
body.readonly #pane-projects > .sec:first-child, body.readonly #left button.danger,
body.readonly #tol-add, body.readonly #right button.danger { display: none !important; }

/* sheet metal panel (js/sheetmetal.js) */
#sm-panel { margin: 0 8px; background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: 3px; padding: 6px 9px; display: flex; flex-direction: column; gap: 5px; max-width: min(460px, calc(100% - 16px)); font-size: 12.5px; }
#sm-panel .sm-head { display: flex; align-items: baseline; gap: 4px; }
#sm-panel .sm-x { margin-left: auto; }
#sm-panel .sm-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
#sm-panel .sm-why { font-size: 11.5px; }
#sm-panel .sm-ok { font-weight: 600; }
#sm-panel .sm-warn { background: var(--warn-weak); color: var(--warn); border: 1px solid #ecd9a0; border-radius: 3px; padding: 3px 7px; }
#sm-panel .sm-bends { display: flex; gap: 4px; flex-wrap: wrap; }
#sm-panel .sm-b { border-radius: 3px; padding: 1px 6px; font-size: 11.5px; color: #fff; }
#sm-panel .sm-b.up { background: #1f8f3a; }
#sm-panel .sm-b.down { background: #c8322b; }
#sm-panel a.button { display: inline-block; background: var(--panel); border: 1px solid var(--line); border-radius: 3px; padding: 1px 8px; text-decoration: none; color: var(--text); }
#view3d .toolbar #v-sm.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* feature A2: notification bell in the top bar (js/notify.js) */
#notify-bell { position: relative; }
#topbar #notify-bell .bell { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; }
#topbar #notify-bell .bell svg { display: block; }
#topbar #notify-bell .bell.has-unread { color: #fff; border-color: #7f8b9a; }
#notify-bell .bell-count { background: var(--danger); color: #fff; border-radius: 9px; min-width: 16px; padding: 0 4px;
  font-size: 11px; line-height: 16px; font-weight: 600; text-align: center; }
#notify-bell .bell-panel { position: absolute; right: 0; top: 30px; z-index: 60; width: 360px; max-width: calc(100vw - 20px);
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
#notify-bell .bell-head { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--line-2); }
#topbar #notify-bell .bell-head button { background: var(--panel-2); border-color: var(--line); color: var(--text); }
#topbar #notify-bell .bell-head button:disabled { color: var(--muted); }
#notify-bell .bell-list { max-height: 60vh; overflow-y: auto; }
#topbar #notify-bell .bell-item { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left;
  background: none; border: 0; border-bottom: 1px solid var(--line-2); border-radius: 0; padding: 6px 8px; color: var(--text); font-weight: 400; }
#topbar #notify-bell .bell-item:hover { background: var(--accent-weak); }
#topbar #notify-bell .bell-item.unread { font-weight: 600; }
#notify-bell .bell-when { font-size: 11px; color: var(--muted); font-weight: 400; }
#notify-bell .bell-empty { padding: 10px; color: var(--muted); }

/* feature A2: "Ask for review" person picker and the asked line (js/team_review.js) */
.person-picker { border: 1px solid var(--line); border-radius: 3px; max-height: 220px; overflow-y: auto; background: var(--panel); }
.person-picker .pp-row { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.person-picker .pp-row:last-child { border-bottom: 0; }
.person-picker .pp-row.off { color: var(--muted); cursor: default; opacity: .65; }
.person-picker .pp-name { flex: 1 1 auto; }
.person-picker .pp-role { font-size: 11.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 0 5px; }
.person-picker .pp-note { font-size: 11px; font-style: italic; }
.person-picker .empty { padding: 8px; }
.review-asked { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 4px 12px; border-bottom: 1px solid var(--line-2); background: var(--panel); font-size: 12.5px; }

/* laser cut */
#lc-panel { margin: 0 8px; background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: 3px; padding: 6px 9px; display: flex; flex-direction: column; gap: 5px; max-width: min(380px, calc(100% - 16px)); font-size: 12.5px; }
#lc-panel .lc-head { display: flex; align-items: baseline; gap: 4px; }
#lc-panel .lc-x { margin-left: auto; }
#lc-panel .lc-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
#lc-panel .lc-ok { font-weight: 600; }
#lc-panel .lc-sub { font-size: 11.5px; }
#lc-panel .lc-warn { background: var(--warn-weak); color: var(--warn); border: 1px solid #ecd9a0; border-radius: 3px; padding: 3px 7px; }
#lc-panel .lc-note { font-size: 11.5px; color: var(--warn); }
#lc-panel .lc-svg { width: 100%; max-height: 180px; background: #fff; border: 1px solid var(--line); border-radius: 3px; }
#lc-panel .lc-out { fill: #e8ecf1; stroke: #1b3a6b; stroke-width: 1.4; }
#lc-panel .lc-in { fill: #fff; stroke: #1b3a6b; stroke-width: 1; }
#lc-panel a.button { display: inline-block; background: var(--panel); border: 1px solid var(--line); border-radius: 3px; padding: 1px 8px; text-decoration: none; color: var(--text); }

/* conflicts (js/conflicts.js, docs/sync.md 5) */
.cf-entry { white-space: nowrap; }
.cf-badge { display: inline-block; min-width: 16px; padding: 0 5px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; text-align: center; }
.cf-badge[hidden] { display: none; }
.cf-page { flex: 1; min-width: 0; overflow: auto; padding: 10px 14px; display: flex; flex-direction: column; gap: 10px; }
.cf-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.cf-list { display: flex; flex-direction: column; gap: 14px; }
.cf-card { border: 1px solid var(--line); border-left: 3px solid var(--danger); border-radius: 4px; background: var(--panel); padding: 10px 12px; }
.cf-title { margin-bottom: 8px; }
.cf-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cf-pane { border: 1px solid var(--line-2); border-radius: 4px; padding: 8px; min-width: 0; }
.cf-pane h4, .cf-card > h4 { margin: 0 0 6px; font-size: 12px; }
.cf-thumb { display: block; max-width: 100%; max-height: 180px; margin: 0 auto 8px; background: #fff; border: 1px solid var(--line-2); }
.cf-files { margin-bottom: 8px; }
.cf-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
@media (max-width: 800px) { .cf-sides { grid-template-columns: 1fr; } }
.lib-tree-head { flex-wrap: wrap; }

/* material presets */
#mp-page { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: flex; flex-direction: column; overflow: hidden; }
#btn-mp.on { background: var(--accent-weak); border-color: var(--accent); }
.mp-head { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.mp-head .grow { flex: 1; min-width: 0; }
.mp-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(360px, 46%) 1fr; gap: 0; }
.mp-list { overflow: auto; padding: 10px 14px; border-right: 1px solid var(--line); background: var(--panel); }
.mp-table tbody tr { cursor: pointer; }
.mp-table tbody tr:hover { background: var(--panel-2); }
.mp-table tbody tr.on { background: var(--accent-weak); }
.mp-table tr.mp-retired td { color: var(--muted); text-decoration: line-through; }
.mp-table tr.mp-retired td:last-child { text-decoration: none; }
.mp-table td.num { text-align: right; }
.mp-table .badge { text-transform: none; white-space: normal; }
.mp-edit { overflow: auto; padding: 12px 16px; }
.mp-edit h2 { font-size: 15px; }
.mp-form { grid-template-columns: 140px 1fr; align-items: start; }
.mp-form textarea, .mp-form input[type=text] { width: 100%; }
.mp-notes textarea { width: 100%; resize: vertical; font-family: var(--mono); font-size: 11.5px; }
.mp-actions { gap: 6px; margin: 8px 0; padding-top: 8px; border-top: 1px solid var(--line-2); }
.mp-actions .grow { flex: 1; }
.mp-hist .row { gap: 8px; padding: 3px 0; border-bottom: 1px solid var(--line-2); align-items: baseline; }
.mp-hist .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.mat-nomatch { color: var(--warn); }
@media (max-width: 900px) { .mp-body { grid-template-columns: 1fr; } .mp-list { border-right: 0; border-bottom: 1px solid var(--line); max-height: 40vh; } }
.mp-table th { white-space: nowrap; }

/* home */
.home { max-width: 1500px; }
.home-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.home-top .grow, .home .tsec-head .grow { flex: 1; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 12px; align-items: start; }
.home-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.home-card { border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px; background: var(--panel); cursor: pointer; }
.home-card:hover, .home-card:focus { border-color: var(--accent); outline: none; background: var(--accent-weak); }
.home-card.child { margin-left: 16px; border-style: dashed; }
.home-card-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.home-card-head .grow { flex: 1; }
.home-card-facts { display: flex; flex-direction: column; gap: 1px; font-size: 11.5px; }
.home-group { margin: 8px 0 12px; }
.home-group h4 { margin: 0 0 4px; font-size: 12px; }
.home-orders tr.late td { background: var(--danger-weak); }
.home-act { white-space: nowrap; }
.home-act select { margin-left: 4px; width: auto; max-width: 130px; }
.home-suggest { margin-top: 6px; padding-top: 4px; border-top: 1px dashed var(--line); }
.home-rels { display: flex; flex-direction: column; gap: 4px; }
.home-rel { display: flex; gap: 8px; align-items: center; padding: 4px; border: 1px solid var(--line-2); border-radius: 4px; cursor: pointer; }
.home-rel:hover, .home-rel:focus { border-color: var(--accent); outline: none; }
.home-rel.new { border-left: 3px solid var(--accent); }
.home-rel img, .home-thumb-none { width: 48px; height: 48px; object-fit: contain; flex: none; background: var(--panel-2); border-radius: 3px; }
.home-rel-text { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 1000px) { .home-grid { grid-template-columns: 1fr; } }

/* releases */
.rel-page { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }
.rel-head, .rel-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 6px 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.rel-head .rel-title { font-size: 14px; }
.rel-head .grow, .rel-bar .grow, .rel-card .grow { flex: 1; min-width: 0; }
.rel-filters .rel-q { flex: 1 1 260px; min-width: 180px; width: auto; }
.rel-filters select { width: auto; max-width: 280px; }
.rel-body { flex: 1; min-height: 0; overflow: auto; padding: 10px 12px; display: flex; flex-direction: column; }
.rel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; align-content: start; }
.rel-card { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; cursor: pointer; min-width: 0; display: flex; flex-direction: column; }
.rel-card:hover, .rel-card:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 1px var(--accent); }
.rel-card .thumb { height: 140px; background: #e9ebee; display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--line-2); overflow: hidden; }
.rel-card .thumb img { max-width: 100%; max-height: 100%; }
.rel-ph { color: var(--muted); font-size: 11.5px; border: 1px dashed var(--line); border-radius: 3px; padding: 18px 22px; }
.rel-card .cbody { padding: 6px 8px; display: flex; flex-direction: column; gap: 2px; }
.rel-card .row { display: flex; gap: 6px; align-items: center; min-width: 0; }
.rel-card .ell, .rel-side .ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rel-rev { font-weight: 600; white-space: nowrap; }
.rel-large { display: flex; flex-direction: column; flex: 1; min-height: 0; gap: 6px; }
.rel-bar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.rel-split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 10px; flex: 1; min-height: 420px; }
.rel-left { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.rel-stage { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
.rel-3d { flex: 1; min-height: 0; position: relative; background: #e9ebee; }
.rel-3d canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; }
.rel-3d-bar { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; padding: 4px 6px; border-top: 1px solid var(--line-2); background: var(--panel-2); }
.rel-3d-msg { position: absolute; top: 40%; left: 0; right: 0; text-align: center; color: var(--muted); pointer-events: none; padding: 0 16px; }
.rel-pdf { flex: 1; width: 100%; min-height: 0; border: 0; background: #fff; }
.rel-side { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; overflow: auto; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.rel-side h3 { margin-top: 6px; }
.rel-side .lib-dl { grid-template-columns: 82px 1fr; }
.rel-side-head { font-size: 14px; }
.rel-name { font-weight: 600; overflow-wrap: anywhere; }
.rel-qty { padding: 2px 0; border-bottom: 1px solid var(--line-2); }
.rel-qty .row, .rel-qty-total { display: flex; gap: 6px; }
.rel-qty-total .grow, .rel-qty .grow { flex: 1; }
.rel-hist .timeline li.on { font-weight: 600; }
@media (max-width: 1000px) { .rel-split { grid-template-columns: 1fr; } .rel-left { min-height: 360px; } }

/* ---- small fixes S1 ---- */
/* top bar: never wraps; the page tabs scroll sideways when the window is narrow; the bell and the
   user menu always stay in view (1500 px desktop default and a ~730 px pane) */
#topbar { min-width: 0; overflow: visible; }
#topbar > * { flex-shrink: 0; }
#topbar .brand, #topbar #ro-badge { white-space: nowrap; }
#topbar #team-nav { flex: 0 1 auto; min-width: 60px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 16px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 16px), transparent); padding-right: 14px; }
#topbar #team-nav::-webkit-scrollbar { display: none; }
#topbar #team-nav button { flex-shrink: 0; }
#topbar #ctx { flex: 0 100 auto; min-width: 0; }   /* the part line gives way first, then the page tabs */
#topbar .grow { flex: 1 1 0; min-width: 0; }
#topbar #busy { min-width: 0; }
#topbar #team-user > button { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1200px) {
  #topbar { gap: 6px; padding: 0 8px; }
  #topbar .brand { display: none; }
  #topbar #team-user > button { max-width: 130px; }
}
@media (max-width: 900px) {
  #topbar #btn-mp { padding: 3px 6px; font-size: 0; }
  #topbar #btn-mp::after { content: "Presets"; font-size: 12.5px; }
  #topbar #btn-left, #topbar #btn-right, #topbar #btn-drawing { padding: 3px 6px; font-size: 0; }
  #topbar #btn-left::after { content: "Data"; font-size: 12.5px; }
  #topbar #btn-right::after { content: "Tol."; font-size: 12.5px; }
  #topbar #btn-drawing::after { content: "Drawing"; font-size: 12.5px; }
  #topbar #team-user > button { max-width: 96px; }
  #topbar #ro-badge .badge { font-size: 0; padding: 0 4px; }
  #topbar #ro-badge .badge::after { content: "RO"; font-size: 10.5px; }
}

/* E4: "Desktop app ... available" line in the user menu (js/update.js) */
#team-user .menu { color: var(--text); }   /* the menu is a light panel inside the dark top bar */
#topbar #team-user .menu button { background: transparent; border-color: transparent; color: var(--text); }
#topbar #team-user .menu button:hover:not(:disabled) { background: var(--accent-weak); border-color: transparent; }
#team-user .menu .update-slot:empty { display: none; }
#team-user .menu .update-slot { margin: 2px 0 4px; padding: 6px 8px; border: 1px solid #b9cdea; border-radius: 3px; background: var(--accent-weak); }
#team-user .menu .update-link { display: block; color: var(--accent); font-weight: 600; text-decoration: none; }
#team-user .menu .update-link::before { content: "\2193  "; }
#team-user .menu .update-link:hover { text-decoration: underline; }
#team-user .menu .update-slot .hint { margin-top: 2px; }

/* read-only roles: editor controls hidden or disabled by js/readonly.js */
body.readonly .ro-hidden { display: none !important; }
body.readonly #dwg-undo, body.readonly #dwg-redo, body.readonly #dwg-hint { display: none !important; }
body.readonly #pane-part input:disabled, body.readonly #pane-part textarea:disabled, body.readonly #pane-part select:disabled,
body.readonly #pane-stackup input:disabled, body.readonly #pane-stackup select:disabled { color: var(--text); cursor: default; }

/* experimental features (stack-up) */
.badge.exp { color: #6b3fa0; background: #f2ebfa; border-color: #d6c4ee; }
.tabs .badge.exp { margin-left: 3px; padding: 0 3px; font-size: 9px; vertical-align: 1px; }
.su-exp { margin: 2px 0 4px; }

/* completeness: rules editor */
#modal .dlg.ck-rules-dlg { width: 820px; }
.ck-rules-table { margin-bottom: 8px; }
.ck-rules-table td select { width: auto; min-width: 150px; }
.ck-rules-table td.lvl-block, .ck-rules-table select.lvl-block { color: var(--warn); }
.ck-rules-table td.lvl-off, .ck-rules-table select.lvl-off { color: var(--muted); }
.ck-rules-hist { font-size: 11.5px; max-height: 160px; overflow: auto; }

/* library: conflict copies in red */
.lib-card.conflict { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); background: var(--danger-weak); }
.lib-card.conflict .thumb { border-bottom-color: #f0c2bd; }
.lib-conflict { white-space: nowrap; flex-shrink: 0; }
.lib-list tr.conflict td { background: var(--danger-weak); }
.lib-list tr.conflict td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
