  :root { --bg: #f6f7f9; --panel: #fff; --ink: #1d2433; --muted: #6b7385; --line: #dde1e8; --accent: #1f5fbf; --warn: #b3261e; --ok: #1e7d3c; --soft: #eef1f6; }
  * { box-sizing: border-box; }
  body { margin: 0; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
  header { display: flex; align-items: center; gap: 14px; height: 48px; padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
  header h1 { font-size: 16px; margin: 0; white-space: nowrap; }
  header h1 small { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 6px; }
  header .proj { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; padding-left: 14px; border-left: 1px solid var(--line); }
  header .proj .pname { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  header .proj .sync { color: var(--muted); font-size: 12px; white-space: nowrap; margin-left: 8px; }
  header .proj .sync.err { color: var(--warn); }
  header .proj .linkbtn { margin-left: 4px; width: 24px; height: 24px; padding: 0; display: inline-grid; place-items: center; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
  header .proj .linkbtn:hover { background: var(--soft); color: var(--ink); border-color: var(--line); }
  header .proj .linkbtn svg { width: 14px; height: 14px; }
  header .tools { display: flex; gap: 6px; align-items: center; }
  header .tools > button { font-size: 13px; padding: 4px 10px; }
  header .tools .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
  header .tools a { color: var(--accent); font-size: 13px; text-decoration: none; white-space: nowrap; }
  header .tools a.minor { color: var(--muted); }
  .banner { background: color-mix(in srgb, var(--warn) 12%, var(--panel)); color: var(--warn); padding: 4px 16px; font-size: 13px; border-bottom: 1px solid color-mix(in srgb, var(--warn) 30%, var(--panel)); }
  main { display: grid; grid-template-columns: 460px 1fr; height: calc(100vh - 48px); }
  aside { border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
  /* stepper: numbered circles joined by a line; done steps filled, the current one ringed */
  .steps { display: grid; grid-template-columns: repeat(8, 1fr); padding: 12px 8px 10px; border-bottom: 1px solid var(--line); position: relative; }
  .steps button { border: 0; background: none; padding: 0 2px; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; line-height: 1.25; position: relative; border-radius: 0; }
  .steps button::before { content: ""; position: absolute; top: 13px; left: -50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
  .steps button:first-child::before { display: none; }
  .steps button.done::before, .steps button.on::before { background: var(--muted); }
  .steps .dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 13px; background: var(--panel); border: 2px solid var(--line); color: var(--muted); position: relative; z-index: 1; }
  .steps button.done .dot { background: var(--soft); border-color: var(--muted); color: var(--ink); }
  .steps button.on .dot { border-color: var(--accent); color: var(--accent); }
  .steps button.on { color: var(--ink); font-weight: 600; }
  .steps .dot .zcsn { position: absolute; top: -7px; right: -9px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--warn); color: #fff; font-size: 11px; font-weight: 600; line-height: 16px; text-align: center; }
  .stephead { margin: 0 0 6px; }
  .stephead small { color: var(--muted); font-weight: 600; font-size: 12px; }
  .stephead h2 { font-size: 16px; margin: 2px 0 2px; }
  #stepBody { flex: 1; overflow: auto; padding: 14px 16px; min-height: 0; }
  #stepBody p.help { color: var(--muted); font-size: 12px; margin: 0 0 10px; }
  #stepBody span.help { color: var(--muted); font-size: 12px; }
  #stepBody h3 { font-size: 12px; margin: 0 0 8px; color: var(--muted); }
  /* a block of related fields */
  .box { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 10px 0; background: var(--panel); }
  .box > h3:first-child { margin-top: 0; }
  ul.warnlist { margin: 0; padding-left: 18px; font-size: 12px; max-height: 40vh; overflow: auto; }
  ul.warnlist li { margin: 4px 0; }
  .clashinfo { margin: 6px 0 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; }
  .clashinfo dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 10px; margin: 0 0 8px; }
  .clashinfo dt { color: var(--muted); }
  .clashinfo dd { margin: 0; }
  .clashinfo .pics { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .clashinfo .pics img { width: 100%; border-radius: 6px; display: block; }
  .clashinfo .pics figure { margin: 0; }
  .clashinfo .pics figcaption { color: var(--muted); font-size: 12px; margin-top: 2px; }
  ul.wgroups { margin: 0; padding-left: 18px; font-size: 12px; max-height: 60vh; overflow: auto; }
  ul.wgroups > li { margin: 0 0 10px; }
  /* a warning: what it is about, then its clauses as points */
  ul.wgroups .whead { font-weight: 600; }
  ul.wpoints { margin: 2px 0 0; padding-left: 16px; list-style: '– '; color: var(--ink); }
  ul.wpoints li { margin: 1px 0; }
  .wlocs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
  .loc { font: 12px/1.5 ui-monospace, Consolas, monospace; padding: 0 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); }
  button.loc { color: var(--accent); cursor: pointer; }
  .loc button.link { padding: 0 0 0 4px; border: 0; background: none; color: var(--muted); font-size: 11px; line-height: 1; cursor: pointer; }
  .loc button.link:hover { color: var(--accent); }
  button.loc:hover { border-color: var(--accent); }
  button.loc.all { font-family: inherit; color: var(--muted); }
  .loc.off { color: var(--muted); }
  .wlocs.places { margin: 0 0 6px; align-items: center; }
  .plgroup { display: inline-flex; gap: 2px; align-items: center; padding-right: 6px; border-right: 1px solid var(--line); margin-right: 2px; }
  .plgroup:last-child { border-right: 0; }
  .loc.sub { font-size: 11px; padding: 0 4px; border-color: transparent; background: transparent; }
  button.loc.sub:hover { border-color: var(--accent); }
  details.box summary { cursor: pointer; }
  details.box[open] summary { margin-bottom: 6px; }
  .spancard { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 8px 0; background: var(--soft); }
  .spancard .t { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font-weight: 600; }
  .fields { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
  .fields label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
  .fields label.wide { grid-column: 1 / -1; }
  .fields input, .fields select { color: var(--ink); }
  .range { display: flex; align-items: center; gap: 6px; }
  /* a block of a card that spans its width (a table, a row of axis boxes), with its caption */
  .fields > .wide { grid-column: 1 / -1; margin: 2px 0 6px; }
  .fields > .wide > .lbl { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
  .fields > .wide .chips label.chk { margin: 0 8px 0 0; font-weight: 500; }
  /* the head of one row of a list inside a card (an opening, a stair of a floor): its name and its delete button, a line over it */
  .fields > .wide.flrow { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 6px; margin: 6px 0 0; }
  .fields > .wide.flrow > .lbl { margin: 0; font-weight: 600; color: var(--ink); }
  /* a grid cell never wider than its column (a long select would push the card past the panel) */
  .fields > label { min-width: 0; }
  .fields > label select, .fields > label input:not([type="checkbox"]) { min-width: 0; max-width: 100%; }
  .fields > label .range > select, .fields > label .range > input:not([type="checkbox"]) { flex: 1 1 0; width: 0; }
  /* a list of the project with its details (grades, coatings): the same grid of columns in each table */
  table.mtab { width: 100%; table-layout: fixed; border-collapse: collapse; margin: 0 0 14px; }
  table.mtab th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 4px 6px; border-bottom: 1px solid var(--line); }
  table.mtab td { padding: 4px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
  table.mtab th:nth-child(1), table.mtab td:nth-child(1) { width: 28%; }
  table.mtab th:nth-child(2) { width: 24%; }
  table.mtab th.n, table.mtab td.n { text-align: right; width: 17%; }
  table.mtab th.c, table.mtab td.c { text-align: center; width: 11%; }
  table.mtab td.b { text-align: right; white-space: nowrap; }
  table.stab th:nth-child(1), table.stab td:nth-child(1) { width: 36%; }
  table.stab select { width: 100%; min-width: 0; }
  table.mtab input:not([type="radio"]) { width: 100%; min-width: 0; box-sizing: border-box; }
  table.mtab td.n input { text-align: right; }
  table.mtab tr.add td { border-bottom: 0; padding-top: 8px; }
  table.mtab button:disabled { opacity: 0.35; cursor: default; }
  table.sftab { width: 100%; margin-bottom: 6px; }
  table.sftab select { width: 100%; min-width: 0; }
  table.sftab td.b { white-space: nowrap; width: 1%; }
  .range select, .range input { flex: 1; min-width: 0; width: 0; }
  label.f { display: grid; grid-template-columns: minmax(120px, 44%) 1fr; align-items: center; gap: 8px; margin: 6px 0; font-size: 13px; }
  label.chk { display: flex; align-items: center; gap: 8px; margin: 8px 0 4px; font-size: 13px; font-weight: 600; cursor: pointer; }
  label.chk input { width: 16px; height: 16px; margin: 0; }
  input, select, textarea { font: inherit; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); min-width: 0; }
  input[type=number] { width: 100%; }
  table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
  table.grid th, table.grid td { border-bottom: 1px solid var(--line); padding: 4px 4px; text-align: left; }
  table.grid th { color: var(--muted); font-weight: 500; font-size: 12px; }
  table.grid input, table.grid select { width: 100%; }
  table.grid tr.secr td { border-bottom: 0; padding-bottom: 2px; }
  /* toggle chips (bays, spans, rows) */
  .chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 4px 0; }
  .chips .lbl { font-size: 12px; color: var(--muted); margin-right: 2px; }
  button.chip { font: inherit; font-size: 12px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--muted); cursor: pointer; }
  button.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
  .spansel { gap: 4px; align-items: center; margin: 2px 0 6px; }
  .spansel .muted { margin-right: 4px; font-size: 12px; }
  /* section catalogue: the web depth holds "600-400-400-450", the break points "3000, 9000"; bf/tw/tf are three digits */
  .scrollx { overflow-x: auto; }
  table.grid.secs { table-layout: fixed; min-width: 460px; }
  table.grid.secs th:nth-child(1) { width: 64px; }
  table.grid.secs th:nth-child(3) { width: 94px; }
  table.grid.secs th:nth-child(n+4):nth-child(-n+6) { width: 46px; }
  table.grid.secs th:nth-child(7) { width: 32px; }
  table.grid.secs td input { padding-left: 4px; padding-right: 4px; }
  table.grid.secs td input[type=number] { -moz-appearance: textfield; appearance: textfield; }
  table.grid.secs td input[type=number]::-webkit-inner-spin-button, table.grid.secs td input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
  table.grid.secs button.secpick { white-space: normal; overflow-wrap: anywhere; }
  table.grid td.sk { padding: 0 4px 6px; }
  table.grid svg.sk { display: block; width: 100%; max-width: 300px; height: 44px; }
  table.grid .skrow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
  table.grid .skrow svg.sk { flex: 1 1 150px; min-width: 120px; }
  table.grid .skrow .kind { display: flex; gap: 4px; align-items: center; }
  table.grid .skrow select, table.grid .skrow input { width: auto; font-size: 12px; padding: 2px 4px; }
  table.grid .skrow input[data-secrolled] { width: 80px; }
  table.grid .skrow input[data-seckg] { width: 64px; }
  table.grid td.secact { white-space: nowrap; }
  table.grid td.secact button + button { margin-left: 4px; }
  table.grid .skrow input[data-secnote] { flex: 1 1 140px; min-width: 120px; }
  table.grid button.secpick { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--accent); cursor: pointer; text-align: left; }
  table.grid button.secpick:hover { text-decoration: underline; }
  table.axes td.n { color: var(--muted); white-space: nowrap; font-weight: 600; }
  table.axes td.b { white-space: nowrap; text-align: right; }
  table.axes td.b button { padding: 0 6px; font-size: 12px; }
  table.axes tr[data-ax] { cursor: pointer; }
  table.axes tr.on td { background: color-mix(in srgb, var(--accent) 14%, transparent); }
  table.axes input.bad, .fields input.bad { border-color: var(--warn); outline: 1px solid var(--warn); }
  table.axes tfoot td { color: var(--muted); font-size: 12px; border-bottom: 0; }
  button { font: inherit; padding: 6px 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 6px; cursor: pointer; }
  button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
  button.small { padding: 2px 8px; font-size: 12px; }
  button:disabled { opacity: .5; cursor: progress; }
  .row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
  .card { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 8px 0; }
  .card .t { display: flex; align-items: center; gap: 8px; }
  .card .t small { color: var(--muted); }
  .spancard.preset { background: var(--panel); }
  .spancard.preset .t label.use { font-weight: 500; font-size: 12px; color: var(--muted); }
  .spancard.preset svg.psk { display: block; width: 100%; max-width: 320px; height: auto; margin: 2px 0 6px; }
  .pgroup { margin: 8px 0 2px; }
  .pgroup > b, .pgroup > label.chk { display: flex; font-size: 12px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
  label.chk { display: flex !important; flex-direction: row !important; align-items: center; gap: 6px; cursor: pointer; }
  .end { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 8px 0; }
  /* sticky footer of the step panel: status, then back / next */
  .stepfoot { border-top: 1px solid var(--line); padding: 8px 12px 10px; background: var(--panel); }
  #status { font-size: 12px; color: var(--muted); white-space: pre-wrap; max-height: 30vh; overflow: auto; margin-bottom: 8px; }
  #status.err { color: var(--warn); }
  #status:empty { display: none; }
  .stepnav { display: flex; gap: 8px; align-items: center; }
  .stepnav .grow, .row > .grow { flex: 1; }
  .stepnav a { font-size: 12px; color: var(--muted); }
  .stepnav button.primary { padding: 8px 14px; font-weight: 600; }
  .stepnav #prevStep { white-space: nowrap; }
  section { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
  nav { display: flex; gap: 2px; padding: 6px 10px 0; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; align-items: end; }
  nav button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 8px 12px; color: var(--muted); }
  nav button.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
  nav .live { margin-left: auto; font-size: 12px; color: var(--muted); padding: 8px; }
  .tab { display: none; flex: 1; min-height: 0; overflow: auto; padding: 12px 16px; }
  .tab.on { display: block; }
  /* the tabs with long lists: no padding above, else the rows show between the tabs and the head that stays */
  #tab-marks, #tab-kl, #tab-bolts, #tab-reports { padding-top: 0; }
  #tab-marks::before, #tab-kl::before, #tab-bolts::before, #tab-reports::before { content: ""; display: block; height: 12px; }
  #tab-3d { padding: 0; position: relative; }
  #view3d { width: 100%; height: 100%; display: block; }
  .overlay { position: absolute; background: rgba(255,255,255,.93); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font-size: 13px; color: #1d2433; }
  #pick { left: 12px; top: 12px; max-width: 34%; }
  /* legend: a compact column on the right, folding to its title */
  #legend { right: 12px; top: 12px; font-size: 12px; display: grid; grid-template-columns: auto auto; gap: 2px 12px; align-items: center; }
  #legend b { grid-column: 1 / -1; font-size: 11px; color: var(--muted); cursor: pointer; }
  #legend.closed > :not(b) { display: none; }
  #legend .it { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
  #legend .it i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
  #pick:empty { display: none; }
  #props { right: 12px; top: 50px; width: 300px; max-height: calc(100% - 70px); overflow: auto; display: none; }
  #props h4 { margin: 0 0 6px; font-size: 14px; }
  #props label.f { grid-template-columns: 95px 1fr; }
  #props .comps label { display: block; font-size: 12px; }
  /* (the names of the connections are long: the boxes in one column, under one another) */
  #props .comps label.f { display: grid; grid-template-columns: 140px 1fr; } #props .comps label.f select { width: 100%; min-width: 0; }
  #props .hint { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
  #plan svg { width: 100%; height: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
  /* the plan fitted to the tab (whole building in view, no scroll) or to its width (larger, scrolls) */
  #tab-plan.on { display: flex; flex-direction: column; position: relative; }
  #plan { position: relative; }
  #tab-plan.fit { overflow: hidden; }
  #tab-plan.fit #plan { flex: 1; min-height: 0; }
  #tab-plan.fit #plan svg { height: 100%; display: block; }
  #planFit { align-self: flex-end; flex: none; margin-bottom: 6px; font-size: 12px; padding: 4px 10px; }
  table.list { border-collapse: collapse; width: 100%; font-size: 13px; background: var(--panel); }
  table.list th, table.list td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; vertical-align: top; }
  table.list th { background: var(--soft); position: sticky; top: 0; z-index: 1; box-shadow: inset 0 1px 0 var(--line), inset 0 -1px 0 var(--line); }
  #tab-reports table.totals { width: auto; margin: 0 0 10px; }
  #tab-reports table.totals th { position: static; box-shadow: none; font-weight: 400; }
  #tab-reports table.totals td { font-weight: 600; text-align: right; white-space: nowrap; }
  td.n { text-align: right; font-variant-numeric: tabular-nums; }
  tr.sub td { color: var(--muted); }
  .sheets { display: grid; grid-template-columns: 300px 1fr; gap: 12px; height: 100%; }
  .sheets ul { list-style: none; margin: 0; padding: 0; overflow: auto; }
  .sheets li { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 6px; background: var(--panel); cursor: pointer; }
  .sheets li.on { border-color: var(--accent); }
  /* the sheet list: a head with the count, a search, groups by kind (fold), one line per sheet */
  #tab-sheets.on { display: flex; flex-direction: column; }
  #tab-sheets .sheets { flex: 1; min-height: 0; height: auto; }
  .shleft { display: flex; flex-direction: column; gap: 6px; min-height: 0; min-width: 0; }
  .shhead { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
  #shQ { width: 100%; box-sizing: border-box; }
  .sheets #sheetList { flex: 1; min-height: 0; overflow: auto; }
  #sheetList > li { margin: 0; padding: 0; border: 0; background: none; cursor: default; }
  #sheetList .shrows { list-style: none; margin: 0 0 4px; padding: 0; }
  #sheetList .shg > .shgh { display: flex; align-items: center; gap: 6px; padding: 6px 4px 4px; font-size: 11px; font-weight: 600; color: var(--muted); cursor: pointer; user-select: none; }
  #sheetList .shg > .shgh::before { content: "▾"; font-size: 11px; }
  #sheetList .shg.closed > .shgh::before { content: "▸"; }
  #sheetList .shg.closed > .shrows { display: none; }
  #sheetList .shg > .shgh small { font-weight: 500; letter-spacing: 0; text-transform: none; }
  #sheetList .shrow { display: flex; align-items: center; gap: 8px; margin: 0; padding: 4px 8px; border: 0; background: none; border-radius: 6px; cursor: pointer; font-size: 13px; }
  #sheetList .shrow:hover { background: var(--soft); }
  #sheetList .shrow.on { background: var(--soft); box-shadow: inset 2px 0 0 var(--accent); }
  #sheetList .shrow .no { flex: none; width: 58px; font-weight: 600; font-variant-numeric: tabular-nums; }
  #sheetList .shrow .mk { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #sheetList .shrow .st { flex: none; font-size: 11px; }
  #sheetList .shrow .rev { flex: none; font-size: 11px; color: var(--muted); }
  #sheetList .shrow.gone { opacity: .5; cursor: default; }
  .sheetbar .grow { flex: 1; }
  .sheetbar a.tb, .sheetbar button.tb { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); font-size: 12px; text-decoration: none; cursor: pointer; }
  .sheetbar a.tb svg, .sheetbar button.tb svg { width: 14px; height: 14px; }
  .sheetbar a.tb[aria-disabled="true"] { opacity: .4; pointer-events: none; }
  .sheetbar button.tb.on { background: var(--soft); border-color: var(--accent); color: var(--accent); }
  .mergebar { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 12px; }
  .mergebar[hidden] { display: none; }
  .mergebar label { display: inline-flex; align-items: center; gap: 6px; }
  .mergebar label[hidden] { display: none; }
  .mergebar input { width: 56px; }
  .mergebar .tb { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); font-size: 12px; text-decoration: none; cursor: pointer; }
  .mergebar .tb svg { width: 14px; height: 14px; }
  .mergebar .tb[aria-disabled="true"] { opacity: .4; pointer-events: none; }
  #sheetList .shrow .ord { min-width: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 10px; text-align: center; }
  #sheetList .shgh .shgall { margin-left: auto; padding: 0 6px; border: 1px solid var(--line); border-radius: 4px; background: none; color: var(--ink); font-size: 11px; cursor: pointer; }
  #shDlMenu a { display: block; padding: 8px 8px; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: 13px; }
  #shDlMenu a:hover { background: var(--soft); }
  #shDlMenu a small { display: block; color: var(--muted); font-size: 12px; }
  /* the sheet on the right: the DXF in the zcCAD viewer, or the PDF */
  .sheetpane { display: flex; flex-direction: column; gap: 6px; min-height: 70vh; min-width: 0; }
  .sheetbar { display: flex; align-items: center; gap: 10px; font-size: 12px; }
  .sheetbar .seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
  .sheetbar .seg button { border: 0; border-radius: 0; padding: 4px 12px; font-size: 12px; background: var(--panel); color: var(--muted); cursor: pointer; }
  .sheetpane.dxf .seg [data-sv="dxf"], .sheetpane.pdf .seg [data-sv="pdf"] { background: var(--accent); color: #fff; }
  #dxfXY { font-variant-numeric: tabular-nums; }
  #dxfView { flex: 1; min-height: 70vh; position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
  #dxfView.dark { background: #1a1d23; }
  .sheetpane.dxf #sheetView, .sheetpane.pdf #dxfView, .sheetpane.pdf #dxfXY { display: none; }
  /* fonts the zcCAD renderer draws drawing text with (Liberation, SIL OFL, with Vietnamese; fonts/NOTICE.txt) */
  @font-face { font-family: "Liberation Sans Narrow"; font-weight: 400; font-display: block; src: url("fonts/LiberationSansNarrow-Regular.woff2") format("woff2"); }
  @font-face { font-family: "Liberation Sans Narrow"; font-weight: 700; font-display: block; src: url("fonts/LiberationSansNarrow-Bold.woff2") format("woff2"); }
  @font-face { font-family: "Liberation Sans"; font-weight: 400; font-display: block; src: url("fonts/LiberationSans-Regular.woff2") format("woff2"); }
  @font-face { font-family: "Liberation Sans"; font-weight: 700; font-display: block; src: url("fonts/LiberationSans-Bold.woff2") format("woff2"); }
  @font-face { font-family: "Liberation Serif"; font-weight: 400; font-display: block; src: url("fonts/LiberationSerif-Regular.woff2") format("woff2"); }
  .sheets li small, .muted { color: var(--muted); }
  .st { font-size: 12px; padding: 1px 6px; border-radius: 8px; background: var(--soft); }
  .st.new { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--ink); } .st.up-to-date { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
  .st.parts-modified, .st.quantity-changed, .st.issued-but-modified { background: color-mix(in srgb, #d98a00 18%, transparent); color: color-mix(in srgb, #d98a00 60%, var(--ink)); } .st.deleted { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
  .stale { background: color-mix(in srgb, #d98a00 18%, transparent); color: color-mix(in srgb, #d98a00 60%, var(--ink)); padding: 6px 10px; border-radius: 6px; margin-bottom: 8px; font-size: 13px; }
  iframe { width: 100%; height: 100%; border: 1px solid var(--line); background: #fff; min-height: 70vh; }
  @media (max-width: 1100px) { header h1 small { display: none; } }
  @media (max-width: 900px) { main { grid-template-columns: 1fr; height: auto; } aside { max-height: 80vh; } section { height: 80vh; } header { height: auto; flex-wrap: wrap; padding: 8px 16px; } }
  /* groups and item cards fold; a folded card keeps its one-line summary */
  .box > h3.fold, .spancard > .t { cursor: pointer; user-select: none; }
  .box > h3.fold::before, .spancard > .t > span:first-child::before { content: "▾"; display: inline-block; width: 14px; color: var(--muted); transition: transform .15s; }
  .box.closed > h3.fold::before, .spancard.closed > .t > span:first-child::before { transform: rotate(-90deg); }
  .box.closed > :not(h3) { display: none; }
  .box.closed { padding-bottom: 4px; }
  .spancard.closed > :not(.t) { display: none; }
  .spancard.closed > .t { margin-bottom: 0; }
  .spancard > .t > span:first-child { font-weight: 600; }
  .spancard > .t .sum { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 6px; }
  h3 .count, .subtab .count { display: inline-block; min-width: 18px; padding: 0 4px; margin-left: 4px; border-radius: 8px; background: var(--soft); color: var(--ink); font-size: 11px; text-align: center; letter-spacing: 0; }
  .subtabs { display: flex; flex-wrap: wrap; gap: 2px 4px; margin: 8px 0 2px; border-bottom: 1px solid var(--line); }
  .subtab { background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 6px 10px; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; border-radius: 0; }
  .subtab:hover { color: var(--ink); }
  .subtab.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
  .subtab .count { margin-left: 4px; }
  .tabhide { display: none !important; }
  .box.tabbed > h3 { display: none; }
  .box.tabbed { margin-top: 8px; }
  .foldall { float: right; font-size: 12px; color: var(--muted); cursor: pointer; text-decoration: underline; }
  #status .fix { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
  #status .fix button { font-size: 12px; padding: 4px 8px; }
  .steps button { font-size: 11px; }
  .steps .dot { width: 24px; height: 24px; font-size: 12px; }
  .steps button::before { top: 11px; }
  .menuwrap { position: relative; display: inline-block; }
  .menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 50; background: var(--panel, #fff); border: 1px solid var(--line, #d5dbe5); border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.12); min-width: 300px; padding: 6px; }
  .menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 8px; border-radius: 6px; cursor: pointer; font: inherit; }
  .menu button:hover { background: rgba(31,95,191,.08); }
  .menu small { display: block; color: var(--muted, #6b7385); font-size: 11px; }
  .menu .mh { font-size: 11px; color: var(--muted, #6b7385); padding: 4px 8px; }
  /* dialogs (SweetAlert2), in the page's colours */
  .swal2-popup.dlg { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; padding: 18px 18px 16px; width: 420px; }
  .swal2-popup.dlg .swal2-title { color: var(--ink); font-size: 16px; font-weight: 600; text-align: left; padding: 0 4px; }
  .swal2-popup.dlg .swal2-html-container { color: var(--muted); font-size: 14px; text-align: left; margin: 10px 4px 0; padding: 0; }
  .swal2-popup.dlg .swal2-actions { justify-content: flex-end; width: 100%; margin-top: 18px; gap: 8px; }
  /* the "Mở" dialog: search, then the projects as rows */
  /* the home page: the account's projects, under the header and over the (empty) work area */
  #home { position: fixed; inset: 48px 0 0 0; z-index: 15; overflow: auto; padding: 32px 16px; background: var(--bg); }
  #home[hidden] { display: none; }
  #home .homebox { width: min(760px, 100%); margin: 0 auto; }
  #home .homehead { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
  #home .homehead h2 { flex: 1; margin: 0; font-size: 18px; font-weight: 600; color: var(--ink); }
  #home #pjQ { margin: 0 0 12px; }
  #home .pjlist { max-height: none; background: var(--panel); }
  #home .pjrow { padding: 12px 12px; }
  body.athome header .proj { visibility: hidden; }
  body.athome #undoBtn, body.athome #redoBtn, body.athome #newProj, body.athome header .tools .sep, body.athome .menuwrap:has(> #openProj) { display: none !important; }
  .pjlist { max-height: min(60vh, 520px); overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
  .pjrow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--line); cursor: pointer; color: var(--ink); }
  .pjrow:last-child { border-bottom: 0; }
  .pjrow:hover, .pjrow:focus { background: var(--soft); outline: none; }
  .pjrow.on { background: var(--soft); }
  .pjrow .pjmain { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .pjrow .pjmain b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pjrow .pjmain small, .pjrow .pjst { color: var(--muted); font-size: 12px; }
  .pjrow .pjst { flex: none; white-space: nowrap; }
  .pjrow .pjdel { flex: none; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 6px; }
  .pjrow button.pjdel:hover { color: var(--warn); background: var(--panel2); }
  .pjrow .pjdel svg { width: 15px; height: 15px; }
  .pjlist p.muted { margin: 12px; }
  /* sheet frames: the company's title block templates */
  .swal2-popup.dlg.frdlg { width: min(1100px, calc(100vw - 32px)); }
  .frdlg .pjlist { max-height: 200px; }
  .frdlg .pjrow { cursor: default; }
  .frdlg .pjrow .small, .frdlg .btnlink { flex: none; font-size: 12px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); cursor: pointer; text-decoration: none; }
  .frdlg .pjdel.sure { color: #fff; background: var(--warn); }
  .frdlg code { font-size: 12px; background: var(--soft); padding: 0 4px; border-radius: 3px; }
  .frh { margin: 14px 0 6px; font-size: 14px; color: var(--ink); }
  .frform { display: grid; grid-template-columns: 2fr 2fr 1fr 1fr; gap: 8px; font-size: 12px; }
  .frform label, .frform .frcol { display: flex; flex-direction: column; gap: 4px; }
  .frpick { display: flex; align-items: center; gap: 8px; height: 34px; }
  .frpick .small { flex: none; font-size: 12px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); cursor: pointer; }
  .frpick .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* every control of the row the same height, on one line */
  .frform input, .frform select { font: inherit; height: 34px; box-sizing: border-box; margin: 0; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); }
  .frpick .small { height: 34px; box-sizing: border-box; }
  .frbtns { display: flex; justify-content: flex-end; margin-top: 8px; }
  .frsvg { display: block; width: 100%; height: 52vh; margin-top: 10px; background: #1a1d23; border-radius: 6px; cursor: grab; touch-action: none; user-select: none; }
  .frsvg.pan { cursor: grabbing; }
  .frcad { position: relative; height: 52vh; margin-top: 10px; background: #1a1d23; border-radius: 6px; overflow: hidden; }
  .frbig .frcad { height: 70vh; }
  .swal2-popup.dlg.frdlg.frbig { width: min(1400px, calc(100vw - 32px)); }
  .frbig .frsvg { height: 70vh; }
  .frtools { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; flex-wrap: wrap; }
  .frtools .small { font-size: 12px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); cursor: pointer; }
  .frsvg .paper { fill: #1a1d23; stroke: #444; stroke-width: .3; }
  .frsvg .ln { fill: none; stroke: #3ccf4e; stroke-width: .3; vector-effect: non-scaling-stroke; }
  .frsvg .area { fill: rgba(200, 0, 200, .07); stroke: #c000c0; stroke-dasharray: 4 3; stroke-width: 1; vector-effect: non-scaling-stroke; }
  .frsvg .arealab { fill: rgba(200, 0, 200, .45); font-family: "Arial Narrow", Arial, sans-serif; }
  .frsvg text.tx { fill: #b9c2cf; font-family: "Arial Narrow", Arial, sans-serif; }
  .frsvg text.fd { fill: #f0c419; font-family: "Arial Narrow", Arial, sans-serif; }
  .frmeta { font-size: 12px; margin: 6px 0 0; }
  .frmeta .chip { display: inline-block; font-size: 12px; background: var(--soft); border-radius: 4px; padding: 0 4px; margin: 1px 0; }
  .frwarn { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 12px; } /* notes, not errors (errors: .frerr) */
  .frerr { color: var(--warn); margin: 8px 0 0; }
  .frok { color: var(--ink); margin: 8px 0 0; }
  .frrow { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0 0 8px; }
  .frrow select { flex: 1; min-width: 200px; }
  .swal2-popup.dlg button.ok, .swal2-popup.dlg button.no { margin: 0; padding: 6px 16px; border-radius: 6px; font-size: 14px; cursor: pointer; border: 1px solid var(--line); }
  .swal2-popup.dlg button.ok { background: var(--accent); border-color: var(--accent); color: #fff; }
  button.dangerbtn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); }
  /* the buttons of a step answer the mouse: a rim under it, filled while pressed and fading after */
  #stepBody .row > button, .stepnav > button { transition: background-color .5s, border-color .2s, color .5s; }
  #stepBody .row > button:hover:not(:disabled), .stepnav > button:hover:not(:disabled) { border-color: var(--accent); background-color: color-mix(in srgb, var(--accent) 14%, var(--panel)); }
  #stepBody .row > button.primary:hover:not(:disabled), .stepnav > button.primary:hover:not(:disabled) { background-color: color-mix(in srgb, var(--accent) 85%, var(--ink)); }
  #stepBody .row > button.dangerbtn:hover:not(:disabled) { border-color: var(--warn); background-color: color-mix(in srgb, var(--warn) 12%, var(--panel)); }
  #stepBody .row > button:active:not(:disabled), .stepnav > button:active:not(:disabled) { transition: none; background-color: var(--accent); color: var(--on-accent); }
  #stepBody .row > button.primary:active:not(:disabled), .stepnav > button.primary:active:not(:disabled) { background-color: color-mix(in srgb, var(--accent) 65%, var(--ink)); }
  #stepBody .row > button.dangerbtn:active:not(:disabled) { background-color: var(--warn); color: #fff; }
  button.dangerbtn:hover { background: color-mix(in srgb, var(--warn) 12%, transparent); }
  .swal2-popup.dlg button.ok.danger { background: var(--warn); border-color: var(--warn); }
  .swal2-popup.dlg button.no { background: var(--soft); color: var(--ink); }
  .swal2-popup.dlg button.alt { background: var(--panel); color: var(--accent); border-color: var(--accent); }
  .swal2-popup.dlg .samples { display: grid; gap: 8px; margin-top: 4px; }
  .swal2-popup.dlg .samples button { display: grid; grid-template-columns: 34px 1fr; gap: 2px 10px; align-items: center; width: 100%; padding: 10px 12px; text-align: left; cursor: pointer; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--muted); font: 13px/1.45 inherit; }
  .swal2-popup.dlg .samples button:hover, .swal2-popup.dlg .samples button:focus-visible { border-color: var(--accent); background: var(--soft); outline: none; }
  .swal2-popup.dlg .samples svg { grid-row: span 2; width: 26px; height: 26px; color: var(--accent); }
  .swal2-popup.dlg .copyfrom { display: grid; grid-template-columns: 34px auto 1fr; gap: 10px; align-items: center; margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; text-align: left; }
  .swal2-popup.dlg .copyfrom svg { width: 26px; height: 26px; color: var(--accent); }
  .swal2-popup.dlg .copyfrom select { min-width: 0; }
  .swal2-popup.dlg .samples b { color: var(--ink); font-weight: 600; font-size: 14px; }
  .swal2-popup.dlg.wide { width: 460px; }
  .swal2-popup.dlg.toast { width: auto; padding: 10px 16px; box-shadow: var(--shadow); }
  /* SweetAlert2 injects its own white toast background after our CSS: win with a more specific rule, take the app's theme */
  .swal2-container .swal2-popup.swal2-toast.dlg.toast { background: var(--panel); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow); }
  .swal2-container .swal2-popup.swal2-toast.dlg.toast .swal2-title { color: var(--ink); }
  .swal2-container .swal2-popup.swal2-toast.dlg.toast .swal2-html-container { color: var(--muted); }
  .swal2-container .swal2-popup.swal2-toast.dlg.toast .swal2-timer-progress-bar { background: var(--accent); opacity: .5; }
  .swal2-popup.dlg.toast .swal2-title { font-size: 14px; margin: 0; padding: 0; }
  .swal2-popup.dlg.toast .swal2-html-container { font-size: 13px; margin: 2px 0 0; }
  .swal2-container.swal2-backdrop-show { background: rgba(10, 12, 16, .45); }

  /* ===================== themes ===================== */
  :root, [data-theme="studio"] {
    --bg: #e8ecf1; --panel: #ffffff; --panel2: #f7f9fb; --rail: #f2f4f7; --ink: #182030; --muted: #64708a; --line: #dfe3ea; --soft: #eef1f6;
    --warn: #c0362c; --ok: #1e7d3c; --shadow: 0 8px 28px rgba(16, 24, 40, .14); --glass: rgba(255, 255, 255, .97);
    --vp-top: #fbfcfe; --vp-bottom: #c5cfdc; --vp-ground: #dce3ec; --vp-grid: #8792a6; --vp-edge: #0e1420; --vp-edge-op: .16; --cube-face: #f3f5f8; --cube-side: #e2e7ee;
    color-scheme: light;
  }
  [data-theme="sand"] {
    --bg: #ece7de; --panel: #fffdf9; --panel2: #f8f4ec; --rail: #f4efe6; --ink: #2a251d; --muted: #7b7262; --line: #e4dccd; --soft: #f2ece1;
    --warn: #b83b26; --ok: #3d7a2a; --shadow: 0 8px 28px rgba(60, 40, 10, .14); --glass: rgba(255, 252, 246, .97);
    --vp-top: #fdfbf6; --vp-bottom: #d6cbb7; --vp-ground: #e6ddcc; --vp-grid: #94897a; --vp-edge: #20180c; --vp-edge-op: .16; --cube-face: #faf6ef; --cube-side: #ebe3d5;
    color-scheme: light;
  }
  [data-theme="graphite"] {
    --bg: #0e1116; --panel: #161a20; --panel2: #1b2027; --rail: #12161b; --ink: #e6e9ef; --muted: #8a94a6; --line: #262c35; --soft: #20262f;
    --warn: #f26b61; --ok: #4cc27a; --shadow: 0 10px 30px rgba(0, 0, 0, .5); --glass: rgba(24, 28, 35, .97);
    --vp-top: #36404f; --vp-bottom: #111419; --vp-ground: #252c36; --vp-grid: #5e6a7b; --vp-edge: #000000; --vp-edge-op: .32; --cube-face: #2c333e; --cube-side: #232933;
    color-scheme: dark;
  }
  [data-theme="midnight"] {
    --bg: #080e1b; --panel: #0d1628; --panel2: #111d33; --rail: #0a1222; --ink: #e3eaf6; --muted: #8496b4; --line: #1b2942; --soft: #15223a;
    --warn: #f26b61; --ok: #4cc27a; --shadow: 0 10px 30px rgba(0, 0, 0, .55); --glass: rgba(13, 22, 40, .97);
    --vp-top: #1f3459; --vp-bottom: #060b16; --vp-ground: #142139; --vp-grid: #4a6086; --vp-edge: #000000; --vp-edge-op: .32; --cube-face: #1b2b48; --cube-side: #14213a;
    color-scheme: dark;
  }
  [data-accent="blue"] { --accent: #3b7ff0; --on-accent: #fff; }
  [data-accent="teal"] { --accent: #12a594; --on-accent: #fff; }
  [data-accent="violet"] { --accent: #7c5cf0; --on-accent: #fff; }
  [data-accent="amber"] { --accent: #e8930c; --on-accent: #1d1300; }
  [data-accent="rose"] { --accent: #e5484d; --on-accent: #fff; }
  [data-accent="green"] { --accent: #2f9e5b; --on-accent: #fff; }

  body { font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 13px; background: var(--bg); }
  button.primary { color: var(--on-accent); }
  input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 0; border-color: var(--accent); }
  i[data-lucide], svg.lucide { width: 16px; height: 16px; stroke-width: 1.9; flex: none; }

  /* ===================== header (app bar) ===================== */
  header { height: 48px; padding: 0 12px 0 0; gap: 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
  .brand { display: flex; align-items: center; gap: 10px; padding-left: 14px; min-width: 0; }
  .brand .logo { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 35%, transparent); }
  .brand .logo svg { width: 20px; height: 20px; }
  .brand h1 { font-size: 16px; font-weight: 600; }
  .brand h1 small { display: block; margin: 0; font-size: 11px; font-weight: 500; line-height: 1.1; }
  header .proj { border-left: 1px solid var(--line); }
  header .proj .pname { font-weight: 600; font-size: 13px; }
  header .tools { gap: 4px; }
  header .tools > button, header .tools > .menuwrap > button, header .tools a.tb { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 1px solid transparent; background: none; color: var(--ink); border-radius: 6px; font-size: 13px; text-decoration: none; }
  header .tools > button:hover:not(:disabled), header .tools > .menuwrap > button:hover, header .tools a.tb:hover { background: var(--soft); border-color: var(--line); }
  header .tools > button.icon, header .tools > .menuwrap > button.icon { width: 32px; padding: 0; justify-content: center; }
  header .tools .sep { height: 22px; margin: 0 6px; }

  /* ===================== left: step rail + panel ===================== */
  main { grid-template-columns: 176px var(--panel-w, 400px) 1fr; height: calc(100vh - 48px); }
  main.panel-off { grid-template-columns: 176px 0 1fr; }
  main.panel-off .panel { display: none; }
  .panel { position: relative; }
  #panelResize { position: absolute; top: 0; right: -4px; width: 8px; height: 100%; cursor: col-resize; z-index: 5; }
  #panelResize:hover, #panelResize.on { background: linear-gradient(90deg, transparent 3px, var(--accent) 3px, var(--accent) 5px, transparent 5px); }
  #panelToggle { margin-top: auto; align-self: center; width: 36px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--muted); cursor: pointer; }
  #panelToggle:hover { color: var(--ink); border-color: var(--accent); }
  #panelToggle svg { width: 16px; height: 16px; }
  aside { display: contents; }
  .steps { grid-column: 1; display: flex; flex-direction: column; gap: 2px; padding: 10px 6px; background: var(--rail); border-right: 1px solid var(--line); border-bottom: 0; overflow: auto; position: static; }
  .steps button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px 8px; border-radius: 8px; font-size: 11px; line-height: 1.2; text-align: center; color: var(--muted); font-weight: 500; }
  .steps button::before { display: none !important; }
  .steps button:hover { background: var(--soft); color: var(--ink); }
  .steps button.on { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--ink); font-weight: 600; }
  .steps .dot { width: 26px; height: 26px; font-size: 12px; border-width: 1.5px; background: var(--panel); }
  /* the rail: a line through the steps' numbers in the order the building is put up, a picture of what each adds, its name */
  .steps button[data-step] { display: grid; grid-template-columns: 26px 40px 1fr; column-gap: 8px; align-items: center; justify-items: start; padding: 6px 6px; font-size: 13px; line-height: 1.25; text-align: left; min-height: 46px; flex: none; }
  .steps button[data-step]::before { display: block !important; top: -3px; left: 18px; width: 2px; height: calc(50% - 8px); background: var(--line); }
  .steps button[data-step]::after { content: ""; position: absolute; bottom: -1px; left: 18px; width: 2px; height: calc(50% - 12px); background: var(--line); }
  .steps button[data-step="project"]::before, .steps button[data-step="output"]::after { display: none !important; }
  .steps button.done::before, .steps button.done::after, .steps button.on::before { background: var(--muted) !important; }
  .steps .stname { font-weight: 500; }
  .steps button.done .stname { color: var(--ink); }
  .steps button.on .stname { font-weight: 600; }
  .stgroup { flex: none; position: relative; z-index: 1; background: var(--rail); padding: 8px 6px 4px; font-size: 11px; line-height: 1.2; font-weight: 600; color: var(--muted); }
  .stgroup:first-child { padding-top: 0; }
  .stic { width: 40px; height: 30px; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
  .stic .b { stroke: currentColor; opacity: .32; }
  .stic .n { stroke: currentColor; }
  .stic .f { fill: currentColor; opacity: .14; stroke: none; }
  .steps button.on .stic .n, .steps button.on .stic .f { stroke: var(--accent); }
  .steps button.on .stic .f { fill: var(--accent); stroke: none; }
  @media (max-height: 830px) { .steps { gap: 0; padding: 6px; } .steps button[data-step] { min-height: 38px; padding: 4px 6px; } .stgroup { padding: 4px 6px 1px; } .stic { height: 26px; } }
  .steps button.on .dot { background: var(--panel); }
  .panel { grid-column: 2; display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-right: 1px solid var(--line); }
  #stepBody { padding: 14px 16px; }
  .stguide { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-left: 8px; border: 1.5px solid color-mix(in srgb, var(--accent) 70%, transparent); border-radius: 50%; background: color-mix(in srgb, var(--accent) 14%, transparent); font-size: 12px; font-weight: 600; color: var(--accent); text-decoration: none; vertical-align: 2px; }
  .stguide:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent, #fff); }
  .stephead { padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
  .stephead h2 { font-size: 16px; font-weight: 600; }
  .box { background: var(--panel2); border-radius: 8px; }
  .spancard { background: var(--panel); border-radius: 8px; }
  /* an item's card: a title bar of its own; the open card is outlined */
  .spancard:not(.preset) { padding: 0 10px 10px; margin: 12px 0; border-color: color-mix(in srgb, var(--muted) 45%, var(--line)); }
  .spancard:not(.preset).closed { padding-bottom: 0; margin: 6px 0; border-color: var(--line); }
  .spancard:not(.preset) > .t { margin: 0 -10px 10px; padding: 8px 10px; border-radius: 8px 8px 0 0; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--accent) 14%, var(--panel)); box-shadow: inset 3px 0 0 var(--accent); }
  .spancard:not(.preset).closed > .t { margin-bottom: 0; border-radius: 8px; border-bottom: 0; background: var(--soft); box-shadow: none; }
  /* an opening: the kind's picture, number and kind on one line, where and how big under them */
  .opcard > .t > span:first-child { display: grid; grid-template-columns: 14px 30px auto 1fr; column-gap: 6px; align-items: center; min-width: 0; }
  .opcard > .t > span:first-child::before { grid-area: 1 / 1 / 3 / 2; }
  .opcard > .t .opic { grid-area: 1 / 2 / 3 / 3; width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
  .opcard > .t b { grid-area: 1 / 4; font-weight: 500; }
  .opcard > .t .sum { grid-area: 2 / 3 / 3 / 5; margin-left: 0; }
  .opic.door { color: #3f87e0; } .opic.slide { color: #17a08c; } .opic.roll { color: #d98a1f; } .opic.window { color: #8f6be0; } .opic.louver { color: #c2619a; }
  .stepfoot { background: var(--panel); }

  /* ===================== right: view tabs, viewport, status bar ===================== */
  section { grid-column: 3; background: var(--bg); }
  nav#tabs { padding: 0 8px; height: 40px; gap: 0; align-items: stretch; flex-wrap: nowrap; overflow-x: auto; background: var(--panel); }
  nav#tabs button { display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; font-size: 13px; white-space: nowrap; border-bottom-width: 2px; }
  nav#tabs button:hover { color: var(--ink); background: var(--soft); }
  nav#tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
  nav#tabs button.on svg { color: var(--accent); }
  #tab-3d { background: linear-gradient(180deg, var(--vp-top), var(--vp-bottom)); overflow: hidden; }
  .statusbar { display: flex; align-items: center; gap: 14px; height: 26px; padding: 0 12px; border-top: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 12px; white-space: nowrap; }
  h3.tabh { margin: 4px 0 8px; font-size: 13px; color: var(--muted); }
  h3.tabh + table.list { margin-bottom: 8px; }
  #tab-marks .mktools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 4px 0 8px; }
  #tab-marks .mktools input { flex: 1; min-width: 160px; max-width: 280px; }
  #tab-marks tr.mkrow { cursor: pointer; }
  #tab-marks tr.mkrow:hover td { background: var(--soft); }
  #tab-marks td.mk, #tab-marks table.mkt > tbody > tr.mkrow > td, #tab-marks table.mkt th, #tab-marks table.mkt tfoot td { white-space: nowrap; }
  #tab-marks table.mkt > tbody > tr.mkrow > td:nth-child(2), #tab-marks table.mkt > tbody > tr.mkrow > td:nth-child(3) { white-space: normal; } /* (a name and a section size break when the list is narrow: no scrolling sideways) */
  svg.ic { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -2px; flex: none; }
  #tab-marks .car { display: inline-block; width: 16px; color: var(--muted); }
  #tab-marks .sel3d { float: right; margin-left: 12px; padding: 0 4px; font-size: 11px; line-height: 16px; border: 0; background: none; color: var(--muted); }
  #tab-marks .sel3d:hover { color: var(--accent); background: var(--soft); }
  #tab-marks tr.mkparts > td { background: var(--soft); padding: 6px 10px 8px 28px; }
  #tab-marks table.sub { border-collapse: collapse; font-size: 12px; }
  #tab-marks table.sub td { border: 0; padding: 1px 14px 1px 0; }
  #tab-marks tfoot td { font-weight: 600; background: var(--soft); }
  .statusbar .grow { flex: 1; }
  .statusbar #live::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 6px; vertical-align: 1px; }
  .statusbar #live.err::before { background: var(--warn); }
  .statusbar #live.busy::before { background: var(--accent); animation: pulse 1s infinite; }
  @keyframes pulse { 50% { opacity: .3; } }

  /* overlays on the viewport: glass panels */
  .overlay { background: var(--glass); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 8px 12px; }
  #pick { left: 12px; top: 12px; max-width: 46%; font-size: 12px; }
  #pick a { color: var(--accent); }
  #props { right: 12px; top: 148px; width: 310px; max-height: calc(100% - 220px); padding: 12px 14px; }
  #props .hint { color: var(--muted); }
  #props h4 { font-size: 14px; }

  /* view cube (as in zcSteel Hub / AutoCAD): click a face, an edge or a corner */
  #cubeWrap { position: absolute; right: 14px; top: 10px; width: 88px; height: 88px; user-select: none; }
  #viewcube { overflow: visible; display: block; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .18)); }
  #viewcube polygon.c { fill: var(--cube-face); stroke: var(--line); stroke-width: .6; cursor: pointer; transition: fill .08s; }
  #viewcube polygon.c.side { fill: var(--cube-side); }
  #viewcube polygon.c.on { fill: var(--accent); }
  #viewcube polygon.o { fill: none; stroke: var(--muted); stroke-opacity: .7; stroke-width: 1; stroke-linejoin: round; pointer-events: none; }
  #viewcube text { fill: var(--ink); font: 700 9px Inter, system-ui, sans-serif; pointer-events: none; }
  #cubeWrap .cubehome { position: absolute; left: -6px; top: -2px; z-index: 2; width: 26px; height: 26px; padding: 0; display: grid; place-items: center; border-radius: 6px; border: 1px solid var(--line); background: var(--glass); color: var(--ink); box-shadow: var(--shadow); }
  #cubeWrap .cubehome:hover { color: var(--accent); }
  /* the arrows round the cube's foot: a quarter turn of the model */
  #cubeWrap .spin { position: absolute; top: 75px; z-index: 2; width: 39px; height: 24px; padding: 0; border: 0; background: none; color: var(--muted); cursor: pointer; }
  #cubeWrap .spin.r { right: 0; } #cubeWrap .spin.l { left: 0; transform: scaleX(-1); }
  #cubeWrap .spin:hover { color: var(--accent); }
  #cubeWrap .spin svg { width: 39px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
  #cubeWrap .cubehome svg { width: 13px; height: 13px; }

  /* floating view toolbar, bottom centre */
  .vtools { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 12px; background: var(--glass); border: 1px solid var(--line); box-shadow: var(--shadow); }
  .vtools button { width: 34px; height: 32px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--ink); }
  .vtools button:hover { background: var(--soft); }
  .vtools button.on { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
  .vtools button.txt { width: auto; padding: 0 8px; font-size: 12px; font-weight: 600; }
  .vtools .sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }

  /* visibility panel (Revit: Visibility/Graphics): colour key + show/hide per kind */
  #legend { left: 12px; right: auto; top: auto; bottom: 14px; display: block; padding: 6px; min-width: 176px; font-size: 12px; }
  #legend b { display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px; color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer; }
  #legend b svg { width: 13px; height: 13px; }
  #legend.closed { padding-bottom: 4px; }
  #legend .vis { display: flex; align-items: center; gap: 8px; width: 100%; padding: 2px 6px; border: 0; background: none; border-radius: 6px; color: var(--ink); font-size: 12px; text-align: left; }
  #legend .vis:hover { background: var(--soft); }
  #pickTip { position: absolute; display: none; pointer-events: none; z-index: 6; padding: 4px 8px; border-radius: 6px; background: var(--glass); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink); font-size: 12px; white-space: nowrap; }
  #legend .vis i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
  #legend .vis span { flex: 1; }
  #legend .vis svg { width: 14px; height: 14px; color: var(--muted); }
  #legend .vis.off { color: var(--muted); }
  #legend .vis.off i { opacity: .3; }
  #legend .vis.none { display: none; }
  #legend .key { display: flex; align-items: center; gap: 8px; padding: 4px 6px; color: var(--muted); }
  #legend .key i { width: 10px; height: 10px; border-radius: 3px; }
  #legend hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }

  /* theme menu */
  .menu { background: var(--panel); border-color: var(--line); box-shadow: var(--shadow); color: var(--ink); }
  .menu button:hover { background: var(--soft); }
  #themeMenu { min-width: 320px; padding: 10px; }
  .themes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0 10px; }
  .themes button { display: block; padding: 6px !important; border: 1.5px solid var(--line) !important; border-radius: 8px !important; }
  .themes button.on { border-color: var(--accent) !important; box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
  .themes .pv { height: 46px; border-radius: 6px; display: grid; grid-template-columns: 26% 1fr; overflow: hidden; margin-bottom: 4px; border: 1px solid rgba(127, 127, 127, .2); }
  .themes .pv span:last-child { position: relative; }
  .themes .pv span:last-child::after { content: ""; position: absolute; left: 30%; right: 30%; bottom: 10px; height: 14px; border: 2px solid currentColor; border-bottom: 0; border-radius: 2px 2px 0 0; opacity: .55; }
  .themes b { font-size: 12px; font-weight: 600; }
  .themes small { display: inline !important; margin-left: 4px; }
  .themes .auto { grid-column: 1 / -1; text-align: center; padding: 8px !important; }
  .accents { display: flex; gap: 8px; padding: 2px 4px 4px; }
  .accents button { width: 26px !important; height: 26px; padding: 0 !important; border-radius: 50% !important; border: 2px solid var(--panel) !important; box-shadow: 0 0 0 1px var(--line); }
  .accents button.on { box-shadow: 0 0 0 2px var(--ink); }

  /* account: sign-in screen, user menu, read-only banner, project list, versions */
  #auth { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: var(--bg); }
  #auth[hidden] { display: none; }
  #auth .card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 22px 24px; }
  #auth .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
  #auth h2 { font-size: 18px; margin: 14px 0 4px; color: var(--ink); }
  #authTabs { display: flex; gap: 4px; background: var(--soft); padding: 4px; border-radius: 8px; }
  #authTabs[hidden] { display: none; }
  #authTabs button { flex: 1; border: 0; background: none; padding: 8px 8px; border-radius: 6px; color: var(--muted); font-weight: 600; cursor: pointer; }
  #authTabs button.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
  #authForm label { display: grid; gap: 4px; margin: 10px 0; font-size: 13px; color: var(--muted); }
  #authForm input { padding: 8px 10px; font-size: 14px; }
  #authForm button.primary { width: 100%; margin-top: 8px; padding: 8px; font-size: 14px; }
  #auth a { color: var(--accent); text-decoration: none; font-weight: 600; }
  #auth a:hover { text-decoration: underline; }
  #auth .alink { margin: 8px 0; font-size: 13px; text-align: right; }
  #auth .alink:last-child { text-align: center; margin-top: 14px; }
  #auth .ok { color: #16a34a; }
  #auth .err, .err { color: var(--warn); font-size: 13px; min-height: 1em; margin: 8px 0 0; }
  header .tools button.avatar { width: 32px; height: 32px; padding: 0; border-radius: 50%; background: var(--accent); color: var(--on-accent, #fff); font-weight: 600; border: 0; justify-content: center; }
  /* the language switch (web/lang.ts): the other language's short name */
  button.langsw { min-width: 32px; height: 28px; padding: 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .02em; justify-content: center; }
  #auth .brand button.langsw { margin-left: auto; }
  .menu.right { left: auto; right: 0; }
  #userMenu { min-width: 240px; }
  #userMenu .who { display: grid; gap: 2px; padding: 8px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
  #userMenu .who small { color: var(--muted); }
  #userMenu button { display: flex; align-items: center; gap: 8px; }
  #userMenu button svg { width: 15px; height: 15px; }
  #roBanner { position: fixed; top: 54px; left: 50%; transform: translateX(-50%); z-index: 20; display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 12px; border-radius: 999px; background: var(--panel); border: 1px solid var(--warn); box-shadow: var(--shadow); color: var(--ink); font-size: 13px; }
  #roBanner[hidden] { display: none; }
  /* a new build is deployed: fixed, cannot be dismissed, until the page reloads (as zcSteel Hub) */
  #updateBar { position: fixed; top: 8px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; align-items: center; gap: 12px; padding: 6px 6px 6px 16px; border-radius: 999px; background: var(--panel); border: 1px solid var(--accent); box-shadow: var(--shadow); color: var(--ink); font-size: 13px; font-weight: 600; }
  #updateBar[hidden] { display: none; }
  #updateBar button { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 999px; padding: 4px 14px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; }
  #updateBar svg { width: 14px; height: 14px; }
  #roBanner svg { width: 15px; height: 15px; color: var(--warn); }
  #roBanner button { border: 0; border-radius: 999px; padding: 4px 12px; background: var(--warn); color: #fff; font-weight: 600; cursor: pointer; }
  body.readonly #stepBody { opacity: .72; }
  #openMenu { min-width: 360px; }
  #openMenu .plist { max-height: 60vh; overflow: auto; }
  #openMenu .prow { display: flex; align-items: stretch; }
  #openMenu .prow > button:first-child { flex: 1; }
  #openMenu .prow.on > button:first-child { background: var(--soft); }
  #openMenu .prow .del { flex: none; width: 30px; color: var(--muted); }
  #openMenu .prow .del:hover { color: var(--warn); }
  .swal2-popup.dlg .vlist { display: grid; gap: 6px; max-height: 50vh; overflow: auto; text-align: left; }
  .swal2-popup.dlg .vrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); font-size: 13px; }
  .swal2-popup.dlg .vrow small { color: var(--muted); }
  .swal2-popup.dlg .vrow button, .swal2-popup.dlg .range button { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 6px; padding: 4px 10px; cursor: pointer; font-size: 13px; }
  .swal2-popup.dlg .vrow button:hover { border-color: var(--accent); color: var(--accent); }
  .swal2-popup.dlg .range { display: flex; gap: 6px; align-items: center; }
  .swal2-popup.dlg.zcsdlg { width: min(520px, calc(100vw - 32px)); }
  /* zcSteel Hub in step 12: a line each, what it is, its value, its button */
  dl.zcsdl { display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content; gap: 8px 14px; align-items: center; margin: 0 0 12px; font-size: 13px; }
  dl.zcsdl dt { color: var(--muted); } dl.zcsdl dd { margin: 0; overflow-wrap: anywhere; } dl.zcsdl .act { display: flex; gap: 6px; }
  dl.zcsdl .chip { font-weight: 600; } dl.zcsdl .chip.bad { color: var(--warn); }
  #zcsBox h3 { margin: 14px 0 10px; padding-top: 12px; border-top: 1px solid var(--line); }
  #zcsBox #zcsState dl { margin-bottom: 4px; } #zcsBox .row { align-items: center; }
  .zcspick { display: grid; gap: 6px; text-align: left; }
  .zcspick .lab { font-size: 12px; color: var(--muted); margin-top: 8px; }
  .zcspick .lab:first-child { margin-top: 0; }
  .zcsprojs { display: grid; gap: 6px; max-height: 180px; overflow: auto; }
  .zcsp { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); font-family: inherit; font-size: 13px; line-height: 1.4; text-align: left; cursor: pointer; }
  .zcsp b { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .zcsp small { flex: none; color: var(--muted); font: 12px ui-monospace, monospace; border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
  .zcsp:hover { border-color: var(--accent); }
  .zcsp.on { border-color: var(--accent); background: var(--soft); }
  .zcstree { border: 1px solid var(--line); border-radius: 8px; padding: 4px; height: min(300px, 40vh); overflow: auto; }
  .zcsf { display: flex; align-items: center; gap: 6px; width: 100%; padding: 4px 8px; border: 0; border-radius: 6px; background: none; color: var(--ink); font-family: inherit; font-size: 13px; line-height: 1.4; text-align: left; cursor: pointer; }
  .zcsf:hover { background: var(--soft); }
  .zcsf.on { background: color-mix(in srgb, var(--accent) 22%, transparent); }
  .zcsf .tw { flex: none; width: 14px; color: var(--muted); font-size: 13px; text-align: center; }
  .zcsf svg { flex: none; color: var(--muted); }
  .zcsf.on svg { color: var(--accent); }
  .zcsf .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .zcsf small { flex: none; font-size: 11px; color: var(--accent); }
  .zcsempty { padding: 10px; color: var(--muted); font-size: 13px; }
  .swal2-popup.dlg select { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 6px; padding: 4px 6px; }
  .vk { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); }
  .vk.manual { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
  .vk.issue { background: color-mix(in srgb, #2f9e5b 18%, transparent); color: #2f9e5b; }
  .vk.restore { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
  .dinput { display: block; width: 100%; box-sizing: border-box; margin: 6px 0 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); font: inherit; }

  /* a narrow window: the rail without the pictures */
  @media (max-width: 1200px) {
    main { grid-template-columns: 124px var(--panel-w, 400px) 1fr; } main.panel-off { grid-template-columns: 124px 0 1fr; }
    .steps button[data-step] { grid-template-columns: 22px 1fr; padding: 4px 4px; font-size: 12px; } .stic { display: none; }
    .steps .dot { width: 22px; height: 22px; font-size: 11px; } .steps button[data-step]::before, .steps button[data-step]::after { left: 14px; }
  }
  @media (max-width: 1100px) { main { grid-template-columns: 124px 360px 1fr; } .brand h1 small { display: none; } header .tools .lbl { display: none; } }
  @media (max-width: 900px) {
    main { display: flex; flex-direction: column; height: auto; }
    .steps { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
    .steps button { min-width: 64px; } .stgroup { display: none; }
    .panel { max-height: 80vh; border-right: 0; }
    section { height: 80vh; }
  }

  /* ===================== phone: view only ===================== */
  /* no steps, no editing, no lock: the project's information, the 3D and the result tabs; landscape turns the 3D full screen */
  html:not(.mobile) .monly { display: none !important; }
  /* the 3D view in a window of its own */
  html.view3d header, html.view3d aside, html.view3d nav#tabs, html.view3d .statusbar, html.view3d #roBanner, html.view3d #props, html.view3d #vPop { display: none !important; }
  html.view3d main { display: block !important; height: 100vh; } html.view3d section { height: 100vh; }
  html.mobile #vPop { display: none; }
  html.mobile body { overflow: hidden; }
  html.mobile header { height: 48px; flex-wrap: nowrap; padding: 0 6px 0 0; gap: 6px; }
  html.mobile .brand { padding-left: 10px; }
  html.mobile .brand h1, html.mobile #syncState, html.mobile #versionsBtn, html.mobile #copyLink,
  html.mobile #undoBtn, html.mobile #redoBtn, html.mobile #newProj, html.mobile #saveProj, html.mobile header .tools .sep, html.mobile header .tools .lbl,
  html.mobile .steps, html.mobile .panel, html.mobile #roBanner, html.mobile #props, html.mobile #vFull { display: none !important; }
  html.mobile header .proj { padding-left: 10px; }
  html.mobile header .tools > button, html.mobile header .tools > .menuwrap > button, html.mobile header .tools a.tb { width: 34px; padding: 0; justify-content: center; }
  html.mobile #openMenu, html.mobile #themeMenu, html.mobile #userMenu { position: fixed; left: 8px; right: 8px; top: 52px; min-width: 0; }
  html.mobile main { display: flex; flex-direction: column; height: calc(100dvh - 48px); }
  html.mobile section { flex: 1; height: auto; min-height: 0; }
  html.mobile nav#tabs { padding: 0 4px; scrollbar-width: none; }
  html.mobile nav#tabs button { padding: 0 12px; }
  html.mobile .tab { padding: 10px 12px; }
  html.mobile :is(#tab-marks, #tab-kl, #tab-bolts, #tab-reports) { padding-top: 0; }
  html.mobile #tab-3d { padding: 0; }
  html.mobile table.list { display: block; overflow-x: auto; white-space: nowrap; }
  html.mobile .sheets { grid-template-columns: 1fr; height: auto; }
  /* phone: the sheet list a short scrolling box above the sheet, the sheet most of the screen */
  html.mobile .sheets .shleft { min-height: auto; }
  html.mobile .sheets #sheetList { flex: none; height: 30dvh; min-height: 140px; border: 1px solid var(--line); border-radius: 6px; padding: 2px; }
  html.mobile #dxfView, html.mobile #sheetView { min-height: 0; height: 60dvh; flex: none; }
  html.mobile #pick { max-width: calc(100% - 130px); font-size: 12px; }
  html.mobile #cubeWrap { transform: scale(.78); transform-origin: top right; }
  html.mobile .vtools { bottom: 10px; }
  html.mobile .vtools button { width: 38px; height: 36px; }
  html.mobile .vtools button.txt { width: auto; padding: 0 4px; font-size: 11px; } html.mobile .vtools button:not(.txt) { width: 34px; }
  html.mobile #legend { bottom: 62px; left: 8px; }
  html.mobile #tab-info { columns: 2 330px; column-gap: 10px; }
  /* step 12: the last run's figures, a number over what it counts */
  #runInfo .runhead { font-size: 12px; color: var(--muted); margin: 12px 0 6px; }
  #runInfo .runkpis { display: grid; grid-template-columns: repeat(4, auto); justify-content: start; gap: 0; }
  #runInfo .rk { padding: 0 16px; border-left: 1px solid var(--line); min-width: 0; }
  #runInfo .rk:first-child { padding-left: 0; border-left: 0; }
  #runInfo .rk b { display: block; font-size: 16px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
  #runInfo .rk small { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #runInfo .rk.warn b { color: var(--warn); }
  #runChecks > p { margin: 8px 0 0; }
  .kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; break-inside: avoid; }
  .kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; min-width: 0; }
  .kpi b { display: block; font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
  .kpi small { color: var(--muted); font-size: 12px; }
  .icard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px 12px; margin-bottom: 10px; break-inside: avoid; }
  .icard h3 { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; color: var(--muted); font-size: 11px; font-weight: 600; }
  .icard h3 svg { width: 14px; height: 14px; }
  .icard dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
  .icard dt { color: var(--muted); }
  .icard dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
  .icard p { margin: 8px 0 0; }
  .icard .ilinks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
  .icard .ilinks a, .icard .ilinks button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); color: var(--ink); font: inherit; font-size: 13px; text-decoration: none; cursor: pointer; }
  @media (orientation: landscape) {
    html.mobile body.on3d header, html.mobile body.on3d nav#tabs, html.mobile body.on3d .statusbar { display: none; }
    html.mobile body.on3d main { height: 100dvh; }
  }
  /* step 8: the assignment table and the preset library (web/presets/step.ts) */
  .asgwrap { overflow-x: auto; margin: 4px 0 12px; }
  table.asg { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12px; }
  table.asg col.lab { width: 34%; }
  table.asg th { text-align: left; font-weight: 600; color: var(--muted); padding: 4px 6px; border-bottom: 1px solid var(--line); }
  /* the parts of the tables (Kèo, Cột khung; Cột, Kèo, Giằng): a band with a name that is read first */
  table.asg thead th { background: color-mix(in srgb, var(--accent) 11%, transparent); color: var(--ink); font-size: 12px; border-bottom: 0; }
  table.asg thead tr:last-child th { border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); }
  table.asg thead tr:first-child th:first-child { font-size: 16px; font-weight: 600; padding: 8px 10px; color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); vertical-align: middle; border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); }
  .asgwrap + .asgwrap { margin-top: 20px; }
  table.asg td { padding: 4px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
  table.asg tbody td:first-child { padding-left: 14px; }
  table.asg td:first-child { overflow-wrap: anywhere; }
  table.asg select { width: 100%; min-width: 0; font-size: 12px; padding-left: 4px; padding-right: 2px; }
  table.asg label.chk { display: flex; gap: 4px; align-items: flex-start; overflow-wrap: anywhere; }
  /* the preset library: one row a preset, by family */
  table.plt { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12px; }
  table.plt col.k { width: 30%; }
  table.plt col.n { width: 36%; }
  table.plt tr.fam th { text-align: left; padding: 8px 10px; font-size: 16px; font-weight: 600; color: var(--accent); background: color-mix(in srgb, var(--accent) 11%, transparent); box-shadow: inset 4px 0 0 var(--accent); border-top: 14px solid transparent; background-clip: padding-box; border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); }
  table.plt tbody:first-child tr.fam th, table.plt colgroup + tbody tr.fam th { border-top: 0; }
  table.plt td { padding: 4px 6px; vertical-align: top; text-align: left; overflow-wrap: anywhere; }
  table.plt tr.first td { border-top: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }
  table.plt tr.fam + tr.first td { border-top: 0; }
  table.plt td.k { color: var(--muted); overflow-wrap: normal; }
  table.plt td.n { font-weight: 600; cursor: pointer; color: var(--ink); }
  table.plt td.u { color: var(--muted); cursor: pointer; font-size: 12px; }
  table.plt td.unused { color: var(--muted); font-weight: 400; }
  table.plt tr:hover td[data-plib] { background: color-mix(in srgb, var(--accent) 10%, transparent); }
  table.plt tr:hover td.n { color: var(--accent); }
  table.plt td.n.on { color: var(--accent); }
  table.plt td.n:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
  /* a preset's numbers: a dialog over the page */
  .pdlg-back { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.45); }
  .pdlg { display: flex; flex-direction: column; width: min(600px, 100%); max-height: calc(100vh - 32px); background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.35); }
  .pdlg-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 14px 10px; border-bottom: 1px solid var(--line); }
  .pdlg-h b { font-size: 16px; }
  .pdlg-h .muted { font-size: 12px; }
  .pdlg-x { border: 0; background: none; color: var(--muted); font-size: 22px; line-height: 1; padding: 0 4px; cursor: pointer; }
  .pdlg-x:hover { color: var(--ink); }
  .pdlg-b { overflow: auto; padding: 12px 14px; }
  .pdlg-f { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--line); }
  .pdlg-f .grow { flex: 1; }
  /* the 3D view's right-click menu and what is on (web/focus.ts) */
  #ctxMenu { right: auto; min-width: 270px; z-index: 30; }
  #ctxMenu button { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--ink); }
  #ctxMenu button[disabled] { opacity: .45; cursor: default; background: none; }
  #ctxMenu kbd { font: 11px/1 inherit; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 2px 4px; }
  #focusChip { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 12px; border-radius: 8px; background: var(--glass, var(--panel)); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink); font-size: 12px; white-space: nowrap; }
  #focusChip[hidden] { display: none; }
  #focusChip button { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 6px; padding: 4px 8px; font: inherit; cursor: pointer; }
  #ctxMenu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }
  /* Phase: the list of the Hiển thị panel, Phase Manager, "Chọn theo…", the box selection, a list's filter (web/phases.ts) */
  #phaseList hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }
  #phaseList .phhead { display: flex; align-items: center; gap: 4px; padding: 2px 6px 4px; color: var(--muted); font-size: 11px; font-weight: 600; }
  #phaseList .phhead span { flex: 1; }
  #phaseList .phhead button { font-size: 11px; padding: 1px 6px; text-transform: none; letter-spacing: 0; font-weight: 500; }
  #phaseList .phhead button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
  #phaseList .phrow { display: flex; align-items: center; }
  #phaseList .phrow .vis small { color: var(--muted); }
  #phaseList .phsel { border: 0; background: none; color: var(--muted); padding: 2px 4px; border-radius: 6px; cursor: pointer; display: flex; }
  #phaseList .phsel:hover { background: var(--soft); color: var(--ink); }
  #phaseList .phsel svg { width: 14px; height: 14px; }
  .phdlg table.phm td { vertical-align: middle; }
  .phdlg .subtabs { margin: 0 0 10px; }
  .phdlg .phgroups { max-height: 60vh; overflow: auto; } .phdlg .phgroups td:first-child { white-space: normal; width: auto; text-align: left; } .phdlg .phgroups td { text-align: left; padding: 4px 8px; } .phdlg .phgroups td.n { text-align: right; }
  .phdlg .phgroups td.pgsel { white-space: nowrap; } .phdlg .phgroups td.pgsel select { width: 210px; margin: 0; padding-top: 4px; padding-bottom: 4px; }
  .phdlg .phgroups .pgname { border: 0; background: none; padding: 2px 0; font: inherit; color: var(--ink); text-align: left; cursor: pointer; } .phdlg .phgroups .pgname:hover { color: var(--accent); text-decoration: underline; }
  .phdlg .phgroups th { position: static; text-align: left; } .phdlg .phgroups th:nth-child(2) { text-align: right; }
  .phdlg table.phm td:first-child { white-space: nowrap; width: 46px; }
  .phdlg table.phm td.n { text-align: right; width: 70px; }
  .phdlg .phsw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
  .phdlg .phact { white-space: nowrap; text-align: right; }
  .phdlg .phact button { margin-left: 4px; }
  .phdlg .row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
  .selby { display: grid; gap: 8px; text-align: left; font-size: 13px; }
  .selby .f { display: grid; grid-template-columns: 118px 1fr; gap: 8px; align-items: center; }
  .selby .chips { display: flex; flex-wrap: wrap; gap: 4px 12px; }
  .selby select, .selby input:not([type=checkbox]) { padding: 4px 6px; }
  #selBox { position: absolute; display: none; pointer-events: none; z-index: 5; border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
  #selBox.touch { border-style: dashed; }
  select.phfilter { padding: 4px 6px; }
  .phbar { margin: 0 0 8px; display: flex; align-items: center; gap: 10px; }
  .phbar .grow { flex: 1; } .phbar a { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
  #shPhase { width: 100%; margin-bottom: 6px; }
  /* the long lists: the line of the Phase filter (and the search) stays above the table's head, the totals stay below */
  #tab-kl .phbar, #tab-bolts .phbar, #tab-marks .mktools { position: sticky; top: 0; z-index: 2; background: var(--bg); margin: 0; height: 44px; box-sizing: border-box; padding: 2px 0 8px; flex-wrap: nowrap; }
  #tab-kl table.list th, #tab-bolts table.list th, #tab-marks table.mkt th { top: 43px; }
  /* on a phone a wide list scrolls sideways inside itself, and a head cannot stick in a box that does not scroll down:
     in these three tabs the tab scrolls both ways, the head sticks under the line, the line stays at the left */
  html.mobile :is(#tab-kl, #tab-bolts, #tab-marks) table.list { display: table; overflow: visible; }
  html.mobile :is(#tab-kl, #tab-bolts) .phbar, html.mobile #tab-marks .mktools { left: 0; width: calc(100vw - 24px); }
  #tab-marks table.mkt tfoot td { position: sticky; bottom: -12px; z-index: 1; box-shadow: inset 0 1px 0 var(--line); }
