:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface-1: #fcfcfb;
  --surface-2: #f2f1ed;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #e87ba4;
  --warn: #d03b3b;
  --warn-bg: #fbeaea;
  --info-bg: #eef4fc;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface-1: #1a1a19;
    --surface-2: #232322;
    --text-primary: #f0efec;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #3987e5;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #d55181;
    --warn: #e66767;
    --warn-bg: #3a1f1f;
    --info-bg: #1b2533;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface-1: #1a1a19; --surface-2: #232322;
  --text-primary: #f0efec; --text-secondary: #c3c2b7; --text-muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --border: rgba(255, 255, 255, 0.10);
  --accent: #3987e5; --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #d55181;
  --warn: #e66767; --warn-bg: #3a1f1f; --info-bg: #1b2533;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--page);
  color: var(--text-primary);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
}
button, input, select { font: inherit; color: inherit; }

.top {
  display: flex; align-items: center; gap: 10px;
  height: 52px; padding: 0 16px;
  background: var(--surface-1); border-bottom: 1px solid var(--border);
}
.brand { font-size: 18px; letter-spacing: 0.2px; }
.brand b { color: var(--accent); }
.pname { border: 1px solid transparent; background: transparent; padding: 4px 8px; border-radius: 6px; width: 220px; }
.pname:hover, .pname:focus { border-color: var(--border); background: var(--surface-2); }
.spacer { flex: 1; }
.topfield { display: flex; align-items: center; gap: 6px; color: var(--text-secondary); }

.btn {
  border: 1px solid var(--border); background: var(--surface-2); border-radius: 6px;
  padding: 5px 10px; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--axis); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--warn); }
select, input[type=text], input.num {
  border: 1px solid var(--border); background: var(--surface-1); border-radius: 6px; padding: 4px 6px;
}
input.num { width: 100%; min-width: 0; text-align: right; }
select { max-width: 100%; }

.layout { display: grid; grid-template-columns: 390px 1fr; height: calc(100vh - 52px); }
.side { border-right: 1px solid var(--border); background: var(--surface-1); display: flex; flex-direction: column; min-height: 0; }
.panel { overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.main { overflow-y: auto; padding: 16px; min-width: 0; }

.tabs { display: flex; gap: 2px; padding: 8px 8px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tabs.small { padding: 0; border: 0; }
.tab {
  border: 0; background: transparent; padding: 7px 10px; border-radius: 6px 6px 0 0; cursor: pointer;
  color: var(--text-secondary); border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--text-primary); }
.tab.on { color: var(--text-primary); border-bottom-color: var(--accent); font-weight: 600; }
.tabs.small .tab { border-radius: 6px; padding: 5px 9px; }
.tabs.small .tab.on { background: var(--surface-2); }

.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.side .card { background: var(--surface-1); }
.card h3 { margin: 0 0 8px; font-size: 13px; font-weight: 600; text-transform: none; }
.card h4 { margin: 12px 0 6px; font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.field { display: grid; grid-template-columns: 1fr 140px; align-items: center; gap: 8px; margin: 5px 0; }
.grid2 .field { grid-template-columns: 1fr; gap: 2px; margin: 0; }
.fl { color: var(--text-secondary); font-size: 13px; }
.fi { display: flex; align-items: center; gap: 4px; min-width: 0; }
.fi > input[type=text], .fi > select { width: 100%; }
.fu { color: var(--text-muted); font-size: 12px; min-width: 24px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; margin: 6px 0; }
.check { display: flex; align-items: center; gap: 6px; margin: 6px 0; color: var(--text-secondary); cursor: pointer; }
.row-btns { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.hint { color: var(--text-muted); font-size: 12px; margin: 6px 0 0; }
.note:empty { display: none; }
.live { margin: 8px 0; font-variant-numeric: tabular-nums; }
.pre { white-space: pre; font-variant-numeric: tabular-nums; }
.warn { color: var(--warn); }
details { margin-top: 6px; }
summary { cursor: pointer; color: var(--text-secondary); font-size: 12px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: 13px; }
.kv > span { color: var(--text-secondary); }
.kv-v { text-align: right; font-variant-numeric: tabular-nums; }
.dimrow { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; }
.lock { display: flex; align-items: center; gap: 4px; color: var(--text-muted); font-size: 12px; cursor: pointer; }

.voltable table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.voltable th, .voltable td { padding: 4px 4px; border-bottom: 1px solid var(--grid); text-align: right; white-space: nowrap; }
.voltable th:first-child { text-align: left; font-weight: 500; white-space: normal; }
.voltable thead th { color: var(--text-muted); font-weight: 500; }
.voltable td.b { font-weight: 600; }

.title { font-size: 18px; font-weight: 600; margin: 0 0 10px; }
.summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip { background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; display: flex; flex-direction: column; min-width: 120px; }
.chip .k { color: var(--text-muted); font-size: 11px; }
.chip b { font-size: 16px; font-variant-numeric: tabular-nums; }
.chip .s { color: var(--text-secondary); font-size: 11px; }
.chip.err { border-color: var(--warn); }

.views { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 12px; }
@media (max-width: 1350px) { .views { grid-template-columns: 1fr; } }
.chart-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.chart-head h3 { margin: 0; }
.chart-host { height: 440px; position: relative; }
.view-host { height: 400px; border-radius: 8px; background: var(--surface-2); overflow: hidden; touch-action: none; cursor: grab; }
.view-host .empty { padding: 20px; color: var(--text-muted); }
.dims3d { margin-top: 6px; font-variant-numeric: tabular-nums; color: var(--text-secondary); }

.chart { display: flex; flex-direction: column; }
.chart-svg { display: block; flex: 1; overflow: visible; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--text-secondary); min-height: 0; padding: 0 0 4px 52px; }
.lg-item { display: inline-flex; align-items: center; gap: 6px; }
.lg-item i, .chart-tip i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .grid line.minor { stroke-opacity: 0.5; }
.chart .axis { stroke: var(--axis); }
.chart .tick { fill: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .axis-label { fill: var(--text-secondary); font-size: 11px; }
.chart .series { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .ref { stroke: var(--text-muted); stroke-dasharray: 4 4; }
.chart .ref-label { fill: var(--text-muted); font-size: 11px; }
.chart .cross { stroke: var(--axis); }
.chart .dot { stroke: var(--surface-1); stroke-width: 2; }
.chart-tip {
  position: absolute; display: none; pointer-events: none; z-index: 5;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 6px 9px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12); font-size: 12px; min-width: 150px;
}
.chart-tip .tip-f { color: var(--text-muted); margin-bottom: 3px; }
.chart-tip div { display: flex; align-items: center; gap: 6px; }
.chart-tip b { margin-left: auto; padding-left: 10px; font-variant-numeric: tabular-nums; }

.warnings { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.w { display: flex; gap: 8px; align-items: flex-start; padding: 7px 10px; border-radius: 8px; font-size: 13px; }
.w.warn { background: var(--warn-bg); }
.w.info { background: var(--info-bg); }
.w .ic { font-weight: 700; width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none; font-size: 11px; color: #fff; }
.w.warn .ic { background: var(--warn); }
.w.info .ic { background: var(--accent); }

.seg { border: 1px solid var(--grid); border-radius: 8px; padding: 8px; margin: 8px 0; }
.seg-head { display: flex; align-items: center; justify-content: space-between; }
.seg-head .btn { padding: 2px 8px; font-size: 12px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:disabled { opacity: 0.45; cursor: default; }
.row-btns.end { justify-content: flex-end; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 10px; margin: 8px 0; }
.grid3 .field { grid-template-columns: 1fr; gap: 2px; margin: 0; }
.grid3 input[type=text] { width: 100%; }

.dlg {
  width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 16px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface-1); color: var(--text-primary);
}
.dlg::backdrop { background: rgba(0, 0, 0, 0.45); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; }
.dlg-head h3 { margin: 0; font-size: 16px; }
textarea.paste {
  width: 100%; min-height: 110px; margin-top: 10px; resize: vertical; font: 12px/1.4 ui-monospace, Consolas, monospace;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); padding: 8px;
}
.review { margin-top: 6px; }
table.imp { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.imp th, table.imp td { padding: 4px 6px; border-bottom: 1px solid var(--grid); text-align: left; }
table.imp thead th { color: var(--text-muted); font-weight: 500; font-size: 12px; }
table.imp td.src { color: var(--text-secondary); max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.imp td.conv { color: var(--text-secondary); font-size: 12px; }
table.imp input.num { width: 110px; }
table.imp tr.guessed td.src em { color: var(--warn); font-style: normal; }

.bookmarklet {
  display: inline-block; padding: 6px 12px; border-radius: 6px; background: var(--accent); color: #fff;
  text-decoration: none; font-weight: 600; cursor: grab;
}

.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 20;
  background: var(--text-primary); color: var(--page); padding: 8px 14px; border-radius: 8px; max-width: 80vw;
}
.toast.bad { background: var(--warn); color: #fff; }
.dropmask { display: none; }
body.dropping .dropmask {
  display: flex; position: fixed; inset: 0; z-index: 30; align-items: center; justify-content: center;
  background: rgba(42, 120, 214, 0.18); border: 3px dashed var(--accent); font-size: 20px; pointer-events: none;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .side { border-right: 0; border-bottom: 1px solid var(--border); }
  .main { padding: 16px; }
  .pname { width: 120px; }
  .top { overflow-x: auto; }
}
.hint.pre { white-space: pre-line; }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 6px 0; }
.voltable tr.miss th, .voltable tr.miss td { color: var(--text-muted); }
.voltable td .btn.small { padding: 3px 10px; }
.catbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.catbar input[type=search] { flex: 1 1 220px; min-width: 0; }
.catlist { max-height: 60vh; overflow: auto; }
.catlist .tag { font-size: 11px; color: var(--text-muted); border: 1px solid var(--border, #444); border-radius: 4px; padding: 0 4px; margin-left: 6px; font-weight: 400; }
.catlist .catlink { margin-left: 6px; text-decoration: none; font-weight: 400; }

/* room modes and placement */
.roommap { margin: 6px 0 4px; }
.roomcap { text-align: center; font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.roomsvg { display: block; width: 100%; max-height: 360px; }
.roomsvg .cell { fill: var(--accent); stroke: var(--surface-1); stroke-width: 1px; vector-effect: non-scaling-stroke; cursor: pointer; }
.roomsvg .cell:hover { stroke: var(--text-primary); }
.roomsvg .best { fill: none; stroke: var(--text-primary); stroke-width: 2px; vector-effect: non-scaling-stroke; pointer-events: none; }
.roomsvg .walls { fill: none; stroke: var(--axis); stroke-width: 2px; vector-effect: non-scaling-stroke; pointer-events: none; }
.roomsvg .sub { fill: var(--series-2); stroke: var(--surface-1); stroke-width: 2px; vector-effect: non-scaling-stroke; pointer-events: none; }
.roomsvg .seat { fill: var(--surface-1); stroke: var(--text-primary); stroke-width: 2px; vector-effect: non-scaling-stroke; pointer-events: none; }
.roomkey { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 11px; color: var(--text-secondary); margin-top: 4px; }
.roomkey .k { display: inline-block; width: 10px; height: 10px; margin-left: 8px; border-radius: 2px; }
.roomkey .k:first-child { margin-left: 0; }
.roomkey .k.sub { background: var(--series-2); }
.roomkey .k.seat { border: 2px solid var(--text-primary); border-radius: 50%; }
.roomkey .k.best { border: 2px solid var(--text-primary); }
.roomkey .k.grad { width: 28px; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 10%, transparent), var(--accent)); }
.roomchart { height: 240px; position: relative; }
.live.lines { white-space: pre-line; }
.roomsvg .nearseat { fill: none; stroke: var(--text-primary); stroke-width: 1px; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; pointer-events: none; }
.roomkey .k.nearseat { border: 1px dashed var(--text-primary); border-radius: 50%; }

/* compare designs, drivers for this box */
.lg-line { flex: none; display: inline-block; vertical-align: middle; }
.txt { width: 100%; min-width: 0; border: 1px solid var(--border); background: var(--surface-2); border-radius: 6px; padding: 4px 8px; }
.savebar { display: flex; gap: 8px; align-items: center; margin: 8px 0 12px; }
.savebar .txt { flex: 1; }
.savedlist { display: flex; flex-direction: column; gap: 10px; }
.saved { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; background: var(--surface-1); }
.saved .hint { margin: 4px 0 6px; }
.savedtop { display: flex; align-items: center; gap: 8px; }
.savedtop .txt { flex: 1; font-weight: 500; }
.saved .btnrow { margin: 0; }
.mrow { display: inline-flex; align-items: center; gap: 4px; }
.voltable td .btn.small + .btn.small { margin-left: 4px; }
.btn.small { padding: 3px 10px; font-size: 13px; }
.mname { font-weight: 600; flex: 1; min-width: 0; }
.mstats { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 12px; color: var(--text-secondary); margin: 4px 0; font-variant-numeric: tabular-nums; }
.mstats b { color: var(--text-primary); font-weight: 600; }

/* line array */
.lafield { margin: 6px 0; }
.lacanvas { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: 4px; }
.lapolar { margin: 6px 0; }
.polarsvg { display: block; width: 100%; max-width: 340px; margin: 0 auto; }
.polarsvg .pgrid { fill: none; stroke: var(--grid); stroke-width: 1; }
.polarsvg .ptick { fill: var(--text-muted); font-size: 10px; }
.polarsvg .pline { fill: none; stroke-width: 2; stroke-linejoin: round; }

/* project tabs */
.ptabs { display: flex; gap: 4px; align-items: stretch; overflow-x: auto; min-width: 0; height: 100%; padding-top: 8px; margin-left: 12px; }
.ptab { display: flex; align-items: center; gap: 6px; padding: 0 6px 0 10px; border: 1px solid var(--border); border-bottom: none; border-radius: 8px 8px 0 0;
  background: var(--surface-2); color: var(--text-secondary); cursor: pointer; max-width: 220px; white-space: nowrap; }
.ptab.on { background: var(--page); color: var(--text-primary); font-weight: 500; }
.ptab:hover { color: var(--text-primary); }
.ptab input[type=checkbox] { margin: 0; }
.ptab-sw { width: 10px; height: 3px; border-radius: 2px; flex: none; }
.ptab-name { overflow: hidden; text-overflow: ellipsis; }
.ptab-edit { width: 140px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-1); padding: 1px 4px; }
.ptab-x { border: none; background: transparent; color: var(--text-muted); font-size: 16px; line-height: 1; padding: 2px 4px; border-radius: 4px; cursor: pointer; }
.ptab-x:hover { background: var(--border); color: var(--text-primary); }
.ptab-add { padding: 2px 10px; font-size: 18px; line-height: 1.2; margin-top: 4px; }
.welcome { display: flex; justify-content: center; padding: 80px 16px; }
.welcome-card { max-width: 520px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 24px; }
.welcome-card h2 { margin: 0 0 6px; }
body.noproj .layout { display: none; }
.newdlg { width: min(560px, calc(100vw - 32px)); }
.kindlist { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 12px; }
.kindbtn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); cursor: pointer; }
.kindbtn:hover { border-color: var(--accent); }
.typelist { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow-y: auto; margin: 4px 0 12px; }
.typeopt { display: flex; gap: 8px; align-items: flex-start; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.typeopt:hover { background: var(--surface-2); }
.typeopt > span { display: flex; flex-direction: column; }
.toast-act { margin-left: 10px; }
.welcome[hidden] { display: none; }
/* new project: driver search and box-first */
.newdlg { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow-y: auto; }
.npfilter { display: flex; gap: 10px; align-items: center; }
.npfilter .field { flex: none; margin: 0; }
.npfilter .txt { flex: 1; }
.drvlist { display: flex; flex-direction: column; max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; margin: 6px 0; }
.drvrow { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; padding: 6px 10px; border: none; border-bottom: 1px solid var(--grid); background: transparent; cursor: pointer; }
.drvrow:hover { background: var(--surface-2); }
.drvrow.on { background: var(--info-bg); outline: 2px solid var(--accent); outline-offset: -2px; }
.drvname { font-weight: 500; }
.drvstats { font-size: 12px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.npbox { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.npbox > summary { font-weight: 600; cursor: pointer; }
.npchart { height: 220px; position: relative; margin: 8px 0; }
.npcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.npcard { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; background: var(--surface-1); }

/* main-area views */
.viewtabs { margin: 4px 0 10px; }
.viewpane { min-width: 0; }
.viewgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 16px; align-items: start; }
.viewgrid > .card { margin: 0; min-width: 0; }
.viewpane .roomchart { height: 340px; }
.viewpane .polarsvg { max-width: 460px; }
.viewpane .roomsvg { max-height: 520px; }
.viewpane .lacanvas { max-height: 560px; object-fit: contain; }

/* one big thing at a time */
.views.only-chart, .views.only-3d { grid-template-columns: 1fr; }
.views.only-chart .view-card, .views.only-3d .chart-card { display: none; }
.views.only-chart .chart-host { height: max(440px, calc(100vh - 360px)); }
.views.only-3d .view-host { height: max(420px, calc(100vh - 300px)); }
.viewgrid.one { grid-template-columns: 1fr; }
.subtabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.subtab { border: 1px solid var(--border); background: var(--surface-1); color: var(--text-secondary); border-radius: 999px; padding: 4px 12px; cursor: pointer; }
.subtab:hover { color: var(--text-primary); }
.subtab.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.bigcard .roomchart { height: max(380px, calc(100vh - 380px)); }
.bigcard .polarsvg { max-width: min(760px, calc(100vh - 360px)); }
.bigcard .roomsvg { max-height: calc(100vh - 360px); }
.bigcard .lacanvas { max-height: none; }
.keytitle { color: var(--text-secondary); margin-right: 4px; }
.layerchk { display: inline-flex; align-items: center; gap: 4px; }
.layerchk .k { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* Line array: the 3D box beside the design summary */
.views.only-3d.with-sum { grid-template-columns: minmax(0, 1.25fr) minmax(340px, 1fr); }
.arraysum[hidden] { display: none; }
.arraysum { overflow-y: auto; max-height: calc(100vh - 230px); }
.arraysum h4 { margin: 12px 0 4px; }
.arraysum .voltable td { text-align: left; white-space: normal; }
.arraysum .voltable th:first-child { width: 42%; color: var(--text-secondary); font-weight: 500; }

/* build sheet drawings */
.bs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 20px; margin: 8px 0; }
.bs-fig { margin: 0; min-width: 0; }
.bs-fig figcaption { font-size: 13px; margin-bottom: 6px; color: var(--text-secondary); }
.bs-fig figcaption b { color: var(--text-primary); }
.bs-art { --bs-wood: #e6d3ad; --bs-hole: var(--surface-1); --bs-ink: var(--text-primary); --bs-muted: var(--text-muted); --bs-cut: var(--warn); }
.bs-art .bs-svg { max-height: none; }
.bs-sheets .bs-art .bs-svg { max-height: none; }
.bs-holes { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; }
.bs-holes td { padding: 2px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.bs-holes .bs-n { color: var(--warn); font-weight: 700; width: 1.4em; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bs-art { --bs-wood: #5b4a31; } }
:root[data-theme="dark"] .bs-art { --bs-wood: #5b4a31; }

.bs-svg { width: 100%; height: auto; display: block; }
.bs-panel { fill: var(--bs-wood); stroke: var(--bs-ink); stroke-width: 1.2px; vector-effect: non-scaling-stroke; }
.bs-hole { fill: var(--bs-hole); stroke: var(--bs-cut); stroke-width: 1.6px; vector-effect: non-scaling-stroke; stroke-dasharray: 6 3; }
.bs-centre, .bs-dim { stroke: var(--bs-ink); stroke-width: 1px; vector-effect: non-scaling-stroke; fill: none; }
.bs-num { fill: var(--bs-cut); font-weight: 700; }
.bs-dimtext { fill: var(--bs-ink); }
.bs-edge { fill: var(--bs-muted); font-style: italic; }
.bs-sheet { fill: var(--bs-hole); stroke: var(--bs-ink); stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.bs-part { fill: var(--bs-wood); stroke: var(--bs-ink); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.bs-key { fill: var(--bs-ink); font-weight: 700; }
.bs-sz { fill: var(--bs-ink); opacity: 0.75; }

/* build sheet print preview */
.bs-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, 0.55); display: flex; flex-direction: column; padding: 16px; gap: 8px; }
.bs-bar { display: flex; align-items: center; gap: 10px; background: var(--surface-1); color: var(--text-primary); border-radius: 10px; padding: 8px 12px; flex-wrap: wrap; }
.bs-bar .hint { margin: 0; }
.bs-frame { flex: 1; width: 100%; border: 0; border-radius: 10px; background: #fff; }
.warnline { color: var(--warn); background: var(--warn-bg); border-radius: 8px; padding: 8px 10px; font-weight: 500; }
.warnline[hidden] { display: none; }
