:root {
  --primary: #0f4c81;
  --secondary: #1f6feb;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #1c2530;
  --muted: #6b7684;
  --border: #dde3ea;
  --accent: #dd7a00;
  --ok: #1a7f37;
  --err: #cf222e;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  overflow: hidden;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px; background: linear-gradient(90deg, var(--primary), #17629f);
  color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo { font-size: 26px; }
.topbar h1 { font-size: 17px; margin: 0; font-weight: 600; }
.topbar .sub { margin: 2px 0 0; font-size: 12px; opacity: .82; }
.status { font-size: 12px; background: rgba(255,255,255,.16); padding: 6px 12px; border-radius: 14px; }
.status.ok { background: rgba(26,127,55,.85); }
.status.err { background: rgba(207,34,46,.85); }

.layout { display: flex; height: calc(100vh - 62px); }
.sidebar {
  width: 196px; flex: 0 0 196px; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
  transition: width .18s ease, flex-basis .18s ease, border-color .18s ease;
}
.nav-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 10px 0 18px; }
.nav-section + .nav-section { margin-top: 4px; border-top: 1px solid var(--border); padding-top: 4px; }
.nav-children { display: flex; flex-direction: column; }
.nav-item {
  border: 0; background: none; text-align: left; padding: 10px 18px;
  font-size: 13.5px; color: var(--text); cursor: pointer; border-left: 3px solid transparent;
  white-space: nowrap; width: 100%; font-family: inherit;
}
.nav-item:hover { background: #f2f6fb; }
.nav-item.active { background: #eaf2fb; border-left-color: var(--secondary); color: var(--primary); font-weight: 600; }
.nav-item:focus-visible, .nav-group:focus-visible, .nav-toggle:focus-visible {
  outline: 2px solid var(--secondary); outline-offset: -2px;
}
/* 分组标题：点击折叠 / 展开该组菜单 */
.nav-group {
  display: flex; align-items: center; gap: 8px; width: 100%;
  border: 0; border-left: 3px solid transparent; background: none; cursor: pointer;
  padding: 9px 16px 5px 16px; font-family: inherit;
  font-size: 11px; letter-spacing: 1px; color: var(--muted);
  text-transform: uppercase; text-align: left; user-select: none;
}
.nav-group:hover { color: var(--primary); }
.nav-group-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-group-caret {
  width: 0; height: 0; flex: 0 0 auto;
  border-left: 4px solid currentColor;
  border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  transform: rotate(90deg); transform-origin: 40% 50%;
  transition: transform .16s ease; opacity: .65;
}
.nav-section.collapsed .nav-group-caret { transform: rotate(0deg); }
.nav-section.collapsed .nav-children { display: none; }
.nav-section.collapsed .nav-group { padding-bottom: 9px; }
.nav-backdrop { display: none; }
/* 整栏折叠（由顶栏汉堡按钮控制，状态挂在 body 上以便联动顶栏图标） */
body.nav-collapsed .sidebar { width: 0; flex-basis: 0; border-right-width: 0; }
.nav-toggle {
  display: inline-flex; flex-direction: column; justify-content: center; gap: 4px;
  width: 34px; height: 30px; padding: 0 8px; flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,.34); background: rgba(255,255,255,.12);
  border-radius: 6px; cursor: pointer; color: #fff;
}
.nav-toggle:hover { background: rgba(255,255,255,.22); }
.nav-toggle span { display: block; height: 2px; border-radius: 2px; background: currentColor; transition: opacity .16s ease, transform .16s ease; }
body.nav-collapsed .nav-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.nav-collapsed .nav-toggle span:nth-child(2) { opacity: 0; }
body.nav-collapsed .nav-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }

.content { flex: 1; min-height: 0; padding: 20px 24px 60px; overflow-x: hidden; overflow-y: auto; }
.content:has(#page-drawing.active) { padding-bottom: 16px; }
.page { display: none; }
.page.active { display: block; }
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 18px 20px; margin-bottom: 18px; box-shadow: 0 1px 3px rgba(16,24,40,.04);
}
.panel h2 { font-size: 15px; margin: 0 0 14px; color: var(--primary); }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
.panel-head h2 { margin: 0; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
/* 下拉/搜索框按内容自适应，避免超长零件名把整行撑满、挤占图纸高度 */
.panel-head .actions select { max-width: 300px; min-width: 150px; }
.panel-head .actions input.search { width: 170px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 4px; }
.card {
  background: linear-gradient(160deg, #fff, #f7f9fc); border: 1px solid var(--border);
  border-radius: 8px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px;
}
.card .k { font-size: 12px; color: var(--muted); }
.card .v { font-size: 21px; font-weight: 650; color: var(--primary); }

.dropzone {
  border: 2px dashed #b9c6d6; border-radius: 8px; padding: 28px; text-align: center;
  color: var(--muted); background: #fbfcfe; transition: .15s;
}
.dropzone.hover { border-color: var(--secondary); background: #eef5ff; }
.dropzone a { color: var(--secondary); }
.dropzone .hint { font-size: 12px; margin-top: 4px; }

.row { display: flex; gap: 12px; align-items: flex-end; margin-top: 14px; flex-wrap: wrap; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); }
input, select, textarea {
  font-family: inherit; font-size: 13px; padding: 7px 10px; border: 1px solid var(--border);
  border-radius: 6px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #cfe3fb; border-color: var(--secondary); }
button.primary {
  background: var(--secondary); color: #fff; border: 0; padding: 9px 18px;
  border-radius: 6px; cursor: pointer; font-size: 13.5px; font-weight: 600;
}
button.primary:hover { background: #1a5fd0; }
.btn {
  border: 1px solid var(--border); background: #fff; padding: 7px 13px; border-radius: 6px;
  cursor: pointer; font-size: 12.5px; color: var(--text); text-decoration: none;
}
.btn:hover { border-color: var(--secondary); color: var(--secondary); }

.progress { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.progress.hidden { display: none; }
.bar { flex: 1; height: 8px; background: #e9eef5; border-radius: 4px; overflow: hidden; }
.fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--secondary), #49a0f5); transition: width .3s; }

.timing { margin-top: 9px; padding: 9px 11px; background: #f4f9ff; border: 1px solid #d7e6fb; border-radius: 6px; }
.timing.hidden { display: none; }
.timing-row { display: flex; gap: 20px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.timing-row b { color: var(--primary); font-size: 14px; font-variant-numeric: tabular-nums; }
.timing-hint { margin-top: 5px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.stage-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-size: 13px; }
.stage-row .stage-name { width: 92px; flex-shrink: 0; color: var(--muted); }
.stage-row .stage-track { flex: 1; height: 10px; background: #e9eef5; border-radius: 5px; overflow: hidden; }
.stage-row .stage-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--secondary), #49a0f5); }
.stage-row .stage-val { width: 96px; flex-shrink: 0; text-align: right; font-variant-numeric: tabular-nums; }
.eta-summary { display: flex; gap: 26px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 12px;
  background: #f4f9ff; border: 1px solid #d7e6fb; border-radius: 6px; font-size: 13px; color: var(--muted); }
.eta-summary b { display: block; margin-top: 3px; font-size: 16px; color: var(--primary); font-variant-numeric: tabular-nums; }

.table { width: 100%; border-collapse: collapse; font-size: 12.8px; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.table th { background: #f7f9fc; color: var(--primary); font-weight: 600; position: sticky; top: 0; }
.table tbody tr:hover { background: #f6faff; cursor: default; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

.badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.badge {
  display: inline-block; padding: 3px 9px; border-radius: 12px; font-size: 11.5px;
  background: #eef2f7; color: #46566a; border: 1px solid #e2e8f0;
}
.badge.ok { background: #e8f7ee; color: var(--ok); border-color: #c3ecd2; }
.badge.warn { background: #fff4e5; color: var(--accent); border-color: #ffe0b3; }
.badge.err { background: #fdeaea; color: var(--err); border-color: #f8cccc; }

.tree { font-size: 13px; }
.tree .node { padding: 5px 8px; border-radius: 5px; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.tree .node:hover { background: #f2f7fd; }
.tree .node.active { background: #e6f0fb; }
.tree .node.assembly { font-weight: 600; }
.tree .children { margin-left: 18px; border-left: 1px dashed #d8e0e9; padding-left: 8px; }
.tree .tag { font-size: 11px; color: var(--muted); }

.canvas-wrap {
  position: relative; width: 100%;
  height: max(300px, calc(100vh - 280px)); min-height: 300px; overflow: hidden;
  background: #f4f7fb; border: 1px solid var(--border); border-radius: 6px;
}
.draw-meta {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; flex-wrap: wrap; margin-bottom: 12px;
}
.draw-meta .badges { margin-bottom: 0; }
/* 图纸页：画布铺满右侧剩余空间；左侧列表与画布等高、内部滚动 */
#page-drawing .panel { margin-bottom: 0; }
#page-drawing .split { position: relative; display: block; }
#page-drawing .split-main { margin-left: 316px; min-height: 0; }
#page-drawing .split-list {
  position: absolute; left: 0; top: 0; bottom: 0; width: 300px;
  display: flex; flex-direction: column; min-height: 0;
}
#page-drawing #draw-list { flex: 1 1 auto; min-height: 0; max-height: none; overflow: auto; }
#drawing-canvas { position: absolute; display: block; cursor: grab; background: #fff; }
#drawing-canvas.grabbing { cursor: grabbing; }
.canvas-tools {
  position: absolute; top: 8px; right: 8px; z-index: 5;
  display: flex; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, .92); border: 1px solid var(--border);
  border-radius: 8px; padding: 4px 6px; box-shadow: 0 2px 8px rgba(16, 24, 40, .10);
}
.zoom-btn {
  width: 26px; height: 26px; border: 1px solid var(--border); background: #fff;
  border-radius: 6px; cursor: pointer; font-size: 15px; line-height: 1;
  color: var(--primary); display: inline-flex; align-items: center; justify-content: center;
}
.zoom-btn:hover { background: #eef4ff; }
.zoom-btn.wide { width: auto; padding: 0 10px; font-size: 12px; }
.zoom-label {
  font-size: 12px; color: var(--muted); min-width: 40px; text-align: center;
  font-variant-numeric: tabular-nums;
}

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 14px; }
.form-grid .wide { grid-column: span 2; }

#rule-editor {
  width: 100%; height: 460px; font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12.5px; line-height: 1.5; white-space: pre; tab-size: 2;
}

.samples { display: flex; gap: 10px; flex-wrap: wrap; }
.sample-card {
  border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; min-width: 170px;
  background: #fbfcfe; cursor: pointer; transition: .15s;
}
.sample-card:hover { border-color: var(--secondary); box-shadow: 0 2px 8px rgba(31,111,235,.12); }
.sample-card .n { font-weight: 600; color: var(--primary); }
.sample-card .s { font-size: 11.5px; color: var(--muted); }

.muted { color: var(--muted); font-size: 12.5px; }
.toast {
  position: fixed; right: 22px; bottom: 22px; background: #24303f; color: #fff;
  padding: 11px 18px; border-radius: 8px; font-size: 13px; box-shadow: 0 6px 18px rgba(0,0,0,.2);
  z-index: 99;
}
.toast.hidden { display: none; }
.toast.err { background: var(--err); }
.toast.ok { background: var(--ok); }

/* ---------------- v2 additions ---------------- */
.hidden { display: none !important; }
input.search { width: 170px; }
label.inline { flex-direction: row; align-items: center; gap: 6px; font-size: 12.5px; }
label.inline input { width: 70px; }
.table th.op, .table td.op { text-align: right; white-space: nowrap; }
.table td.op .btn { padding: 4px 9px; font-size: 12px; margin-left: 4px; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.selected { background: #e8f1fd; }
.nowrap { white-space: nowrap; }
.mark { color: var(--accent); font-size: 11px; margin-left: 4px; }

/* 列表分页栏：恒位于列表下方，左侧为总数 / 每页条数，右侧为翻页按钮 */
.pager {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 10px; padding: 10px 2px 2px; border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--muted); flex-wrap: wrap;
}
.pager-side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pager-side.right { justify-content: flex-end; margin-left: auto; gap: 6px; }
.pager .total { margin-right: 0; white-space: nowrap; }
.pager [data-pager-static] { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.pager label.pager-size { flex-direction: row; align-items: center; gap: 6px; margin: 0; white-space: nowrap; cursor: default; }
.pager select { padding: 4px 8px; font-size: 12px; min-width: 0; height: 28px; }
.pager button {
  min-width: 30px; height: 28px; padding: 0 8px; border: 1px solid var(--border);
  background: #fff; border-radius: 5px; cursor: pointer; font-size: 12.5px; color: var(--text);
}
.pager button:hover:not(:disabled) { border-color: var(--secondary); color: var(--secondary); }
.pager button:disabled { opacity: .4; cursor: not-allowed; }
.pager button.active { background: var(--secondary); border-color: var(--secondary); color: #fff; }
/* 图纸页左栏较窄，分页栏单独收紧 */
#draw-pager { margin-top: 0; padding: 8px; gap: 6px; font-size: 11.5px; }
#draw-pager .pager-side.right { gap: 4px; }
#draw-pager button { min-width: 26px; height: 26px; padding: 0 6px; font-size: 11.5px; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin: 4px 0 12px; }
.tab {
  border: 0; background: none; padding: 8px 14px; cursor: pointer; font-size: 13px;
  color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--secondary); font-weight: 600; }

.split { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.split-list { border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.split-main { min-width: 0; }
.draw-list { max-height: calc(100vh - 360px); overflow: auto; }
.draw-item { padding: 9px 12px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 12.5px; }
.draw-item:hover { background: #f6faff; }
.draw-item.active { background: #e8f1fd; border-left: 3px solid var(--secondary); padding-left: 9px; }
.draw-item .t { font-weight: 600; color: var(--primary); }
.draw-item .s { color: var(--muted); font-size: 11.5px; }
.wrapper-tag {
  display: inline-block; margin-left: 2px; padding: 0 5px;
  border: 1px solid #e3c58a; border-radius: 3px;
  background: #fff6e3; color: #8a6116; font-size: 10.5px; line-height: 1.5;
  white-space: nowrap; vertical-align: 1px;
}
#draw-tree-mode { max-width: 210px; }

.modal {
  position: fixed; inset: 0; background: rgba(20,30,45,.42); z-index: 80;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal-box {
  background: #fff; border-radius: 10px; width: min(1080px, 100%); max-height: 86vh;
  display: flex; flex-direction: column; box-shadow: 0 18px 50px rgba(10,20,35,.28);
}
.modal-box header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.modal-box header h3 { margin: 0; font-size: 15px; color: var(--primary); }
.modal-close { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }
.modal-close:hover { color: var(--err); }
.modal-body { padding: 16px 18px 20px; overflow: auto; }
.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

.form-grid.two { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; font-size: 12.5px; margin-bottom: 14px; }
.kv .k { color: var(--muted); }
.kv .v { font-variant-numeric: tabular-nums; }
.hint-inline { font-size: 11.5px; color: var(--muted); }
pre.params { background: #f7f9fc; border: 1px solid var(--border); border-radius: 6px; padding: 10px; font-size: 12px; margin: 0; }

/* feature review workbench */
.chk { flex-direction: row; align-items: center; gap: 6px; white-space: nowrap; font-size: 12px; }
.chk input[type="checkbox"] { width: auto; margin: 0; }
.review-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 0 12px; margin-top: 4px; border-top: 1px solid var(--border);
}
.review-bar .muted { margin-right: auto; }
.review-report {
  background: #f4f8fd; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; margin-bottom: 12px; font-size: 12.5px; line-height: 1.7;
}
.suspect-row { background: #fff7f2; }
.suspect-row:hover { background: #ffefe4; }
.deleted-row { opacity: .5; }
.suspect-tag { color: var(--accent); font-size: 11px; margin-top: 3px; cursor: help; }
.review-tag {
  display: inline-block; font-size: 11px; padding: 1px 6px;
  border-radius: 4px; border: 1px solid var(--border);
}
.review-tag.ok { background: #e8f7ee; color: var(--ok); border-color: #c3ecd2; }
.review-tag.warn { background: #fff4e5; color: var(--accent); border-color: #ffe0b3; }
.review-tag.muted { color: var(--muted); }
.btn-mini {
  border: 1px solid var(--border); background: #fff; color: var(--primary);
  border-radius: 5px; padding: 2px 7px; font-size: 11.5px; cursor: pointer; margin-right: 4px;
}
.btn-mini:hover { border-color: var(--secondary); color: var(--secondary); }
.btn-mini.danger:hover { border-color: var(--err); color: var(--err); }
.feat-ops { white-space: nowrap; }
.badge.active { outline: 2px solid var(--accent); outline-offset: 1px; }

@media (max-width: 1000px) {
  .split { grid-template-columns: 1fr; }
  .split-list .draw-list { max-height: 220px; }
  .canvas-wrap { height: calc(100vh - 540px); min-height: 220px; }
  #page-drawing .split { display: block; }
  #page-drawing .split-main { margin-left: 0; }
  #page-drawing .split-list { position: static; width: auto; height: 220px; }
}

/* ---------------------------------------------------------------- 3D 预览 */
.viewer-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.viewer-toolbar .flex-sp { flex: 1; }
.viewer-wrap {
  position: relative; height: min(62vh, 620px);
  border: 1px solid var(--border); border-radius: 6px;
  overflow: hidden; background: #f4f7fb;
}
.viewer-canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.viewer-canvas:active { cursor: grabbing; }

/* ---------------------------------------------------------------- auth / RBAC */
.topbar-right { display: flex; align-items: center; gap: 14px; }
.userbox { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.user-chip {
  background: rgba(255,255,255,.16); padding: 6px 12px; border-radius: 14px;
  white-space: nowrap; max-width: 340px; overflow: hidden; text-overflow: ellipsis;
}
.top-link {
  border: 1px solid rgba(255,255,255,.4); background: transparent; color: #fff;
  border-radius: 14px; padding: 5px 11px; font-size: 12px; cursor: pointer;
}
.top-link:hover { background: rgba(255,255,255,.18); }
.scope-select {
  max-width: 200px; height: 29px; font-size: 12px; border: 1px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.14); color: #fff; border-radius: 14px; padding: 0 8px;
}
.scope-select option { color: var(--text); background: #fff; }
.hidden { display: none !important; }
.table-wrap { width: 100%; overflow-x: auto; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.7; margin: 0 0 12px; }
.btn.danger { color: var(--err); border-color: #f2c9cd; }
.btn.danger:hover { background: #fdeaea; border-color: var(--err); color: var(--err); }
.form-grid label span { color: var(--muted); font-size: 12.5px; }
.form-grid label input, .form-grid label select { width: 100%; }
.log-detail { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perm-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 0 8px; border-top: 1px solid var(--border); font-size: 13px; color: var(--primary);
}
.perm-matrix {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px; max-height: 46vh; overflow-y: auto;
}
.perm-group { border: 1px solid var(--border); border-radius: 7px; padding: 10px 12px; background: #fbfcfe; }
.perm-menu { flex-direction: row !important; align-items: center; gap: 6px; font-size: 13px; color: var(--text); }
.perm-menu .muted { font-size: 11px; margin-left: auto; }
.perm-actions { display: grid; gap: 4px; margin: 9px 0 0 20px; }
.perm-action { flex-direction: row !important; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.perm-action code { font-size: 10.5px; color: #8b97a6; }
@media (max-width: 860px) {
  .user-chip { max-width: 150px; }
  .topbar-right { gap: 8px; }
  .scope-select { display: none; }
  /* 窄屏：侧栏改为覆盖式抽屉，默认收起，点菜单项后自动关闭 */
  .sidebar {
    position: fixed; top: 62px; bottom: 0; left: 0; width: 220px; flex-basis: 220px;
    z-index: 40; box-shadow: 2px 0 14px rgba(16,24,40,.14);
    transform: translateX(0); transition: transform .2s ease;
  }
  body.nav-collapsed .sidebar {
    width: 220px; flex-basis: 220px; border-right-color: var(--border); border-right-width: 1px;
    transform: translateX(-100%); box-shadow: none;
  }
  body:not(.nav-collapsed) .nav-backdrop {
    display: block; position: fixed; inset: 62px 0 0 0;
    background: rgba(16,24,40,.26); z-index: 35;
  }
  .brand .sub { display: none; }
}
