/* FlowCAD3D — application styles (brand: docs/brand/FlowCAD3D_Huisstijlhandboek.pdf). Touch-first sizing (min 40px targets). */
/* Theme tokens. Default = FlowCAD3D brand theme (light base, navy header, Accent Blue for actions).
   [data-theme="dark"] = optional dark working theme in brand colours. */
:root {
  --bg: var(--fc-bg); --bg2: #FFFFFF; --bg3: #F4F7FA; --bg4: #E4EBF3; --line: #D6DEE8; --line2: #C2CDDA;
  --fg: var(--fc-navy); --fg2: #3E516A; --fg3: #66768A; --accent: var(--fc-blue); --accent2: #0052CC; --accentbg: rgba(0, 102, 255, .10);
  --cyan: var(--fc-cyan); --ok: #15803D; --warn: #D97706; --err: #DC2626; --info: var(--fc-cyan);
  --header-bg: var(--fc-navy); --header-fg: #FFFFFF; --header-fg2: rgba(255, 255, 255, .68); --header-hover: rgba(255, 255, 255, .10); --header-line: rgba(255, 255, 255, .14);
  --vp-bg: #EEF2F7; --overlay-bg: rgba(255, 255, 255, .95); --lbl-bg: rgba(11, 30, 58, .90); --lbl-fg: #FFFFFF;
  --canvas-bg: #C9D3DE; --toast-bg: var(--fc-navy); --toast-fg: #FFFFFF; --backdrop: rgba(11, 30, 58, .40);
  --proto-bg: #ECE6FA; --proto-fg: #4C2E83; --future-bg: #E4E8ED; --future-fg: #44505E; --danger-fg: #C0262D;
  --ban-warn-bg: #FFF3E0; --ban-warn-fg: #7A4100; --ban-ok-bg: #E7F6EC; --ban-ok-fg: #14532D;
  --fav: #F5A524; --hl: #F5A524;
  --radius: 8px; --tb-h: 64px; --bb-h: 88px; --left-w: 300px; --right-w: 340px;
  --shadow: 0 8px 24px rgba(11, 30, 58, .16);
  font-family: var(--fc-font); font-size: 14px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0B1422; --bg2: #0F1B2D; --bg3: #15243A; --bg4: #1D3050; --line: #22344F; --line2: #2C4263;
  --fg: #E8EEF6; --fg2: #A9B7C9; --fg3: #7E8DA0; --accentbg: rgba(0, 102, 255, .18);
  --header-bg: #081629;
  --vp-bg: #122036; --overlay-bg: rgba(15, 27, 45, .95); --lbl-bg: rgba(7, 20, 40, .92);
  --canvas-bg: #3B4A5F; --toast-bg: #1D3050; --backdrop: rgba(0, 0, 0, .55);
  --proto-bg: #3B2A5E; --proto-fg: #E4DAFF; --future-bg: #2C3A4E; --future-fg: #C8D3E0; --danger-fg: #FF9C9C;
  --ban-warn-bg: #5B2E0A; --ban-warn-fg: #FFE3C2; --ban-ok-bg: #123F26; --ban-ok-fg: #D6F5E1;
  --shadow: 0 8px 28px rgba(0, 0, 0, .45);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); overflow: hidden; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-weight: 700; letter-spacing: -.01em; }
#app { display: flex; flex-direction: column; height: 100%; }
.ico { width: 20px; height: 20px; flex: none; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
#topbar { height: var(--tb-h); display: flex; align-items: center; gap: 4px; padding: 0 10px; background: var(--header-bg); color: var(--header-fg); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
#topbar::-webkit-scrollbar { display: none; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: 10px; white-space: nowrap; color: var(--header-fg); text-decoration: none; }
.brand img.brand-logo { height: 54px; width: auto; display: block; flex: none; }
.brand img.brand-mark { height: 42px; width: auto; display: none; flex: none; }
@media (max-width: 1100px) { .brand img.brand-logo { display: none; } .brand img.brand-mark { display: block; } }
.about-logo img { width: 360px; max-width: 100%; height: auto; display: block; margin: 0 0 8px -6px; }
.tb-group { display: flex; align-items: center; gap: 2px; padding: 0 4px; border-left: 1px solid var(--header-line); }
.tb-group:first-of-type { border-left: 0; }
.tb-spacer { flex: 1; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; min-width: 40px; padding: 0 10px; border-radius: var(--radius); border: 1px solid transparent; background: transparent; cursor: pointer; white-space: nowrap; color: var(--fg); user-select: none; }
.btn:hover { background: var(--bg4); }
.btn:active { transform: translateY(1px); }
.btn.active, .btn[aria-pressed="true"] { background: var(--accentbg); border-color: var(--accent); color: var(--fg); }
#topbar .btn { color: var(--header-fg); }
#topbar .btn:hover { background: var(--header-hover); }
#topbar .btn.active { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
#topbar .tb-select { max-width: 150px; background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .24); color: var(--header-fg); }
#topbar .tb-select option { color: var(--fc-navy); background: #FFFFFF; }
#topbar .seg { border-color: rgba(255, 255, 255, .24); }
.btn.primary { background: var(--accent); color: #FFFFFF; font-weight: 600; }
.btn.primary:hover { background: var(--accent2); }
.btn.danger { color: var(--danger-fg); }
.btn.danger:hover { background: rgba(220, 38, 38, .12); }
.btn.outline { border-color: var(--line2); }
.btn.small { min-height: 32px; min-width: 32px; padding: 0 8px; font-size: 13px; }
.btn:disabled { opacity: .4; cursor: default; transform: none; }
.btn .lbl { font-size: 13px; }
.btn .caret { width: 14px; height: 14px; transform: rotate(90deg); opacity: .6; }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: var(--radius); overflow: hidden; }
.seg .btn { border-radius: 0; min-width: 34px; padding: 0 8px; }
.seg .btn.active { border: 0; background: var(--accent); color: #FFFFFF; }
.tb-select { min-height: 36px; background: var(--bg3); border: 1px solid var(--line2); border-radius: var(--radius); padding: 0 6px; max-width: 170px; }

/* dropdown menus */
.menu { position: fixed; z-index: 60; min-width: 240px; max-height: 80vh; overflow: auto; background: var(--bg3); border: 1px solid var(--line2); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; }
.menu .mi { display: flex; width: 100%; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; text-align: left; }
.menu .mi:hover { background: var(--bg4); }
.menu .mi:disabled { opacity: .4; cursor: default; }
.menu .mi .kbd { margin-left: auto; color: var(--fg3); font-size: 12px; }
.menu .sep { height: 1px; background: var(--line); margin: 5px 4px; }
.menu .mh { padding: 6px 10px 2px; color: var(--fg3); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.menu .mi .chk { width: 16px; color: var(--accent); }
.badge-proto { font-size: 10px; padding: 1px 5px; border-radius: 4px; background: var(--proto-bg); color: var(--proto-fg); font-weight: 600; margin-left: 6px; text-transform: uppercase; letter-spacing: .04em; }
.badge-future { font-size: 10px; padding: 1px 5px; border-radius: 4px; background: var(--future-bg); color: var(--future-fg); font-weight: 600; margin-left: 6px; text-transform: uppercase; }

/* ---------- main layout ---------- */
#main { flex: 1; display: flex; min-height: 0; position: relative; }
.panel { background: var(--bg2); display: flex; flex-direction: column; min-height: 0; }
#left { width: var(--left-w); border-right: 1px solid var(--line); }
#right { width: var(--right-w); border-left: 1px solid var(--line); }
#center { flex: 1; position: relative; min-width: 0; }
.workspace { position: absolute; inset: 0; display: none; }
.workspace.active { display: block; }
#ws-dashboard, #ws-bom, #ws-drawings { overflow: auto; background: var(--bg); }
body.left-collapsed #left, body.right-collapsed #right { display: none; }
body:not(.ws-model) #left, body:not(.ws-model) #right { display: none !important; }

/* viewport */
#viewport { width: 100%; height: 100%; display: block; outline: none; touch-action: none; background: var(--vp-bg); }
#overlay { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
/* "Leidinggegevens" panel while drawing (js/ui/route-info.js) */
.ri { position: absolute; left: 92px; bottom: 10px; z-index: 20; width: 272px; max-width: calc(100% - 104px); background: var(--overlay-bg); border: 1px solid var(--line2); border-radius: 10px; box-shadow: var(--shadow); font-size: 12px; color: var(--fg); }
.ri-head { display: flex; align-items: center; gap: 4px; padding: 4px 4px 4px 10px; }
.ri:not(.collapsed) .ri-head { border-bottom: 1px solid var(--line); }
.ri-title { flex: 1; font-weight: 700; font-size: 12.5px; }
.ri-head .btn { min-width: 32px; min-height: 32px; padding: 0 6px; font-weight: 700; }
.ri-min .ico { width: 16px; height: 16px; transform: rotate(90deg); transition: transform .12s ease; }
.ri.collapsed .ri-min .ico { transform: rotate(-90deg); }
.ri-body { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; padding: 8px 10px 9px; }
.ri-body .k { color: var(--fg3); white-space: nowrap; }
.ri-body .v { text-align: right; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }
.ri-body .v b { font-size: 13px; }
.ri-sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.ri-msg { padding: 6px 10px 8px; border-top: 1px solid var(--line); font-size: 11.5px; }
.ri-msg.err { color: var(--err); } .ri-msg.warn { color: var(--warn); }
body.rtinfo-open .sec-panel { left: 376px; }
.lbl3d.len { transform: translate(-50%, -50%); padding: 0 5px; font-size: 11px; line-height: 16px; border-radius: 3px; background: var(--overlay-bg); color: var(--fg); border: 1px solid var(--line2); font-variant-numeric: tabular-nums; }
.lbl3d.len.err { border-color: var(--err); color: var(--err); background: var(--overlay-bg); }
/* dimensions and data in 3D (js/3d/annotations.js) */
.annot-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.ann { position: absolute; white-space: nowrap; font-size: 11px; line-height: 16px; padding: 0 5px; border-radius: 3px; font-variant-numeric: tabular-nums; }
.ann.dim { background: var(--overlay-bg); color: var(--fg); border: 1px solid var(--line2); font-weight: 500; }
.ann.line { background: var(--lbl-bg); color: var(--lbl-fg); border: 1px solid transparent; border-left: 4px solid var(--c, var(--accent)); font-weight: 600; padding: 0 6px 0 5px; }
.ann.tag { background: var(--bg2); color: var(--fg); border: 1px solid var(--fg); font-weight: 700; }
.ann.eq { background: var(--fc-navy); color: #FFFFFF; border: 1px solid var(--fc-navy); font-weight: 700; font-size: 12.5px; line-height: 20px; padding: 0 7px; border-radius: 4px; }
.ann.sup { background: var(--bg2); color: var(--fg2); border: 1px dashed var(--fg3); font-weight: 700; font-size: 10.5px; line-height: 14px; }
.ann.el, .ann.weld { padding: 0 3px; font-size: 10.5px; line-height: 16px; font-weight: 600; text-shadow: 0 0 3px var(--vp-bg), 0 0 3px var(--vp-bg), 0 0 2px var(--vp-bg); }
.ann.el { color: var(--fg2); }
.ann.weld { color: #B45309; }
:root[data-theme="dark"] .ann.eq { background: var(--accent); border-color: var(--accent); }
:root[data-theme="dark"] .ann.weld { color: #FBBF24; }
.lbl3d { position: absolute; transform: translate(-50%, -130%); background: var(--lbl-bg); border: 1px solid transparent; color: var(--lbl-fg); padding: 3px 7px; border-radius: 6px; font-size: 12px; white-space: nowrap; }
.lbl3d.err { border-color: var(--err); background: #7F1D1D; color: #FFE4E4; }
.lbl3d.tag { background: var(--lbl-bg); font-size: 11px; transform: translate(-50%, -100%); }
.lbl3d.ang { background: none; border: 0; padding: 0; color: var(--fg); font-size: 11px; font-weight: 600; transform: translate(-50%, -50%); text-shadow: 0 0 3px var(--vp-bg), 0 0 3px var(--vp-bg), 0 0 2px var(--vp-bg); }
.lbl3d.ang.axis0 { color: var(--fg2); font-weight: 700; }
.lbl3d.angcur { background: #F59E0B; color: #0B1E3A; font-weight: 700; transform: translate(-50%, -50%); }
.lbl3d.axis { background: none; border: 0; font-weight: 700; font-size: 13px; }
#viewbar { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 4px; background: var(--overlay-bg); box-shadow: var(--shadow); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px; }
#viewbar .btn { min-height: 34px; font-size: 11px; font-weight: 600; padding: 0 6px; }
#hint { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); background: var(--overlay-bg); color: var(--fg); border: 1px solid var(--accent); padding: 8px 14px; border-radius: var(--radius); max-width: 70%; text-align: center; box-shadow: var(--shadow); }
#hint.err { border-color: var(--err); }
@media (min-width: 901px) { body.tut-open #hint { left: calc(50% + 190px); max-width: calc(100% - 400px); } }   /* keep clear of the tutorial window */
#altpanel { position: absolute; left: 12px; bottom: 12px; width: 340px; background: var(--bg2); border: 1px solid var(--accent); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
#noWebgl { position: absolute; inset: 20% 20%; background: var(--bg3); padding: 20px; border-radius: var(--radius); border: 1px solid var(--err); }

/* ---------- panels ---------- */
.ph { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line); min-height: 48px; }
.ph h3 { margin: 0; font-size: 14px; font-weight: 600; flex: 1; }
.pbody { flex: 1; overflow: auto; padding: 8px 10px; -webkit-overflow-scrolling: touch; }
.tabs { display: flex; gap: 2px; padding: 6px 6px 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex: none; }
.tabs .tab { min-height: 38px; padding: 0 10px; border: 0; background: none; border-bottom: 2px solid transparent; cursor: pointer; color: var(--fg2); white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.tabs .tab.active { color: var(--fg); font-weight: 600; border-bottom-color: var(--accent); }
.tabs .tab .cnt { font-size: 11px; background: var(--bg4); padding: 0 6px; border-radius: 9px; }
.tabs .tab .cnt.err { background: var(--err); color: #fff; }
.tabs .tab .cnt.warn { background: var(--warn); color: #111; }

/* forms */
.field { display: grid; grid-template-columns: 42% 58%; align-items: center; gap: 6px; margin: 5px 0; }
.field > label { color: var(--fg2); font-size: 12.5px; }
.field.full { grid-template-columns: 1fr; }
.inp, select.inp, textarea.inp { width: 100%; min-height: 36px; background: var(--bg3); border: 1px solid var(--line2); border-radius: 6px; padding: 4px 8px; }
.inp:focus { outline: none; border-color: var(--accent); }
.inp[readonly] { background: transparent; border-color: transparent; color: var(--fg); padding-left: 0; }
.xyz { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.xyz .inp { padding: 4px 6px; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.xyz .inp::-webkit-outer-spin-button, .xyz .inp::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.grp { border: 1px solid var(--line); border-radius: var(--radius); margin: 8px 0; background: var(--bg2); }
.grp > summary { cursor: pointer; padding: 8px 10px; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 6px; min-height: 40px; }
.grp > summary::-webkit-details-marker { display: none; }
.grp > summary::before { content: '▸'; color: var(--fg3); transition: transform .15s; }
.grp[open] > summary::before { transform: rotate(90deg); }
.grp > .gb { padding: 2px 10px 10px; }
.row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.muted { color: var(--fg3); }
.small { font-size: 12px; }
.note { background: var(--bg3); border-left: 3px solid var(--info); padding: 8px 10px; border-radius: 6px; margin: 8px 0; font-size: 12.5px; color: var(--fg2); }
.note.warn { border-left-color: var(--warn); }
.note.proto { border-left-color: #8B6FD6; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 12px; background: var(--bg4); font-size: 12px; }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: none; }
h4 { margin: 12px 0 6px; font-size: 13px; color: var(--fg2); text-transform: uppercase; letter-spacing: .05em; }

/* lists */
.list { display: flex; flex-direction: column; gap: 4px; }
.li { display: flex; gap: 8px; align-items: flex-start; padding: 8px; border-radius: 6px; background: var(--bg3); border: 1px solid transparent; cursor: pointer; min-height: 40px; }
.li:hover { border-color: var(--line2); }
.li.sel { border-color: var(--accent); background: var(--accentbg); }
.li .grow { flex: 1; min-width: 0; }
.li .t1 { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.li .t2 { color: var(--fg3); font-size: 12px; }
.lvl { font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; flex: none; }
.lvl.ERROR { background: var(--err); color: #fff; } .lvl.WARNING { background: var(--warn); color: #111; } .lvl.INFO { background: var(--info); color: var(--fc-navy); }
.lvl.hard, .lvl.maintenance { background: var(--err); color: #fff; } .lvl.insulation { background: #f97316; color: #111; } .lvl.clearance { background: var(--warn); color: #111; }
.lvl.ok { background: var(--ok); color: #fff; } .lvl.stale { background: var(--warn); color: #111; }

/* library: clean grouped list (no chips, no pictograms) */
.lib-search { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px 2px; }
.lib-views { padding: 0 6px; }
.lib-views .tab { min-height: 36px; font-size: 13px; }
.lib-views .tab .lt-n { color: var(--fg3); font-weight: 400; font-size: 12px; font-variant-numeric: tabular-nums; }
.lib-tools { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.lib-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.lib-filters select { min-height: 34px; font-size: 12.5px; }
.pbody.lib-list { padding: 0; }
.lib-grp { border-bottom: 1px solid var(--line); }
.lib-group { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 6px; width: 100%; min-height: 38px; padding: 0 12px 0 8px; border: 0; background: var(--bg3); color: var(--fg); font-size: 13px; font-weight: 600; text-align: left; cursor: pointer; }
.lib-group:hover { background: var(--bg4); }
.lib-group:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.lib-group .lg-chev { display: inline-flex; color: var(--fg3); transition: transform .12s ease; }
.lib-group .lg-chev .ico { width: 16px; height: 16px; }
.lib-grp.open .lg-chev { transform: rotate(90deg); }
.lib-group .lg-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-group .lg-count { color: var(--fg3); font-weight: 500; font-size: 12px; font-variant-numeric: tabular-nums; }
.lib-grp.open .lib-group { border-bottom: 1px solid var(--line); }
.lib-row { display: flex; align-items: center; gap: 4px; min-height: 56px; padding: 5px 4px 5px 14px; border-bottom: 1px solid var(--line); background: var(--bg2); cursor: grab; touch-action: pan-y; user-select: none; }
.lib-items .lib-row:last-child { border-bottom: 0; }
.lib-flat .lib-row { padding-left: 8px; }
.lib-row:hover { background: var(--bg3); }
.lib-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.lib-row.active { background: var(--accentbg); box-shadow: inset 3px 0 0 var(--accent); }
.lib-row .lr-text { flex: 1; min-width: 0; }
.lib-row .lr-name { font-size: 13px; line-height: 1.3; color: var(--fg); }
.lib-row .lr-data { margin-top: 1px; font-size: 11.5px; line-height: 1.35; color: var(--fg3); font-variant-numeric: tabular-nums; }
.lib-row .lr-warn { color: var(--warn); }
.lib-row.notallowed .lr-name { color: var(--fg3); }
.lib-row .lr-fav { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 0; border-radius: 6px; background: none; color: var(--line2); cursor: pointer; }
.lib-row:hover .lr-fav, .lib-row:focus-within .lr-fav { color: var(--fg3); }
.lib-row .lr-fav:hover { background: var(--bg4); color: var(--fg2); }
.lib-row .lr-fav .ico { width: 16px; height: 16px; }
.lib-row .lr-fav.on { color: var(--fav); }
.lib-row .lr-fav.on .ico { fill: var(--fav); }
.lib-more { padding: 8px 12px 8px 30px; font-size: 12px; color: var(--fg3); }
.lib-empty { padding: 16px 12px; font-size: 12.5px; color: var(--fg3); }
.dragghost { position: fixed; z-index: 90; pointer-events: none; padding: 6px 10px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 12px; box-shadow: var(--shadow); transform: translate(12px, 12px); }

/* bottom bar */
#bottombar { background: var(--bg2); border-top: 1px solid var(--line); }
#inputbar { display: flex; align-items: center; gap: 6px; padding: 6px 8px; overflow-x: auto; min-height: 48px; flex-wrap: nowrap; scrollbar-width: thin; }
#inputbar > * { flex: none; }
#inputbar .inp { width: 88px; min-height: 36px; }
#inputbar .inp.wide { width: 170px; }
#inputbar .ib-label { color: var(--fg2); font-size: 12px; white-space: nowrap; }
#inputbar .ag-ctx { font-weight: 600; color: var(--fg); }
#inputbar .ag-title { font-weight: 700; color: var(--accent); }
#inputbar .ag-step { display: flex; align-items: center; gap: 6px; padding: 0 8px 0 4px; border-radius: 10px; flex: none; }
#inputbar .ag-step.active { box-shadow: 0 0 0 1px var(--accent); background: var(--accentbg); }
#inputbar .ag-n { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; background: var(--bg4); color: var(--fg2); flex: none; }
#inputbar .ag-step.active .ag-n { background: var(--accent); color: #FFFFFF; }
#inputbar .ag-step.todo { opacity: .5; }
#inputbar .ag-chip { font-weight: 600; }
#inputbar .ag-hlres { font-variant-numeric: tabular-nums; color: var(--fg); font-weight: 600; white-space: nowrap; }
#inputbar .ag-hlres.err { color: var(--err); }
#inputbar .ag-hlm { width: 128px; min-width: 0; }
#inputbar .rt-method .btn { min-width: 0; }
#inputbar .ag-step.done .ag-n { background: var(--fc-navy); color: #FFFFFF; }
#inputbar .ib-sep { width: 1px; height: 28px; background: var(--line); margin: 0 4px; flex: none; }
#statusbar { display: flex; gap: 14px; padding: 4px 10px; font-size: 12px; color: var(--fg2); border-top: 1px solid var(--line); min-height: 28px; align-items: center; white-space: nowrap; overflow: hidden; }
#statusbar .st-msg { flex: 1; overflow: hidden; text-overflow: ellipsis; color: var(--fg); }
#statusbar .mono { font-family: Consolas, "Courier New", monospace; }

/* modal */
#modal-root .backdrop { position: fixed; inset: 0; background: var(--backdrop); z-index: 70; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--bg2); border: 1px solid var(--line2); border-radius: 12px; box-shadow: var(--shadow); width: min(760px, 100%); max-height: 92vh; display: flex; flex-direction: column; }
.modal.wide { width: min(1100px, 100%); }
.triad { position: absolute; left: 8px; bottom: 6px; z-index: 5; pointer-events: none; color: var(--fg2); }
.sec-panel { position: absolute; left: 12px; bottom: 88px; z-index: 30; width: 270px; background: var(--overlay-bg); border: 1px solid var(--line2); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.sec-panel .row { display: flex; align-items: center; gap: 8px; }
.sec-panel .sec-range { width: 100%; accent-color: var(--accent); }
.sec-panel .sec-chk { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.modal.rt-modal { width: min(1320px, 100%); }
.rt-dlg { display: flex; gap: 16px; align-items: flex-start; }
.rt-left { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.rt-view { position: relative; background: repeating-conic-gradient(var(--bg4) 0% 25%, var(--bg3) 0% 50%) 50% / 20px 20px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; min-height: 260px; display: flex; align-items: center; justify-content: center; }
.rt-canvas { display: block; max-width: 100%; max-height: 62vh; width: auto; height: auto; }
.rt-empty { color: var(--fg3); padding: 40px 20px; text-align: center; }
.rt-bar { height: 6px; border-radius: 3px; background: var(--bg4); overflow: hidden; }
.rt-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--fc-blue), var(--fc-cyan)); transition: width .3s; }
.rt-status { font-size: 12px; color: var(--fg2); min-height: 18px; }
.rt-settings { width: 330px; flex: none; display: flex; flex-direction: column; gap: 2px; }
@media (max-width: 900px) { .rt-dlg { flex-direction: column; } .rt-settings { width: 100%; } }
.modal.narrow { width: min(460px, 100%); }
.modal .mh2 { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal .mh2 h2 { margin: 0; font-size: 17px; flex: 1; }
.modal .mb { padding: 12px 16px; overflow: auto; flex: 1; }
.modal .mf { padding: 10px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th, .tbl td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.tbl th { background: var(--bg3); position: sticky; top: 0; z-index: 1; font-weight: 600; color: var(--fg2); white-space: nowrap; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--bg3); }
.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tblwrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }

/* workspaces */
.ws-inner { padding: 18px 22px; max-width: 1400px; margin: 0 auto; }
.ws-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.ws-head h1 { margin: 0; font-size: 22px; flex: 1; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; }
.tile:hover { border-color: var(--accent); }
.tile .tv { font-size: 28px; font-weight: 700; }
.tile .tl { color: var(--fg2); font-size: 12.5px; }
.tile.err .tv { color: var(--err); } .tile.warn .tv { color: var(--warn); } .tile.ok .tv { color: var(--ok); }
.cards2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; margin-top: 14px; }
.box { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.box h3 { margin: 0 0 8px; font-size: 15px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 4px 10px; font-size: 13px; }
.kv div:nth-child(odd) { color: var(--fg2); }
.startgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 14px 0; }
.bigbtn { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; padding: 16px; border-radius: 12px; background: var(--bg2); border: 1px solid var(--line); color: var(--fg); cursor: pointer; text-align: left; min-height: 96px; }
.bigbtn:hover { border-color: var(--accent); background: var(--bg3); }
.bigbtn .ico { width: 28px; height: 28px; color: var(--accent); }
.bigbtn b { font-size: 15px; }
.bigbtn span { color: var(--fg2); font-size: 12.5px; }

/* drawings */
.drw-layout { display: grid; grid-template-columns: 300px 1fr; height: 100%; }
.drw-list { border-right: 1px solid var(--line); overflow: auto; background: var(--bg2); display: flex; flex-direction: column; }
.drw-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.drw-tools { display: flex; gap: 4px; padding: 6px 8px; border-bottom: 1px solid var(--line); flex-wrap: wrap; background: var(--bg2); align-items: center; }
.drw-canvas { flex: 1; position: relative; overflow: hidden; background: var(--canvas-bg); touch-action: none; cursor: grab; }
.drw-canvas svg { position: absolute; left: 0; top: 0; transform-origin: 0 0; box-shadow: 0 6px 24px rgba(11, 30, 58, .28); }
.drw-canvas svg .dim:hover line, .drw-canvas svg .dim:hover text { stroke: #e11d48; fill: #e11d48; cursor: pointer; }
.drw-banner { background: var(--ban-warn-bg); color: var(--ban-warn-fg); padding: 8px 12px; display: flex; gap: 10px; align-items: center; border-bottom: 1px solid var(--line); }
.drw-banner.ok { background: var(--ban-ok-bg); color: var(--ban-ok-fg); }
.snapdot { fill: #e11d48; fill-opacity: .8; cursor: crosshair; }
.snapdot.picked { fill: #22c55e; }

/* context menu, toast */
#ctxmenu { position: fixed; z-index: 80; }
#toast-root { position: fixed; bottom: calc(var(--bb-h) + 12px); right: calc(var(--right-w) + 16px); align-items: flex-end; z-index: 95; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: var(--toast-bg); color: var(--toast-fg); border: 1px solid transparent; border-left: 4px solid var(--accent); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: min(620px, 92vw); pointer-events: none; font-size: 13px; opacity: .97; }
.toast.ok { border-left-color: var(--ok); } .toast.warn { border-left-color: var(--warn); } .toast.err { border-left-color: var(--err); }

/* tutorial */
#tutorial { position: fixed; left: calc(var(--left-w) + 14px); top: calc(var(--tb-h) + 12px); width: 360px; max-width: calc(100vw - 28px); max-height: calc(100vh - var(--tb-h) - var(--bb-h) - 40px); overflow: auto; z-index: 85; background: var(--bg2); border: 1px solid var(--accent); border-radius: 12px; box-shadow: var(--shadow); padding: 12px 14px 14px; }
#tutorial h3 { margin: 4px 0 6px; font-size: 15px; }
#tutorial .tut-head { display: flex; align-items: center; gap: 4px; }
#tutorial .tut-where { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
#tutorial .tut-where b { font-size: 13px; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tutorial .tut-min .ico { transform: rotate(-90deg); transition: transform .12s ease; }
#tutorial.collapsed .tut-min .ico { transform: rotate(90deg); }
#tutorial.collapsed .tut-body { display: none; }
#tutorial.collapsed .prog { margin-bottom: 0; }
#tutorial .tut-text { font-size: 13px; line-height: 1.5; color: var(--fg); }
#tutorial .tut-text kbd, .tut-row kbd { display: inline-block; min-width: 18px; padding: 0 5px; font: 600 11px/18px var(--fc-font); text-align: center; color: var(--fg); background: var(--bg3); border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 4px; }
#tutorial .tut-wait { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--fg3); }
#tutorial .tut-wait::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: tutwait 1.4s ease-in-out infinite; }
@keyframes tutwait { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
#tutorial .tut-actions { margin-top: 12px; gap: 6px; }
#tutorial .prog { height: 4px; background: var(--bg4); border-radius: 2px; margin: 8px 0; overflow: hidden; }
#tutorial .prog > div { height: 100%; background: var(--accent); }
/* chapter chooser: clean list */
.tut-list { border-top: 1px solid var(--line); }
.tut-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.tut-row .tr-n { flex: none; width: 22px; padding-top: 1px; font-weight: 700; color: var(--fg3); font-variant-numeric: tabular-nums; }
.tut-row .tr-text { flex: 1; min-width: 0; }
.tut-row .tr-title { font-weight: 600; }
.tut-row .tr-desc { margin-top: 2px; font-size: 12.5px; color: var(--fg2); }
.tut-row .tr-meta { margin-top: 4px; font-size: 12px; color: var(--fg3); }
.tut-row .tr-done { color: var(--ok); font-weight: 600; }
.tut-row .btn { flex: none; align-self: center; min-width: 96px; }
.tut-hl { outline: 3px solid var(--hl) !important; outline-offset: 2px; border-radius: 6px; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { outline-color: rgba(245, 165, 36, .3); } }

/* progressive disclosure: level & feature gating */
body.level-simple .lvl-medium, body.level-simple .lvl-expert, body.level-medium .lvl-expert { display: none !important; }
body.ro .needs-edit { display: none !important; }

/* responsive / tablet */
.only-narrow { display: none !important; }
/* toolbar: progressive compaction (labels stay available as tooltips; language/user/mode also in Settings) */
@media (max-width: 2250px) { #topbar .btn .lbl.hide-md, .btn .lbl.hide-md { display: none; } }
@media (max-width: 1800px) { #topbar .btn .lbl.hide-lg { display: none; } #topbar .tb-select { max-width: 124px; } }
@media (max-width: 1450px) { #topbar .tb-lang, #topbar .tb-user { display: none !important; } }
@media (max-width: 1400px) { #topbar .tb-mode { display: none !important; } }
@media (max-width: 1100px) {
  :root { --left-w: 270px; --right-w: 300px; }
}
@media (max-width: 900px) {
  #tutorial { left: 14px; top: auto; bottom: calc(var(--bb-h) + 14px); }
  .only-narrow { display: inline-flex !important; }
  #left, #right { position: absolute; top: 0; bottom: 0; z-index: 40; box-shadow: var(--shadow); width: min(340px, 88vw); }
  #left { left: 0; } #right { right: 0; }
  body:not(.left-open) #left { display: none; }
  body:not(.right-open) #right { display: none; }
  #topbar .btn .lbl { display: none; }
  #toast-root { right: 12px; }
  .drw-layout { grid-template-columns: 1fr; grid-template-rows: 180px 1fr; }
  .drw-list { border-right: 0; border-bottom: 1px solid var(--line); }
  .grid2 { grid-template-columns: 1fr; }
}
@media print {
  body * { visibility: hidden; }
}

/* dashboard hero (brand: navy block, reversed logo, Accent Blue call-to-action) */
.hero { background: var(--fc-navy); color: #FFFFFF; border-radius: 14px; padding: 22px 26px; display: flex; align-items: center; gap: 22px; flex-wrap: wrap; margin-bottom: 16px; position: relative; overflow: hidden; }
.hero img.logo { height: 124px; width: auto; display: block; }
.hero .hero-txt { flex: 1; min-width: 240px; }
.hero h1 { margin: 0 0 4px; font-size: 22px; color: #FFFFFF; }
.hero .meta { color: rgba(255, 255, 255, .72); font-size: 13px; }
.hero .chip { background: rgba(255, 255, 255, .12); color: #FFFFFF; }
.hero::after { content: ""; position: absolute; right: -60px; top: -40px; width: 260px; height: 260px; background: url("../assets/brand/flowcad3d_mark.png") no-repeat center / contain; opacity: .07; pointer-events: none; }
/* isometric drawing mode (js/3d/iso-mode.js) */
.iso-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.iso-layer svg { display: block; width: 100%; height: 100%; }
.iso-panel { position: absolute; left: 12px; top: 12px; z-index: 25; width: 262px; background: var(--overlay-bg); border: 1px solid var(--line2); border-radius: 10px; box-shadow: var(--shadow); padding: 6px 10px 10px; display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; }
.iso-panel .iso-head { display: flex; align-items: center; gap: 6px; }
.iso-panel .iso-head b { flex: 1; }
.iso-panel .iso-rot { display: flex; align-items: center; gap: 6px; }
.iso-panel .iso-q { flex: 1; text-align: center; line-height: 1.2; }
.iso-panel .iso-opts { display: flex; flex-direction: column; gap: 2px; }
.iso-panel .iso-opt { display: flex; align-items: center; gap: 8px; min-height: 30px; cursor: pointer; }
.iso-panel .iso-opt input { width: 18px; height: 18px; margin: 0; }
.iso-panel .iso-note { line-height: 1.4; }
body.iso-mode #tutorial { top: auto; bottom: calc(var(--bb-h) + 14px); }
.iso-panel .iso-det summary { cursor: pointer; min-height: 30px; display: flex; align-items: center; color: var(--fg2); font-weight: 600; }
.iso-panel .iso-det[open] .iso-note { margin-top: 6px; }
/* 3D previews in the library (js/3d/thumbs.js) */
.lr-thumb { flex: none; width: 56px; height: 44px; margin-right: 8px; object-fit: contain; border-radius: 4px; background: var(--bg3); opacity: .35; transition: opacity .15s ease; }
.lr-thumb.ready { opacity: 1; background: linear-gradient(180deg, var(--bg3), var(--bg2)); }
.lr-thumb.none { opacity: 0; }
.lr-thumb:not([src]) { visibility: visible; }
.lib-group .lg-thumb { flex: none; width: 40px; height: 32px; object-fit: contain; opacity: 0; transition: opacity .15s ease; }
.lib-group .lg-thumb.ready { opacity: 1; }
.lib-preview { position: fixed; z-index: 55; width: 272px; padding: 10px; background: var(--bg2); border: 1px solid var(--line2); border-radius: 10px; box-shadow: var(--shadow); pointer-events: none; }
.lib-preview img { display: block; width: 252px; height: 189px; object-fit: contain; border-radius: 6px; background: linear-gradient(180deg, var(--bg3), var(--bg2)); opacity: 0; transition: opacity .12s ease; }
.lib-preview img.ready { opacity: 1; }
.lib-preview .lp-name { margin-top: 8px; font-weight: 600; font-size: 13px; line-height: 1.3; }
.lib-preview .lp-data { margin-top: 2px; font-size: 12px; color: var(--fg3); font-variant-numeric: tabular-nums; }
/* line composition in the properties panel: the selected part is outlined */
.run-list { max-height: 232px; overflow: auto; margin-top: 6px; border: 1px solid var(--line); border-radius: 6px; }
.run-row { display: grid; grid-template-columns: 26px 88px 1fr auto; gap: 6px; align-items: center; min-height: 34px; padding: 4px 8px 4px 4px; border-bottom: 1px solid var(--line); font-size: 12px; cursor: pointer; outline: 2px solid transparent; outline-offset: -2px; }
.run-row:last-child { border-bottom: 0; }
.run-row:hover { background: var(--bg3); }
.run-row.sub { padding-left: 16px; }
.run-row.sel { outline-color: var(--accent); background: var(--accentbg); font-weight: 600; }
.run-row .rr-n { color: var(--fg3); text-align: right; font-variant-numeric: tabular-nums; }
.run-row .rr-t { color: var(--fg2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.run-row .rr-d { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-row .rr-x { color: var(--fg3); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- point clouds (js/ui/cloud-dialogs.js) ---------- */
.pc-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; background: var(--bg2, transparent); }
.pc-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.pc-head .t1 { font-weight: 700; }
.pc-head .t2 { color: var(--fg3); font-size: 12px; overflow-wrap: anywhere; }
.pc-card .row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.pc-progress { margin-top: 12px; }
.pc-bar { height: 8px; border-radius: 4px; background: var(--bg4); overflow: hidden; }
.pc-fill { height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.pc-plabel { margin-top: 6px; font-variant-numeric: tabular-nums; }
.pc-formats .li { padding: 6px 10px; }
