/* FlowCAD3D — insert menu on a pipe (js/ui/insert-menu.js): a bar next to the clicked point and the list of fitting
   parts. Below menus (z 60) and dialogs (z 70). */
.insbar { position: fixed; z-index: 45; display: flex; flex-direction: column; gap: 4px; padding: 4px; background: var(--overlay-bg); border: 1px solid var(--line2); border-radius: 12px; box-shadow: var(--shadow); max-width: calc(100vw - 12px); }
.insbar-row { display: flex; align-items: stretch; gap: 2px; overflow-x: auto; }
/* the position step after choosing a part: in the middle, or a distance from a chosen point (bend centre, end of line) */
.inspick > .inspos-q, .inspick > .inspos-choice, .inspick > .inspos-hint, .inspick > .inspos-pts, .inspick > .inspos-row, .inspick > .inspos-go, .inspick > .inspos-back { margin-left: 12px; margin-right: 12px; }
.inspick > .inspos-back { margin-bottom: 10px; align-self: flex-start; }
.inspick > .inspos-go { width: auto; flex-shrink: 0; }
.inspos-q { font-weight: 700; font-size: 14px; margin-top: 2px; margin-bottom: 8px; }
.inspos-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.inspos-btn { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left; padding: 10px 12px; border: 1px solid var(--line2); border-radius: 10px; background: var(--bg2); color: var(--fg); font: inherit; cursor: pointer; }
.inspos-btn b { font-size: 14px; }
.inspos-btn span { font-size: 12px; color: var(--fg2); line-height: 1.3; }
.inspos-btn:hover { border-color: var(--accent); }
.inspos-btn.on { border-color: var(--accent); background: var(--accentbg); box-shadow: inset 0 0 0 1px var(--accent); }
.inspos-hint { margin-top: 10px; margin-bottom: 6px; }
.inspos-pts { display: flex; flex-direction: column; gap: 6px; }
.inspos-pts .btn { justify-content: flex-start; }
.inspos-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; margin-bottom: 8px; }
.inspos-row .inp.inspos-dist { width: 120px; }
.inspos-go { justify-content: center; }
.inspos-back { margin-top: 8px; }
.inspos-choice, .inspos-pts { flex-shrink: 0; }
.lbl3d.ins-ptlbl { color: var(--warn); border-color: #f59e0b; font-weight: 700; }
.lbl3d.ins-ptlbl.on { background: #f59e0b; color: #fff; }
body.mode-touch .inspos-btn { min-height: 64px; }
.insbar-head { display: flex; flex-direction: column; justify-content: center; padding: 0 8px 0 6px; margin-right: 2px; border-right: 1px solid var(--line); font-size: 12px; color: var(--fg2); max-width: 150px; }
.insbar-head b { font-size: 13px; color: var(--fg); }
.insbar-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.insbar-k { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 60px; height: 52px; padding: 4px 6px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--fg); font: inherit; font-size: 11px; line-height: 1.15; cursor: pointer; white-space: nowrap; }
.insbar-k svg { width: 22px; height: 22px; }
.insbar-k:hover:not(:disabled) { background: var(--bg3); }
.insbar-k:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.insbar-k.active { background: var(--accentbg); border-color: var(--accent); }
.insbar-k:disabled { opacity: .35; cursor: default; }
.insbar-sep { flex: 0 0 1px; background: var(--line); margin: 6px 2px; }
.insbar-x { flex: 0 0 28px; border: 0; border-radius: 8px; background: transparent; color: var(--fg2); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.insbar-x:hover { background: var(--bg3); }
.insbar-x svg { width: 18px; height: 18px; }
body.mode-touch .insbar-k { min-width: 66px; height: 62px; font-size: 12px; }
body.mode-touch .insbar-k svg { width: 26px; height: 26px; }

.inspick { position: fixed; z-index: 46; width: 460px; max-width: calc(100vw - 12px); max-height: min(62vh, 580px); display: flex; flex-direction: column; background: var(--bg); color: var(--fg); border: 1px solid var(--line2); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.inspick-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 10px 12px 6px; }
.inspick-head b { font-size: 14px; }
.inspick-dirs, .inspick-chips { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 0 12px 8px; }
.chipbtn { border: 1px solid var(--line2); background: var(--bg2); color: var(--fg); border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.chipbtn:hover { border-color: var(--accent); }
.chipbtn.on { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
.inspick .inspick-search { margin: 0 12px 8px; width: auto; }
.inspick-list { overflow: auto; padding: 2px 6px 6px; flex: 1 1 auto; min-height: 60px; }
.insrow { display: flex; gap: 10px; align-items: center; width: 100%; padding: 6px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--fg); font: inherit; text-align: left; cursor: pointer; }
.insrow:hover, .insrow:focus-visible { background: var(--bg3); border-color: var(--line2); outline: none; }
.insrow.off { opacity: .6; }
.insrow-img { flex: 0 0 auto; width: 64px; height: 48px; object-fit: contain; background: var(--bg2); border-radius: 6px; }
.insrow-t { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.insrow-n { font-size: 13px; }
.insrow-d { font-size: 12px; color: var(--fg3); }
.insrow-why { font-size: 12px; color: var(--warn-fg, #B45309); }
.inspick-all { padding: 8px 12px; border-top: 1px solid var(--line); font-size: 13px; }
body.mode-touch .insrow { padding: 9px 6px; }

/* live range of the distance (insert-menu.js syncDist): the permitted distances, or the reason in red; the field is marked */
.inspick > .inspos-range { margin: -2px 12px 8px; color: var(--fg2); }
.inspick > .inspos-range.err { color: var(--danger-fg); }
.inspos-row .inp.inspos-dist.err { border-color: var(--danger-fg); box-shadow: inset 0 0 0 1px var(--danger-fg); }

/* phone (2026.10.46): the kinds wrap into two rows instead of scrolling sideways */
body.phone .insbar { max-width: calc(100vw - 12px); }
body.phone .insbar-row { flex-wrap: wrap; overflow: visible; }
body.phone .insbar-head { flex-basis: 100%; flex-direction: row; gap: 8px; align-items: baseline; border-right: 0; border-bottom: 1px solid var(--line); padding: 2px 6px 4px; margin: 0 0 2px; }
body.phone .insbar-k { min-width: 56px; height: 50px; }
/* phone: the subtype chips in one row that scrolls sideways, so the list of items keeps its room (2026.10.46) */
body.phone .inspick-chips { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
body.phone .inspick-chips::-webkit-scrollbar { display: none; }
body.phone .inspick-chips > * { flex: 0 0 auto; }

/* compact (2026.10.51): the bar and the panel leave the drawing visible */
.insbar { gap: 2px; padding: 3px; border-radius: 10px; }
.insbar-head { max-width: 120px; padding: 0 6px 0 4px; font-size: 11px; }
.insbar-head b { font-size: 12px; }
.insbar-k { min-width: 48px; height: 42px; padding: 2px 4px; gap: 1px; font-size: 10.5px; border-radius: 8px; }
.insbar-k svg { width: 18px; height: 18px; }
body.mode-touch .insbar-k { min-width: 54px; height: 50px; font-size: 11px; }
body.mode-touch .insbar-k svg { width: 22px; height: 22px; }
.inspick { width: 340px; max-height: min(46vh, 420px); border-radius: 10px; }
.inspick-head { padding: 7px 8px 4px 10px; align-items: center; }
.inspick-head b { font-size: 13px; }
.inspick-ht { min-width: 0; }
.inspick-sub { font-size: 11.5px; color: var(--fg2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inspick > .inspos-q, .inspick > .inspos-choice, .inspick > .inspos-hint, .inspick > .inspos-pts, .inspick > .inspos-row, .inspick > .inspos-go, .inspick > .inspos-back, .inspick > .inspos-flat, .inspick > .inspos-roll { margin-left: 10px; margin-right: 10px; }
.inspos-q { font-size: 13px; margin: 0; }
.inspos-choice { display: flex; flex-wrap: wrap; gap: 4px; }
.inspos-btn { flex: 1 1 auto; flex-direction: row; justify-content: center; align-items: center; padding: 5px 8px; border-radius: 8px; min-height: 30px; }
.inspos-btn b { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
body.mode-touch .inspos-btn { min-height: 44px; }
.inspos-pts { flex-direction: row; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.inspos-row { margin-top: 6px; margin-bottom: 4px; }
.inspos-row .inp.inspos-dist { width: 96px; }
.inspick > .inspos-range { margin: 0 10px 6px; }
.inspick > .inspos-back { margin-top: 4px; margin-bottom: 6px; }
.inspick-dirs, .inspick-chips { gap: 4px; padding: 0 10px 6px; }
.inspick .inspick-search { margin: 0 10px 6px; }
.insrow { gap: 8px; padding: 4px 5px; }
.insrow-img { width: 44px; height: 33px; }
.insrow-n { font-size: 12.5px; }
.insrow-d, .insrow-why { font-size: 11px; }
body.mode-touch .insrow { padding: 7px 5px; }
.inspick-all { padding: 5px 10px; font-size: 12px; }
.inspos-btn { padding: 4px 7px; }
.inspos-btn b { font-size: 12px; }
.inspos-row { gap: 6px; }
.inspos-row .inp.inspos-dist { width: 80px; flex: 0 0 auto; }
.inspos-after { flex: 1 1 auto; min-width: 0; line-height: 1.25; }
.inspos-row .inspos-go { flex: 0 0 auto; }

/* the position step: only the heading of the bar stays (2026.10.53) */
.insbar.insbar-min .insbar-k, .insbar.insbar-min .insbar-sep, .insbar.insbar-min .insbar-x { display: none; }
.insbar.insbar-min .insbar-head { border-right: 0; margin-right: 0; }

/* phone: the list of parts as a sheet over the whole screen below the top bar (2026.10.58, L-38) — no longer over the top
   bar, the chips in full and nothing shining through; the position step stays a small panel (points are tapped in 3D) */
body.phone:not(.phone-land) .inspick:has(.inspick-list) { left: 0 !important; right: 0; top: calc(var(--tb-h) + var(--safe-t)) !important; bottom: 0; width: 100%; max-width: 100%; max-height: none !important; border-radius: 0; border: 0; box-shadow: none; visibility: visible !important; padding-bottom: var(--safe-b); }
body.phone:not(.phone-land) .inspick:has(.inspick-list) .inspick-head { padding: 8px 6px 6px 12px; }
body.phone:not(.phone-land) .inspick:has(.inspick-list) .inspick-head .btn { min-width: 44px; min-height: 44px; }
/* only the list gives way when the panel is low: the head, the chips and the search keep their height (L-38) */
.inspick > :not(.inspick-list) { flex-shrink: 0; }
/* free turn about the pipe (2026.10.119) */
.inspos-roll { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.inspos-roll .inspos-roll-inp { width: 64px; text-align: right; }
