:root { --bg: #14181f; --bar: #1c222c; --panel: #192029; --line: #303a4a; --ink: #e8edf5; --dim: #9aa6b8; --acc: #4f8fe0; --ok: #3fae6a; --warn: #f2b33d; --bad: #e0584f; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 14px/1.4 system-ui, "Segoe UI", sans-serif; overflow: hidden; }
button, select, input { font: inherit; color: var(--ink); background: #273142; border: 1px solid var(--line); border-radius: 6px; padding: 4px 9px; }
button { cursor: pointer; }
button:hover { border-color: #46546a; }
button.primary { background: var(--acc); border-color: var(--acc); color: #fff; font-weight: 600; }
button:disabled { opacity: .45; cursor: default; }
button.on { background: #2c3e58; border-color: var(--acc); box-shadow: inset 0 0 0 1px var(--acc); }
input[type=checkbox] { padding: 0; }
label { color: var(--dim); display: inline-flex; gap: 6px; align-items: center; }
#bar { position: fixed; top: 0; left: 0; right: 0; height: 48px; display: flex; gap: 8px; align-items: center; padding: 0 12px; background: var(--bar); border-bottom: 1px solid var(--line); z-index: 3; white-space: nowrap; overflow-x: auto; }
#bar .brand { font-size: 16px; }
#bar .ver { color: var(--dim); font-size: 12px; margin-left: -4px; }
#bar .ver.stale { color: #1a1205; background: var(--warn); border-radius: 6px; padding: 2px 8px; font-weight: 600; cursor: pointer; }
#bar .name { width: 200px; font-weight: 600; }
#bar .sep { width: 1px; height: 22px; background: var(--line); flex: none; }
#bar .grow { flex: 1; }
#lib { position: fixed; top: 48px; left: 0; bottom: 30px; width: 300px; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 2; }
.libhead { padding: 10px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.libhead input[type=search] { width: 100%; }
.libhead .filters { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.lenrow input { width: 90px; }
#groups { overflow-y: auto; flex: 1; padding: 4px 0 12px; }
.group > summary { list-style: none; cursor: pointer; padding: 7px 12px; color: var(--dim); text-transform: uppercase; font-size: 12px; letter-spacing: .05em; display: flex; justify-content: space-between; user-select: none; }
.group > summary::-webkit-details-marker { display: none; }
.group > summary:hover { color: var(--ink); }
.group[open] > summary { color: var(--ink); }
.prow { display: grid; grid-template-columns: 52px 1fr; gap: 8px; align-items: center; padding: 5px 10px; margin: 0 6px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }
.prow:hover { background: #222b37; border-color: var(--line); }
.prow.on { background: #24344b; border-color: var(--acc); }
.prow .ico { width: 52px; height: 52px; border-radius: 6px; background: #101419; display: grid; place-items: center; overflow: hidden; }
.prow .ico img, .prow .ico svg { width: 100%; height: 100%; }
.prow .t { font-weight: 600; font-size: 13px; }
.prow .d { color: var(--dim); font-size: 12px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#view { position: fixed; top: 48px; left: 300px; right: 0; bottom: 30px; }
#view canvas { display: block; }
#view .lbl { font: 600 12px system-ui, sans-serif; color: #fff; background: rgba(34, 64, 110, .85); border: 1px solid #5c8fd6; border-radius: 10px; padding: 0 6px; pointer-events: none; }
#view .lbl.sel { background: var(--acc); }
#props { position: fixed; top: 60px; right: 12px; width: 280px; background: var(--bar); border: 1px solid var(--line); border-radius: 10px; padding: 12px; z-index: 2; box-shadow: 0 8px 30px rgba(0,0,0,.35); max-height: calc(100% - 110px); overflow: auto; }
#props h3 { margin: 0 0 2px; font-size: 16px; }
#props .d { color: var(--dim); font-size: 12px; margin-bottom: 10px; }
#props .f { display: grid; grid-template-columns: 90px 1fr; gap: 6px; align-items: center; margin: 6px 0; }
#props .f > span { color: var(--dim); font-size: 13px; }
#props .f input, #props .f select { width: 100%; }
#props .btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
#props .note { color: var(--dim); font-size: 12px; margin-top: 8px; }
.prow .fz { font-weight: 500; font-size: 11px; color: #f2c46d; margin-left: 4px; }
#props .ok { color: var(--ok); } #props .bad { color: var(--warn); }
#status { position: fixed; left: 312px; bottom: 40px; max-width: 70ch; background: rgba(20,24,31,.9); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; z-index: 2; pointer-events: none; }
#status:empty { display: none; }
#help { position: fixed; left: 0; right: 0; bottom: 0; height: 30px; padding: 6px 12px; background: var(--bar); border-top: 1px solid var(--line); color: var(--dim); font-size: 12.5px; z-index: 3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#help b { color: var(--ink); font-weight: 600; }
.dialog { position: fixed; inset: 0; background: rgba(8,10,14,.6); display: grid; place-items: center; z-index: 10; }
.dialog[hidden] { display: none; }
.dialog .card { background: var(--bar); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; width: min(560px, calc(100% - 32px)); max-height: calc(100% - 40px); display: flex; flex-direction: column; gap: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.dialog .card.wide { width: min(1180px, calc(100% - 32px)); height: min(760px, calc(100% - 40px)); }
.dhead { display: flex; justify-content: space-between; align-items: center; }
.dhead h2 { margin: 0; font-size: 18px; }
.dhead .x { background: none; border: 0; font-size: 18px; }
.bomopts { display: flex; flex-wrap: wrap; gap: 14px; }
.tabs { display: flex; gap: 6px; }
.tabs button.on { background: #2c3e58; border-color: var(--acc); }
.tablewrap { flex: 1; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #11151b; }
table.t { border-collapse: collapse; width: 100%; font-size: 12.5px; }
table.t th { position: sticky; top: 0; background: #2f5d8a; color: #fff; text-align: left; padding: 6px 8px; font-weight: 600; white-space: nowrap; }
table.t td { padding: 5px 8px; border-top: 1px solid #252d39; vertical-align: top; }
table.t tr:hover td { background: #1a212b; }
table.t td.n { text-align: right; font-variant-numeric: tabular-nums; }
.dfoot { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dfoot .out { color: var(--dim); font-size: 13px; }
.dfoot .out a { color: #8fc1ff; margin-right: 10px; }
.warn { background: #3a2f14; border: 1px solid #6b5520; color: #f6d68a; border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.empty { color: var(--dim); padding: 30px; text-align: center; }
.libtabs { display: flex; gap: 4px; padding: 8px 10px 0; }
.libtabs button { flex: 1; border-radius: 8px 8px 0 0; border-bottom: 0; }
.libtabs button.on { background: #2c3e58; border-color: var(--acc); }
#lib.treeview .libhead, #lib.treeview #groups { display: none; }
#treeWrap { flex: 1; display: flex; flex-direction: column; min-height: 0; border-top: 1px solid var(--line); }
#treeWrap[hidden] { display: none; }
.treebar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; font-size: 12px; }
.treebar .dim { color: var(--dim); }
#tree { overflow-y: auto; flex: 1; padding: 2px 4px 14px; }
.tree-row { display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: 6px; cursor: pointer; font-size: 13px; border: 1px solid transparent; }
.tree-row:hover { background: #222b37; }
.tree-row.on { background: #24344b; border-color: var(--acc); }
.tree-row.nested { padding-left: 26px; }
.tree-row.group { font-weight: 600; margin-top: 4px; }
.tree-row.dim .tree-name, .tree-row.dim .tree-sub { opacity: .45; }
.tree-row .count { margin-left: auto; color: var(--dim); font-size: 12px; font-weight: 400; }
.tree-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-sub { color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-kind { font-size: 10px; width: 12px; text-align: center; color: var(--dim); }
.tree-kind.rail { color: #9fb6d6; } .tree-kind.part { color: #c9a86b; }
.tree-badge { margin-left: auto; font-size: 11px; color: var(--dim); }
.tree-badge.link + .tree-badge, .tree-badge + .tree-badge.link { margin-left: 4px; }
.tree-caret, .tree-eye { background: none; border: 0; padding: 0 2px; color: var(--dim); line-height: 1; }
.tree-eye svg { width: 15px; height: 15px; fill: currentColor; display: block; }
.tree-eye.off { opacity: .5; }
.tree-section { margin: 10px 6px 4px; color: var(--dim); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; }
.tree-exit { margin: 4px 6px 8px; width: calc(100% - 12px); }
.tree-rename { width: 60px; padding: 0 4px; font-size: 13px; }
.tree-menu { position: fixed; z-index: 30; background: var(--bar); border: 1px solid var(--line); border-radius: 8px; padding: 4px; display: flex; flex-direction: column; min-width: 190px; box-shadow: 0 8px 30px rgba(0,0,0,.45); }
.tree-menu button { background: none; border: 0; text-align: left; padding: 6px 10px; border-radius: 6px; }
.tree-menu button:hover { background: #2c3e58; }
.tree-menu hr { border: 0; border-top: 1px solid var(--line); margin: 3px 0; width: 100%; }
.muted { color: var(--dim); padding: 10px; font-size: 13px; }
#props .links { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
#props .links h4 { margin: 0 0 4px; font-size: 13px; color: var(--dim); font-weight: 600; }
#props .link { display: grid; grid-template-columns: 1fr auto auto; gap: 4px; align-items: center; font-size: 12.5px; padding: 3px 0; }
#props .link a { color: #8fc1ff; cursor: pointer; }
#props .link button { padding: 0 6px; font-size: 12px; }
#linkKey { position: fixed; right: 12px; bottom: 40px; z-index: 2; display: flex; gap: 12px; font-size: 12px; color: var(--dim); background: rgba(20,24,31,.85); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; }
#linkKey[hidden] { display: none; }
#linkKey i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.impgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.impgrid label { display: grid; gap: 3px; font-size: 12.5px; }
.impgrid input, .impgrid select { width: 100%; }
#impList button { padding: 0 6px; margin-left: 4px; font-size: 12px; }
kbd { font: 600 11px ui-monospace, monospace; background: #2a3342; border: 1px solid #3a4558; border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; color: var(--ink); }
