:root {
    --navy: #163045;
    --navy-dark: #122833;
    --steel: #467498;
    --steel-light: #95b2c7;
    --accent: #849f5a;
    --page: #f3f6f8;
    --card: #ffffff;
    --muted: #58595b;
    --line: #d5dee6;
    --band: #e4edf3;
    --radius: 2px;
    --row-h: 22px;
    --field-h: 22px;
    --font: 12px;
    --font-sm: 11px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    background: var(--page);
    color: var(--navy);
    font-family: "Segoe UI", system-ui, sans-serif;
    font-size: var(--font);
    line-height: 1.25;
}

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: #fff;
    color: var(--navy);
    padding: 2px 8px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
    border-bottom: 0;
    box-shadow: 0 2px 0 var(--accent), 0 3px 0 var(--line);
    min-height: 40px;
    height: 40px;
}
.topbar-left {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 8px;
    min-width: 0;
}

.module {
    color: var(--accent);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.brand-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    line-height: 0;
}
.brand:focus { outline: none; }
.brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.brand img {
    height: 36px;
    width: auto;
    display: block;
}
.dot { color: #7a909a; font-size: 14px; }

.project-name {
    width: 148px;
    height: var(--field-h);
    padding: 1px 6px;
    border: 1px solid var(--steel-light);
    border-radius: var(--radius);
    background: #fff;
    color: var(--navy);
    font-size: var(--font-sm);
}

.blurb { display: none; }

.tabs, .tabs-lite {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin: 0;
    align-items: center;
}

.tab {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 8px;
    border-radius: var(--radius);
    background: var(--band);
    color: var(--navy);
    text-decoration: none;
    font-weight: 600;
    border: 0;
    cursor: pointer;
    font-size: var(--font-sm);
    line-height: 1;
    white-space: nowrap;
}

.tab-active, a.tab-active {
    background: var(--navy);
    color: #fff;
}

.tab-drop {
    position: relative;
}
.tab-drop > .tab {
    border: 0;
    cursor: pointer;
    font: inherit;
}
.tab-drop.open > .tab,
.tab-drop.flyout-open > .tab,
.tab-drop > .tab.tab-active {
    background: var(--navy);
    color: #fff;
}
.tab-flyout {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 90;
    min-width: 280px;
    padding: 8px;
    margin: 0;
    background: #fff;
    border: 1px solid var(--line, #c5d0da);
    border-radius: var(--radius);
    box-shadow: 0 8px 22px rgba(22, 48, 69, 0.16);
    gap: 12px;
}
.tab-flyout.tab-flyout-list {
    min-width: 160px;
    flex-direction: column;
    gap: 2px;
    padding: 6px;
}
.tab-drop.flyout-open .tab-flyout {
    display: flex;
}
.tab-flyout-scrim {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: transparent;
}
.tab-fly-col {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 88px;
}
.tab-fly-col strong {
    font-size: 10px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 2px;
}
.tab-fly-item {
    display: block;
    padding: 3px 6px;
    border-radius: var(--radius);
    color: var(--navy);
    text-decoration: none;
    font-weight: 600;
    font-size: var(--font-sm);
}
.tab-fly-item:hover {
    background: #eef3f8;
}
.tab-fly-item.active {
    background: var(--navy);
    color: #fff;
}

.actions { display: flex; gap: 4px; flex-wrap: nowrap; align-items: center; }
.save-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    min-width: 64px;
}
.save-stack .save-pill {
    font-size: 9px;
    line-height: 1.15;
    padding: 0;
    background: transparent;
    color: var(--muted);
}
.topbar .btn:not(.accent) {
    background: transparent;
    color: var(--navy);
    border: 1px solid var(--steel);
}

.btn {
    background: var(--navy);
    color: #fff;
    border: 0;
    border-radius: var(--radius);
    height: 24px;
    padding: 0 8px;
    font-weight: 600;
    font-size: var(--font-sm);
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.btn.sm { height: 22px; padding: 0 7px; font-size: 11px; }
.btn.ghost { background: var(--band); color: var(--navy); }
.btn.accent { background: var(--accent); color: #fff; }
.btn.stretch { width: 100%; margin-top: 6px; }
.btn:hover { filter: brightness(1.08); }

.save-pill {
    font-size: 11px;
    color: var(--steel);
    padding: 3px 8px;
    border-radius: 99px;
    background: var(--band);
    white-space: nowrap;
}
.save-pill.dirty { color: var(--accent); }
.save-pill.fail { color: #9a3412; }
button.linkish {
    background: none;
    border: 0;
    padding: 0;
    color: var(--navy);
    font-weight: 600;
    cursor: pointer;
    text-align: left;
}
button.linkish:hover { text-decoration: underline; }
.empty { color: var(--muted); margin: 24px 0; }
.directory .card-head { align-items: flex-start; gap: 12px; }
.directory h2 { margin: 0 0 4px; }

.main { flex: 1; padding: 8px 10px; min-height: 0; }
.main:focus { outline: none; }
.measure-shell {
    height: 100vh;
    overflow: hidden;
}
.measure-shell .topbar {
    overflow: visible;
    z-index: 80;
}
.measure-shell .footer { display: none; }
.measure-shell .main { overflow: hidden; padding: 6px 8px; }
.units-shell {
    height: 100vh;
    overflow: hidden;
}
.units-shell .footer { display: none; }
.units-shell .main {
    overflow: hidden;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
}
.units-board {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-rows: minmax(72px, 1fr) 7px minmax(120px, var(--units-results, 32%));
    gap: 0 8px;
    height: 100%;
    min-height: 0;
    flex: 1;
}
.units-board > .pane-split {
    grid-column: 1 / -1;
    grid-row: 2;
    flex: none;
    height: 7px;
    margin: 4px 0;
}
.units-side {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}
.units-work {
    grid-column: 2;
    grid-row: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    min-height: 0;
}
.units-results {
    grid-column: 1 / -1;
    grid-row: 3;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 8px 10px;
    margin: 0;
}
.units-results-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
}
.units-results .tabs-lite { flex: 0 0 auto; margin-bottom: 4px; }
table.grid.qty-compare { width: max-content; min-width: 100%; }
table.grid.qty-compare th.qty-group {
    text-align: center;
    background: #1f4460;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}
table.grid.qty-compare th.qty-break,
table.grid.qty-compare td.qty-break {
    border-left: 2px solid #163045;
}
table.grid.qty-compare th.qty-group.qty-break {
    border-left: 2px solid #c5d4e0;
}
table.grid.qty-compare td.qty-net {
    background: #e8f0d8;
    color: #2b4528;
    font-weight: 650;
}
.facade-net {
    margin: 10px 0 0;
    padding: 8px 10px;
    background: #e8f0d8;
    border: 1px solid #849f5a;
    color: #2b4528;
    font-size: 13px;
    line-height: 1.4;
}
.facade-qty .field {
    max-width: 5.5rem;
    text-align: right;
}
.units-pane.card {
    padding: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.units-side .units-pane { flex: 1; }
.units-pane .pane-fields {
    flex: 0 0 auto;
    padding: 4px 10px 6px;
}
.units-pane .pane-fields label { margin: 4px 0 2px; }
.units-pane .pick-list { margin: 0; padding: 4px 8px 8px; }
.units-pane .pane-foot {
    flex: 0 0 auto;
    padding: 6px 8px 8px;
}
.units-pane .pane-foot .btn.stretch { margin-top: 0; }
.units-pane .pane-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 8px 10px 10px;
}
.units-pane .pane-body > .card {
    padding: 0;
    background: transparent;
    border-radius: 0;
}
.units-pane .pane-body > .card.muted { padding: 8px 0; }
.units-pane .pane-body label { margin: 4px 0 2px; }
.units-pane .pane-body h3 { margin: 0 0 6px; font-size: 14px; }
tr.qty-section td {
    background: #e4ebf0;
    color: #163045;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.02em;
    text-align: left;
    padding: 6px 8px;
}
.units-pane table.grid { margin-top: 4px; width: 100%; }
.units-pane table.grid th,
.units-pane table.grid td { padding: 4px 6px; }
table.grid.openings-grid { table-layout: fixed; width: 100%; }
table.grid.openings-grid .col-type { width: 36%; }
table.grid.openings-grid .col-w { width: 14%; }
table.grid.openings-grid .col-n { width: 10%; }
table.grid.openings-grid .col-h { width: 12%; }
table.grid.openings-grid .col-sk { width: 18%; }
table.grid.openings-grid .col-act { width: 36px; }
table.grid.openings-grid select.field,
table.grid.openings-grid .field { min-width: 0; }
.open-add {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    align-items: center;
    justify-content: flex-end;
}
.units-pane .open-add { margin-top: 8px; }
.btn.icon {
    min-width: 28px;
    width: 28px;
    height: 28px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    font-weight: 700;
}
.btn.icon.add { background: #849f5a; color: #fff; }
.btn.icon.del { background: transparent; color: #c0392b; border: 1px solid #e0b4b0; }
.btn.icon.del:hover { background: #fdecea; }
table.grid.name-wide { table-layout: fixed; width: 100%; }
table.grid.name-wide th,
table.grid.name-wide td { overflow: hidden; }
table.grid.name-wide th:first-child,
table.grid.name-wide td:first-child { width: 46%; min-width: 140px; }
.item-with-show {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.item-with-show .field { flex: 1; min-width: 0; }
a.show-measure { text-decoration: none; color: inherit; }
.show-measure {
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid var(--steel-light);
    border-radius: 4px;
    background: #f4f8fb;
    color: var(--steel);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.show-measure:hover { background: #e4eef6; color: var(--navy); }
.show-measure svg { width: 13px; height: 13px; display: block; }
.draw-related { font-weight: 700; }
table.grid.name-wide th:last-child,
table.grid.name-wide td:last-child { width: 40px; text-align: center; overflow: visible; }
.show-col { width: 40px; }
td.show-cell {
    text-align: center;
    width: 40px;
    overflow: visible;
}
table.grid.name-wide th { position: relative; }
.col-grip {
    position: absolute;
    top: 0;
    right: -3px;
    width: 8px;
    height: 100%;
    cursor: col-resize;
    z-index: 2;
}
.muted.tight { margin: 6px 0 8px; font-size: 11px; }
.footer {
    background: var(--navy-dark);
    color: #9aa8b0;
    padding: 6px 10px;
    font-size: 10px;
    line-height: 1.35;
}
.footer .muted { color: #7a909a; margin-top: 4px; }

.workspace {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 12px;
    min-height: 420px;
}
.measure-workspace {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 8px;
    height: 100%;
    min-height: 0;
}
.measure-side {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 0;
    position: relative;
}
.pane {
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.draw-pane { min-height: 72px; }
.dim-pane { flex: 1 1 auto; min-height: 140px; }
.dim-pane .pane-body { min-width: 0; }

.scroll-tabs {
    display: flex;
    align-items: stretch;
    gap: 2px;
    margin: 0 0 6px;
    min-width: 0;
}
.scroll-tabs-track {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}
.scroll-tabs-track::-webkit-scrollbar { display: none; }
.scroll-tabs-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 2px;
    width: max-content;
    max-width: none;
}
.scroll-tabs .tab {
    flex: 0 0 auto;
}
.scroll-tabs-arrow {
    flex: 0 0 22px;
    width: 22px;
    padding: 0;
    border: 0;
    border-radius: var(--radius);
    background: var(--band);
    color: var(--navy);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}
.scroll-tabs-arrow:disabled {
    opacity: 0.35;
    cursor: default;
}
.dim-host-tabs { margin-bottom: 2px; }
.dim-floor-tabs { margin-bottom: 8px; }
.dim-host-tabs .tab,
.dim-floor-tabs .tab {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.scroll-tabs .tab.tab-progress {
    background: #f3d5a8;
    color: #5a3a12;
}
.scroll-tabs .tab.tab-progress.tab-active {
    background: #e8a84a;
    color: #fff;
}
.scroll-tabs .tab.tab-complete {
    background: #b7dfb7;
    color: #1e4d1e;
}
.scroll-tabs .tab.tab-complete.tab-active {
    background: #3d9a4a;
    color: #fff;
}

.host-picker {
    position: relative;
    margin-bottom: 8px;
    max-width: 100%;
}
.host-picker-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    width: 100%;
    justify-content: space-between;
    text-align: left;
}
.host-picker-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.host-picker-caret {
    flex: 0 0 auto;
    opacity: 0.75;
    font-size: 0.75rem;
}
.host-picker-mask {
    position: fixed;
    inset: 0;
    z-index: 80;
}
.host-picker-panel {
    position: absolute;
    top: calc(100% + 3px);
    left: 0;
    z-index: 90;
    background: #fff;
    border: 1px solid var(--line, #c5d0da);
    border-radius: var(--radius);
    box-shadow: 0 8px 22px rgba(22, 48, 69, 0.16);
    min-width: min(100%, 220px);
    max-width: min(92vw, 420px);
}
.host-picker-panel.flat {
    padding: 4px;
}
.host-picker-panel.cascade {
    display: flex;
    padding: 6px;
    gap: 6px;
    min-width: 320px;
}
.host-picker-col {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 140px;
    max-height: 280px;
    overflow: auto;
    flex: 1;
}
.host-picker-col strong {
    font-size: 10px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 2px 4px 4px;
}
.host-picker-sub {
    border-left: 1px solid var(--line, #c5d0da);
    padding-left: 6px;
}
.host-picker-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--navy);
    text-align: left;
    padding: 5px 8px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: var(--font-sm);
    cursor: pointer;
}
.host-picker-item:hover,
.host-picker-item.active {
    background: var(--band, #eef3f8);
}
.host-picker-item.active {
    background: var(--navy);
    color: #fff;
}
.host-picker-arrow {
    opacity: 0.55;
    font-size: 0.85rem;
}
.host-picker-item.tab-progress {
    background: #f3d5a8;
    color: #5a3a12;
}
.host-picker-item.tab-progress:hover,
.host-picker-item.tab-progress.active {
    background: #e8a84a;
    color: #fff;
}
.host-picker-item.tab-complete {
    background: #b7dfb7;
    color: #1e4d1e;
}
.host-picker-item.tab-complete:hover,
.host-picker-item.tab-complete.active {
    background: #3d9a4a;
    color: #fff;
}
.host-picker-trigger.tab-progress {
    background: #f3d5a8;
    color: #5a3a12;
}
.host-picker-trigger.tab-progress.tab-active {
    background: #e8a84a;
    color: #fff;
}
.host-picker-trigger.tab-complete {
    background: #b7dfb7;
    color: #1e4d1e;
}
.host-picker-trigger.tab-complete.tab-active {
    background: #3d9a4a;
    color: #fff;
}
.summary-side .host-picker {
    margin-bottom: 6px;
}
.pane-split {
    flex: 0 0 7px;
    cursor: row-resize;
    background: var(--line);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
.pane-split:hover, .pane-split.drag { background: #8aa4c4; }
.split-mask {
    position: fixed;
    inset: 0;
    z-index: 80;
    cursor: row-resize;
}
.pane.card { padding: 0; }
.pane-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 3px 6px;
    background: var(--navy);
    color: #fff;
    min-height: 26px;
}
.pane-head strong { font-size: 12px; font-weight: 700; }
.pane-head .btn { background: var(--steel); height: 20px; padding: 0 6px; font-size: 11px; }
.pane-head .btn.ghost { background: #2a4a62; color: #fff; }
.pane-body { flex: 1; min-height: 0; overflow: auto; padding: 4px 6px 6px; }
.measure-side .pane-head { padding: 3px 6px; }
.measure-side .pane-head strong { font-size: 12px; font-weight: 700; }
.measure-side .pane-head .row.gap { gap: 4px; }
.measure-side .pane-head .btn.sm {
    height: 20px;
    min-width: 20px;
    padding: 0 6px;
    font-size: 11px;
    line-height: 1;
}
.measure-side .pane-body {
    padding: 3px 4px 6px;
    font-size: 11px;
    line-height: 1.2;
}
.measure-side .pane-body label { margin: 3px 0 1px; font-size: 10px; }
.measure-side .pane-body .field {
    padding: 1px 4px;
    font-size: 11px;
    height: 18px;
    border-radius: 2px;
}
.measure-side .tree-node {
    padding: 0 2px 0 3px;
    border-radius: 2px;
    font-size: 11px;
    line-height: 16px;
    min-height: 18px;
    gap: 2px;
}
.measure-side .tree-hit { padding: 0; gap: 3px; min-height: 16px; }
.measure-side .tree-caret { width: 10px; font-size: 9px; }
.measure-side .tree-kids { margin-left: 8px; padding-left: 2px; }
.measure-side .tree-add { margin: 0; gap: 2px; min-height: 18px; }
.measure-side .tree-add .field { height: 18px; padding: 0 4px; font-size: 11px; }
.measure-side .tree-add .btn.icon.add {
    width: 18px;
    height: 18px;
    min-width: 18px;
    font-size: 13px;
}
.measure-side .tree-room { margin: 0; }
.measure-side .tree-room .btn.icon {
    width: 16px;
    height: 16px;
    min-width: 16px;
    font-size: 13px;
}
.measure-side .kind-ico { width: 13px; height: 13px; flex-basis: 13px; }
.measure-side .kind-pick { width: 15px; height: 15px; flex-basis: 15px; }
.measure-side .kind-ico svg,
.measure-side .kind-pick svg { width: 11px; height: 11px; }
.measure-side .gen-qty { min-width: 28px; font-size: 11px; }
.measure-side .gen-unit { min-width: 14px; font-size: 10px; }
.measure-side .layer-swatch { width: 12px; height: 12px; }
.measure-side .tree-meta { font-size: 10px; }
.measure-side .dim-tools { display: flex; gap: 4px; margin: 0 0 3px; }
.measure-side .dim-actions { margin-top: 4px; gap: 4px; }
.measure-side .empty { margin: 8px 0; font-size: 11px; }
.measure-side .facade-net { margin: 6px 0 0; padding: 4px 6px; font-size: 11px; }
.measure-editor {
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.measure-editor > .card,
.measure-editor > .takeoff-card { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.measure-workspace .takeoff-stage { flex: 1; min-height: 280px; height: auto; }
.tree-caret {
    width: 14px;
    min-width: 14px;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 0;
}
.tree-caret:hover { color: var(--navy); }
.tree-meta { margin-left: auto; font-size: 11px; }
.kind-ico {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    display: inline-flex;
    color: #5c6b73;
}
.kind-ico svg { display: block; }
.kind-pick {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 1px solid #c5cdd3;
    border-radius: 2px;
    background: #fff;
    color: #5c6b73;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.kind-pick:hover { border-color: #467498; color: #163045; }
.kind-pick svg { display: block; }
.tree-add .kind-pick { flex: 0 0 18px; }
.gen-row.sel .kind-pick { color: inherit; }
.gen-row .gen-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.gen-row .gen-qty {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    text-align: right;
    min-width: 36px;
}
.gen-row .gen-unit {
    min-width: 18px;
    font-size: 11px;
    color: var(--muted);
}
.gen-row {
    position: relative;
}
.gen-qty-tip {
    position: absolute;
    left: 8px;
    top: calc(100% + 2px);
    z-index: 40;
    min-width: 168px;
    max-width: 240px;
    padding: 8px 10px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
    font-size: 11px;
    line-height: 1.35;
    color: var(--navy);
    pointer-events: none;
}
.gen-qty-tip-head {
    font-weight: 600;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--line);
}
.gen-qty-tip-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 2px 0;
}
.gen-qty-tip-row.on {
    font-weight: 600;
    color: var(--accent, #1b6e9a);
}
.gen-qty-tip-row strong {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.ctx-menu .ctx-sep {
    height: 1px;
    background: var(--line);
    margin: 4px 0;
}
.ctx-menu .ctx-label {
    padding: 4px 10px 2px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}
.ctx-menu button.on {
    background: var(--band);
    font-weight: 600;
}
.gen-row.sel .kind-ico,
.gen-row.sel .gen-unit { color: inherit; }
.gen-row .swatch-wrap { margin-left: 4px; }
.tree-node {
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    border-radius: 3px;
    padding: 2px 4px 2px 6px;
    cursor: pointer;
    color: var(--navy);
    display: flex;
    align-items: center;
    gap: 4px;
}
.tree-hit {
    flex: 1;
    min-width: 0;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
    background: none;
    border: 0;
    padding: 2px 0;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.tree-node:hover { background: #eef3f8; }
.tree-node.sel { background: #cfe4f7; color: #15436b; }
.tree-node.draw { box-shadow: inset 3px 0 0 #2f6fad; }
.tree-node .draw-related { font-weight: 700; color: var(--navy); }
.tree-node .draw-unscaled { color: #b42318; font-weight: 600; }
.tree-node.sel .draw-unscaled,
.tree-node .draw-unscaled.draw-related { color: #b42318; }
.tree-node.add { color: var(--muted); font-weight: 600; }
.tree-add { display: flex; flex-wrap: nowrap; gap: 4px; align-items: center; margin: 2px 0 4px; }
.tree-add .field { flex: 1; min-width: 90px; }
.tree-add .btn.icon.add { flex: 0 0 28px; }
.tree-add.sel .field { background: #cfe4f7; }
.ctx-mask { position: fixed; inset: 0; z-index: 90; }
.ctx-menu {
    position: fixed;
    z-index: 91;
    min-width: 132px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    box-shadow: 0 8px 22px rgba(22, 48, 69, 0.18);
    padding: 4px;
}
.ctx-menu button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: 0;
    border-radius: 4px;
    padding: 6px 10px;
    color: var(--navy);
    font: inherit;
    cursor: pointer;
}
.ctx-menu button:hover { background: var(--band); }
.summary-page .ctx-menu { min-width: 148px; }
.summary-page button.qty-link {
    appearance: none;
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
    font: inherit;
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
.summary-page button.qty-link:hover { color: var(--navy); }
.qty-backdrop { z-index: 40; }
.qty-layout-modal {
    position: fixed;
    left: 15vw;
    top: 15vh;
    z-index: 50;
    width: 70vw;
    height: 70vh;
    max-width: 96vw;
    max-height: 92vh;
    min-width: 480px;
    min-height: 360px;
    margin: 0;
    resize: both;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 18px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
}
.qty-layout-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex: 0 0 auto;
    cursor: grab;
    user-select: none;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--line);
}
.qty-layout-head.drag { cursor: grabbing; }
.qty-layout-head h3 {
    margin: 0;
    font-size: 14px;
}
.qty-layout-body {
    overflow: auto;
    min-height: 0;
    flex: 1;
    padding: 4px 2px 8px;
}
.qty-layout-body.forecast-stack-body {
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 0;
    overflow: hidden;
}
.qty-layout-body .info-preview-track {
    display: inline-flex;
    align-items: flex-start;
    gap: 12px;
    width: max-content;
    min-width: 100%;
}
.tree-hit .field { min-width: 80px; padding: 2px 6px; }
.tree-room { display: flex; align-items: center; gap: 4px; margin: 1px 0; }
.tree-room .field { flex: 1; min-width: 0; padding: 3px 6px; }
.tree-caret-only { width: auto; padding: 4px 6px; flex: 0 0 auto; }
.tree-kids { margin-left: 12px; border-left: 1px solid var(--line); padding-left: 4px; }
.hover-tip {
    position: absolute;
    z-index: 5;
    background: rgba(40, 48, 52, 0.92);
    color: #fff;
    padding: 8px 10px;
    border-radius: 4px;
    font-size: 12px;
    min-width: 200px;
    pointer-events: auto;
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}
.hover-tip .k { color: #b8c5cc; display: inline-block; min-width: 88px; }
.hover-tip .tip-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.hover-tip .muted { color: #9aa8b0; }
.draw-pop {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 6;
    width: max-content;
    max-width: calc(100% - 20px);
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 4px 6px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.14);
}
.draw-pop-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}
.draw-pop .muted { margin: 6px 0 0; font-size: 11px; }
.assign-pop {
    position: fixed;
    z-index: 70;
    width: 200px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}
.assign-pop.assign-pop-wide { width: 260px; }
.assign-pop label { font-size: 12px; color: var(--muted); }
.assign-hint { margin: 0 0 8px; font-size: 11px; line-height: 1.35; }
.assign-tick { margin-top: 8px; gap: 6px; }
.assign-pop .btn.stretch { margin-top: 8px; }
.assign-struct-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--muted);
}
.assign-struct-row input[type="checkbox"] {
    flex: 0 0 auto;
    margin: 0;
}
.assign-struct-label {
    flex: 1 1 auto;
    min-width: 0;
}
.assign-struct-row .field { width: 64px; flex: 0 0 auto; }
.assign-struct-row .grade-prefix { flex: 0 0 auto; }
.delete-mask {
    position: absolute;
    inset: 0;
    z-index: 75;
    background: rgba(22, 48, 69, 0.28);
    display: flex;
    align-items: center;
    justify-content: center;
}
.delete-pop {
    width: min(320px, calc(100% - 24px));
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 12px 14px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
    outline: none;
}
.delete-pop p { margin: 0 0 10px; }
.delete-pop .row { justify-content: flex-end; gap: 8px; }
.draw-table {
    width: auto;
    border-collapse: collapse;
    font-size: 12px;
}
.draw-table th {
    text-align: left;
    font-weight: 600;
    color: var(--muted);
    padding: 1px 5px 2px 0;
    border-bottom: 1px solid var(--line);
    line-height: 1.15;
    white-space: nowrap;
}
.draw-table td { padding: 1px 5px 1px 0; vertical-align: middle; white-space: nowrap; }
.draw-table tr.on td { background: #d8e8f6; }
.draw-table td:last-child, .draw-table th:last-child { padding-right: 0; }
.draw-table .field { width: 48px; padding: 1px 3px; height: 20px; }
.stair-geom {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 6px;
    font-size: 12px;
}
.stair-geom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.stair-geom-row.grade-row {
    justify-content: flex-start;
}
.stair-geom-row.grade-row label { min-width: 48px; }
.grade-prefix {
    font-weight: 600;
    color: #163045;
    font-variant-numeric: tabular-nums;
}
.stair-geom-row.grade-row .field { width: 52px; }
.stair-geom label { color: var(--muted); }
.stair-geom .field { width: 52px; }
.stair-factor {
    font-variant-numeric: tabular-nums;
    color: #163045;
}
.stair-slope-cell { white-space: nowrap; }
.stair-slope-tick {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}
.stair-slope-val {
    font-variant-numeric: tabular-nums;
    min-width: 36px;
}
.draw-table .tick { text-align: center; width: 16px; }
.takeoff-color-slot { margin-left: auto; }
.swatch-wrap { position: relative; flex: 0 0 auto; }
.layer-swatch {
    width: 16px;
    height: 16px;
    padding: 0;
    border: 1px solid #333;
    border-radius: 2px;
    cursor: pointer;
}
.acad-palette {
    position: fixed;
    z-index: 90;
    display: grid;
    grid-template-columns: repeat(8, 18px);
    gap: 3px;
    background: #2b2b2b;
    padding: 7px;
    border: 1px solid #555;
    border-radius: 4px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
}
.acad-chip {
    width: 18px;
    height: 18px;
    padding: 0;
    border: 1px solid #111;
    cursor: pointer;
}
.acad-chip.on { outline: 2px solid #fff; outline-offset: 0; }

.side { display: flex; flex-direction: column; gap: 12px; }
.editor { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card {
    background: var(--card);
    border-radius: 4px;
    padding: 8px 10px;
}
.card.grow { flex: 1; display: flex; flex-direction: column; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 6px; }
.card h3, .card h2 { margin: 0 0 6px; font-size: 13px; }
.muted { color: var(--muted); }
.results { margin-top: 8px; overflow: auto; }

label { display: block; color: var(--muted); font-size: 10px; margin: 4px 0 2px; }
.field {
    width: 100%;
    height: var(--field-h);
    padding: 1px 6px;
    border: 1px solid #d0d5d8;
    border-radius: var(--radius);
    background: #fff;
    font-size: var(--font);
    line-height: 1.2;
}
.field.readonly { background: var(--band); }
.field-static { margin: 0 0 8px; color: var(--navy); font-weight: 600; }
.row { display: flex; gap: 6px; align-items: center; }
.row.gap { gap: 16px; }
.wrap { flex-wrap: wrap; }
.radio { display: flex; align-items: center; gap: 8px; color: var(--navy); font-size: 13px; margin: 6px 0; }

.grid-2, .grid-3, .grid-4 {
    display: grid;
    gap: 12px;
}
.grid-2 { grid-template-columns: 2fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.pick-list { list-style: none; padding: 0; margin: 8px 0 0; overflow: auto; flex: 1; min-height: 72px; }
.pick-list li { margin: 0 0 4px; }
.pick {
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    color: var(--navy);
}
.pick.active, .pick:hover { background: var(--band); }
.draw-tree .draw-folder {
    font-weight: 700;
    padding: 8px 8px 2px;
    color: var(--navy);
}
.pick.indent { padding-left: 18px; }
.indent { padding-left: 22px; font-size: 12px; }
.mode-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0 8px; }
.mode-label { font-weight: 700; margin-right: 4px; }
.layer-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0;
    cursor: pointer;
}
.layer-row input[type="color"] {
    width: 28px;
    height: 22px;
    padding: 0;
    border: 1px solid var(--line);
    background: #fff;
}

.table-wrap { overflow: auto; }
table.grid {
    width: 100%;
    border-collapse: collapse;
    margin-top: 4px;
    font-size: var(--font);
}
table.grid th, table.grid td {
    border-bottom: 1px solid var(--line);
    padding: 2px 6px;
    text-align: left;
    vertical-align: middle;
    line-height: 1.2;
}
table.grid th {
    background: var(--navy);
    color: #fff;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.01em;
    padding: 4px 6px;
}
table.grid tr:nth-child(even) { background: #f7fafc; }
table.grid tr.total { background: var(--band); font-weight: 700; }
table.grid tr.section { background: var(--band); font-weight: 700; }
table.grid tr.section.fold-head { cursor: pointer; }
table.grid tr.section.fold-head:hover { background: #dce6ee; }
table.grid tr.discipline-head td {
    background: #1a3348;
    color: #fff;
    font-weight: 700;
}
table.grid tr.discipline-head.fold-head:hover td { background: #243f56; }
table.grid tr.discipline-head .head-twist,
table.grid tr.discipline-head .head-label { color: #fff; }
.summary-page .head-twist {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    flex: 0 0 14px;
    color: var(--steel, #467498);
    font-size: 10px;
}
table.grid tr.add-row td {
    background: transparent;
    border-bottom: none;
    height: 28px;
    vertical-align: middle;
}
table.grid tr.add-row td:last-child { text-align: right; }
table.grid tr:nth-child(even).add-row { background: transparent; }
.num { text-align: right; white-space: nowrap; }
input.field.num, .num .field { text-align: right; }
table.grid td.num { text-align: right; }
table.grid th.num { text-align: center; }
.center { text-align: center; }
.summary-shell {
    height: 100vh;
    overflow: hidden;
}
.summary-shell .footer { display: none; }
.summary-shell .main {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 8px 10px;
}
.summary-board {
    flex: 1;
    min-height: 0;
    display: flex;
    gap: 0;
    align-items: stretch;
    overflow: hidden;
}
.summary-board.formula-open .summary-side {
    z-index: 52;
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.08);
}
.formula-scrim {
    position: absolute;
    inset: 0;
    z-index: 36;
    background: rgba(18, 40, 51, 0.28);
}
.qty-formula-modal.modal {
    position: fixed;
    z-index: 45;
    left: auto;
    right: 20px;
    top: 72px;
    transform: none;
    width: min(480px, calc(100vw - 400px));
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 40px rgba(0,0,0,.18);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 96px);
}
.summary-side {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    align-items: stretch;
    min-height: 0;
    width: 18px;
    background: #f4f7fa;
    border-right: 1px solid var(--line);
}
.summary-side.closed { width: 18px; }
.summary-side.open { width: min(360px, 38vw); }
.summary-side-toggle {
    position: absolute;
    top: 50%;
    right: -1px;
    z-index: 3;
    transform: translateY(-50%);
    width: 16px;
    height: 48px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 4px 0 0 4px;
    background: #fff;
    color: var(--navy);
    cursor: pointer;
    font-size: 11px;
    line-height: 1;
}
.summary-side.closed .summary-side-toggle {
    right: 0;
    border-radius: 0 4px 4px 0;
}
.summary-side-body {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px;
    padding: 6px 8px 6px 6px;
    overflow: hidden;
}
.summary-side-top,
.summary-side-bot {
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: 0;
    padding: 6px;
}
.summary-dim-tree,
.summary-qty-table {
    flex: 1;
    min-height: 0;
    overflow: auto;
}
.summary-dim-tree .qty-pick:disabled { opacity: 0.75; cursor: default; }
.summary-dim-tree .qty-pick:not(:disabled):hover { background: #e8f0e0; }
.summary-page {
    position: relative;
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
}
.summary-page .uom-field {
    width: 4.2rem;
    max-width: 100%;
    height: var(--field-h);
    padding: 1px 4px;
    font-size: var(--font-sm);
}
.summary-page .formula-col {
    width: 2rem;
    text-align: center;
    vertical-align: middle;
}
.summary-page .formula-btn {
    width: 22px;
    height: 22px;
    min-width: 22px;
    padding: 0;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}
.qty-formula-head,
.qty-formula-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
}
.qty-formula-foot {
    border-bottom: 0;
    border-top: 1px solid var(--line);
    justify-content: flex-end;
}
.qty-formula-head h3 { margin: 0; font-size: 13px; }
.qty-formula-body {
    padding: 8px 10px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.qty-sheet-modal.modal {
    position: fixed;
    z-index: 48;
    left: 380px;
    top: 64px;
    transform: none;
    width: 920px;
    height: 560px;
    max-width: none;
    max-height: none;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    box-shadow: 0 12px 40px rgba(0,0,0,.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.qty-sheet-modal .qty-formula-head {
    cursor: move;
    user-select: none;
    flex: 0 0 auto;
    padding: 4px 8px;
    min-height: 0;
}
.qty-sheet-modal .qty-formula-head h3 { font-size: 12px; }
.qty-sheet-modal .qty-formula-head.drag { cursor: grabbing; }
.qty-sheet-modal .qty-formula-foot {
    padding: 4px 8px;
}
.qty-sheet-modal .define-resize {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 14px;
    height: 14px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, #9ab 50%);
    border-radius: 0 0 6px 0;
}
.qty-sheet-modal .qty-formula-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 4px 8px 6px;
    gap: 4px;
    overflow: hidden;
}
.qty-sheet-body {
    min-height: 0;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.qty-sheet-modal .qs-toolbar {
    gap: 6px;
    align-items: center;
    margin: 0;
}
.qty-sheet-modal .qs-label {
    font-size: 11px;
    color: var(--muted);
}
.qty-sheet-modal .qs-total { font-size: 11px; margin-left: auto; }
.qty-sheet-modal .qs-toolbar .btn.sm {
    height: 22px;
    padding: 0 8px;
    font-size: 11px;
}
.qs-fbar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    min-height: 26px;
    padding: 2px 0;
}
.qs-fbar-fx {
    font-size: 11px;
    font-weight: 600;
    color: #3a5a7a;
    width: 18px;
    text-align: center;
    flex: 0 0 auto;
}
.qs-fbar-ref {
    font-size: 10px;
    color: #667;
    min-width: 48px;
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
}
.qs-fbar-editor {
    flex: 1;
    min-width: 0;
    position: relative;
}
.qs-fbar-input {
    width: 100%;
    height: 24px;
    font-size: 12px;
    font-family: Consolas, "Courier New", monospace;
}
.qs-select-mask {
    cursor: cell;
    z-index: 60;
}
.qty-sheet-scroll {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 4px;
    flex: 1;
    min-height: 120px;
}
.qty-sheet {
    border-collapse: collapse;
    width: max-content;
    min-width: 100%;
    font-size: 11px;
    line-height: 1.15;
    table-layout: fixed;
    user-select: none;
}
.qty-sheet th,
.qty-sheet td {
    border: 1px solid #d7dee6;
    padding: 0;
    vertical-align: middle;
    background: #fff;
    height: 20px;
}
.qty-sheet thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #eef3f7;
    font-weight: 600;
    white-space: nowrap;
    padding: 2px 4px;
    height: 20px;
    font-size: 10px;
    letter-spacing: 0;
}
.qty-sheet tr.active td { background: #f7fafc; }
.qty-sheet tr.qs-row-sel td { background: #eef5fc; }
.qty-sheet .qs-num {
    width: 22px;
    text-align: center;
    color: #667;
    font-size: 10px;
    cursor: pointer;
    user-select: none;
}
.qty-sheet .qs-num:hover { background: #e2ebf4; }
.qty-sheet td:nth-child(2),
.qty-sheet th:nth-child(2) { width: 110px; min-width: 90px; } /* Item */
.qty-sheet td:nth-child(3),
.qty-sheet th:nth-child(3) { width: 72px; min-width: 56px; } /* Typology */
.qty-sheet .qs-dim { width: 56px; min-width: 48px; }
.qty-sheet .qs-assign { width: 64px; min-width: 56px; }
.qty-sheet .qs-qty { width: 72px; min-width: 60px; }
.qty-sheet .qs-help { width: 40px; min-width: 36px; }
.qty-sheet .qs-td {
    cursor: cell;
    position: relative;
}
.qty-sheet .qs-param-btn {
    position: absolute;
    right: 1px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    padding: 0;
    border: none;
    border-radius: 2px;
    background: #e8eef4;
    color: #345;
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.85;
    z-index: 2;
}
.qty-sheet .qs-param-btn:hover {
    background: #cfe2f5;
    opacity: 1;
}
.qty-sheet .qs-td.qs-dim .qs-disp {
    padding-right: 14px;
}
.qty-sheet .qs-td.qs-sel { background: #cfe2f5; }
.qty-sheet .qs-td.qs-active {
    outline: 2px solid #2b6cb0;
    outline-offset: -2px;
    z-index: 1;
}
.qty-sheet .qs-disp {
    display: block;
    padding: 1px 4px;
}
.qty-sheet .qs-disp.qs-wrap {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.25;
    min-height: 18px;
    height: auto;
}
.qty-sheet.qs-wrap-table td {
    height: auto;
    min-height: 20px;
    vertical-align: top;
}
.qty-sheet .qs-th-resize {
    position: relative;
    overflow: visible;
}
.qty-sheet .qs-col-grip {
    position: absolute;
    top: 0;
    right: -3px;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    z-index: 3;
}
.qty-sheet .qs-col-grip:hover {
    background: rgba(47, 111, 237, 0.35);
}
.qs-statusbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    flex: 0 0 auto;
    min-height: 22px;
    padding: 2px 4px;
    border-top: 1px solid var(--line);
    font-size: 11px;
    color: #445;
    background: #f7f9fb;
}
.qs-statusbar strong {
    font-variant-numeric: tabular-nums;
    color: var(--navy);
}
.qty-sheet .qs-qty-val {
    color: #445;
    font-variant-numeric: tabular-nums;
    text-align: right;
}
.qty-sheet .qs-cell,
.qty-sheet .qs-edit {
    width: 100%;
    min-width: 0;
    height: 18px;
    border: 0;
    background: #fff;
    padding: 0 3px;
    font-size: 11px;
    line-height: 18px;
    border-radius: 0;
    box-shadow: none;
}
.qty-sheet .formula-editor .formula-expr {
    height: 18px;
}
.qty-sheet .qs-num-cell { font-variant-numeric: tabular-nums; text-align: right; }
.qty-sheet .qs-dim.drop-over,
.qty-sheet td.qs-dim.drop-over {
    outline: 2px solid #2f6fed;
    outline-offset: -2px;
    background: #e8f0ff !important;
}
.qty-sheet .qs-loc-btn {
    width: 100%;
    height: 18px;
    min-height: 18px;
    padding: 0 2px;
    font-size: 10px;
    justify-content: center;
    white-space: nowrap;
    line-height: 1;
}
.qs-ctx-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
}
.qs-ctx-menu {
    position: fixed;
    z-index: 201;
    min-width: 140px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 4px;
    box-shadow: 0 8px 24px rgba(0,0,0,.16);
    padding: 4px 0;
}
.qs-ctx-item {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
}
.qs-ctx-item:hover { background: #eef5fc; }
.qs-ctx-item.qs-ctx-on { background: #e8f2fb; font-weight: 600; }
.qs-ctx-label {
    padding: 4px 12px 2px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted, #6b7280);
}
.summary-dim-tree .qty-pick.qty-selected {
    background: #dceafc;
    box-shadow: inset 0 0 0 1px #2f6fed;
}
.summary-dim-tree .qty-pick { cursor: grab; }
.summary-dim-tree .qty-pick.qty-dragging { opacity: 0.55; cursor: grabbing; }
.qty-drag-ghost {
    position: fixed;
    z-index: 10000;
    pointer-events: none;
    background: #1f4e79;
    color: #fff;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    box-shadow: 0 6px 16px rgba(0,0,0,.25);
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
body.qty-sheet-dragging,
body.qty-sheet-dragging * {
    cursor: grabbing !important;
}
body.qty-sheet-dragging .qs-dim {
    background: #f4f8ff;
}
.formula-expr { width: 100%; font-family: Consolas, "Courier New", monospace; }
.formula-editor {
    position: relative;
}
.formula-editor .formula-expr {
    width: 100%;
    height: 32px;
    resize: none;
}
.formula-suggest {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% - 1px);
    z-index: 5;
    margin: 0;
    padding: 2px 0;
    list-style: none;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 0 0 4px 4px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
    max-height: 220px;
    overflow: auto;
}
.formula-suggest li.active,
.formula-suggest li:hover {
    background: #2f6fed;
}
.formula-suggest li.active .formula-suggest-item,
.formula-suggest li:hover .formula-suggest-item {
    color: #fff;
}
.formula-suggest li.active .hint,
.formula-suggest li:hover .hint {
    color: rgba(255, 255, 255, 0.85);
}
.formula-suggest-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    border: 0;
    background: transparent;
    padding: 5px 8px;
    text-align: left;
    cursor: pointer;
    font-size: 12px;
    color: var(--ink);
}
.formula-suggest-item .fx {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid #9eb6d0;
    color: #2a5f8f;
    font-size: 9px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef4fa;
}
.formula-suggest li.active .fx,
.formula-suggest li:hover .fx {
    border-color: #fff;
    color: #2a5f8f;
    background: #fff;
}
.formula-suggest-item .name {
    font-weight: 700;
    letter-spacing: 0.02em;
    min-width: 5.5rem;
}
.formula-suggest-item .hint {
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.formula-refs { margin: 0; padding-left: 1.1rem; font-size: 11px; }
.formula-ops { gap: 4px; }
.formula-lines {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.formula-line {
    display: grid;
    grid-template-columns: 1.4rem minmax(0, 1fr) auto auto;
    gap: 6px;
    align-items: start;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fafbfc;
}
.formula-line.active {
    border-color: #7aa2c8;
    background: #f3f8fc;
}
.formula-line.deduct {
    border-color: #d4a0a0;
    background: #fdf6f6;
}
.formula-line-num {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    line-height: 32px;
    text-align: center;
    cursor: pointer;
    user-select: none;
}
.formula-line-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.formula-deduct {
    margin: 6px 0 0;
    font-size: 11px;
    white-space: nowrap;
    gap: 4px;
}
.formula-line-remove {
    margin-top: 2px;
    min-width: 24px;
    padding: 0 4px;
    font-size: 16px;
    line-height: 1.2;
}
.summary-qty-table .qty-link:disabled { opacity: 0.8; cursor: default; }
.formula-assign {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.check-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    cursor: pointer;
}
.formula-pick-backdrop {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: min(360px, 38vw);
    z-index: 54;
    background: rgba(18, 40, 51, 0.22);
}
.formula-pick-modal.modal {
    position: fixed;
    z-index: 56;
    left: calc(min(360px, 38vw) + 6px);
    top: 56px;
    transform: none;
    width: min(920px, calc(100vw - min(360px, 38vw) - 18px));
    height: min(720px, calc(100vh - 72px));
    min-width: 420px;
    min-height: 320px;
    max-width: 96vw;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 40px rgba(0,0,0,.22);
    padding: 0;
    resize: both;
    overflow: hidden;
}
.formula-pick-head {
    cursor: grab;
    user-select: none;
    flex: 0 0 auto;
}
.formula-pick-head.drag { cursor: grabbing; }
.formula-pick-body {
    padding: 8px 10px 12px;
    overflow: auto;
    min-height: 0;
    flex: 1;
}
.typo-sheet.typo-select td.typo-pick {
    padding: 0;
    background: #f3f7ef;
}
.typo-sheet.typo-select td.typo-picked {
    background: #cfe3b8;
}
.typo-cell-btn {
    display: block;
    width: 100%;
    min-height: 22px;
    border: 0;
    background: transparent;
    cursor: pointer;
    padding: 2px 4px;
    font: inherit;
    color: inherit;
    text-align: center;
}
.typo-cell-btn:hover { background: rgba(132, 159, 90, 0.25); }
.summary-page .table-wrap {
    flex: 1;
    min-height: 0;
    overflow: auto;
}
.summary-page .table-wrap.tower-wise-wrap {
    overflow: auto;
}
table.summary.tower-wise {
    width: max-content;
    min-width: 100%;
}
table.summary.tower-wise th,
table.summary.tower-wise td {
    white-space: nowrap;
}
table.summary.tower-wise td.num,
table.summary.tower-wise th.num {
    min-width: 4.6rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
}
table.summary.tower-wise th.tower-group {
    text-align: center;
    letter-spacing: 0.02em;
}
table.summary.tower-wise thead tr:nth-child(1) th { top: 0; }
table.summary.tower-wise thead tr:nth-child(2) th { top: 22px; z-index: 4; }
table.summary.tower-wise thead tr:nth-child(3) th { top: 42px; z-index: 4; }
table.summary.tower-wise thead tr:first-child th[rowspan] { height: 64px; }
table.summary.tower-wise .sticky-col {
    position: sticky;
    z-index: 2;
    background: #fff;
}
table.summary.tower-wise thead .sticky-col {
    z-index: 5;
    background: var(--navy);
    color: #fff;
}
table.summary.tower-wise .sticky-c0 { left: 0; }
table.summary.tower-wise .sticky-c1 { left: 3.2rem; min-width: 9rem; }
table.summary.tower-wise .sticky-c2 { left: 12.2rem; min-width: 10rem; max-width: 14rem; white-space: normal; }
table.summary.tower-wise .sticky-c3 { left: 22.2rem; }
table.summary.tower-wise .sticky-c4 { left: 27rem; }
table.summary.tower-wise .sticky-c5 { left: 31.2rem; box-shadow: 2px 0 4px rgba(0, 0, 0, 0.06); }
table.summary.tower-wise tbody tr.section .sticky-col,
table.summary.tower-wise tbody tr.discipline .sticky-col,
table.summary.tower-wise tbody tr.total .sticky-col,
table.summary.tower-wise tbody tr.subtotal .sticky-col {
    background: inherit;
}
table.summary.tower-wise tbody tr:nth-child(even):not(.section):not(.discipline):not(.total):not(.subtotal) .sticky-col {
    background: #f7f9fb;
}
.summary-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
    padding: 4px 6px;
    border-bottom: 1px solid var(--line);
    background: #f4f7fa;
}
.summary-disc-title {
    font-size: 13px;
    color: var(--navy);
    margin-right: 6px;
}
.summary-side-disc {
    display: block;
    font-size: 12px;
    color: var(--navy);
    margin-bottom: 4px;
}
.summary-add-head {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    flex: 0 0 auto;
}
.summary-add-head .btn.icon.add {
    width: 22px;
    height: 22px;
    min-width: 22px;
    font-size: 14px;
}
.summary-toolbar .field { max-width: 180px; height: var(--field-h); padding: 1px 6px; font-size: var(--font-sm); }
.summary-toolbar .muted { flex: 1 1 200px; font-size: 10px; color: var(--muted); }
.summary-page .item-line {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.summary-page .head-label { font-weight: inherit; }
.summary-page td.serial {
    width: 3.2rem;
    text-align: right;
    vertical-align: middle;
    font-variant-numeric: tabular-nums;
}
.drag-slot,
.drag-grip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    min-height: 22px;
    flex: 0 0 18px;
    user-select: none;
    touch-action: none;
}
.drag-grip {
    cursor: grab;
    color: #5a7a3a;
    letter-spacing: -2px;
    font-weight: 700;
    font-size: 12px;
    line-height: 1;
}
.drag-grip:active { cursor: grabbing; }
.summary-page.dragging-item,
.summary-page.dragging-head { cursor: grabbing; user-select: none; }
table.grid tr.drop-over td { box-shadow: inset 0 2px 0 #849f5a; }
table.grid tr.drop-over.drop-after td { box-shadow: inset 0 -2px 0 #849f5a; }
table.grid tr.drag-source { opacity: 0.45; pointer-events: none; }
table.grid.compact-summary th,
table.grid.compact-summary td {
    padding: 2px 5px;
    font-size: 11px;
}
table.grid.compact-summary thead th { font-size: 10px; letter-spacing: 0.01em; padding: 3px 5px; }
table.grid.compact-summary tr.section td,
table.grid.compact-summary tr.subtotal td,
table.grid.compact-summary tr.total td { padding: 3px 5px; font-size: 11px; }
table.grid tr.subtotal { background: #eef3f7; font-weight: 700; font-style: italic; }
table.grid.compact-summary .field {
    height: 20px;
    padding: 0 4px;
    font-size: 11px;
}
.head-name {
    display: inline-block;
    width: auto;
    min-width: 7rem;
    max-width: 14rem;
    font-weight: 700;
    height: 20px;
}
.summary-page.heads-edit tr.movable-head { outline: 1px dashed rgba(70, 116, 152, 0.35); outline-offset: -1px; }
.summary-page.items-edit tr.movable { outline: 1px dashed rgba(70, 116, 152, 0.25); outline-offset: -1px; }
.add-item-backdrop { z-index: 55; }
.add-item-modal.modal {
    position: fixed;
    z-index: 56;
    left: 50%;
    top: 18%;
    transform: translateX(-50%);
    width: min(360px, calc(100vw - 32px));
    max-height: min(70vh, 520px);
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}
.add-item-modal .qty-formula-head {
    padding: 8px 10px;
    flex: 0 0 auto;
}
.add-item-modal .qty-formula-head h3 { font-size: 13px; margin: 0; }
.add-item-body {
    padding: 8px 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
    overflow: hidden;
}
.add-item-body > .field { width: 100%; }
.add-item-heads {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: auto;
    max-height: 280px;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 4px;
    background: #fafbfc;
}
.add-item-head {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    padding: 6px 8px;
    font-size: 12px;
    border-radius: 3px;
    cursor: pointer;
}
.add-item-head:hover { background: #eef5fc; }
.add-item-head.active {
    background: #dceafc;
    font-weight: 600;
    box-shadow: inset 0 0 0 1px #2f6fed;
}
.add-item-foot {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    padding-top: 4px;
}
table.summary {
    margin-top: 0;
    border-collapse: collapse;
}
table.summary th { font-size: 12px; }
table.summary thead th {
    position: sticky;
    z-index: 3;
    background: var(--navy);
    vertical-align: middle;
    white-space: nowrap;
    box-sizing: border-box;
}
table.summary thead tr:first-child th { top: 0; height: 26px; }
table.summary thead tr:first-child th[rowspan] { height: 50px; }
/* Only offset the 2nd header row — a single-row thead is both first and last. */
table.summary thead tr:last-child:not(:first-child) th { top: 26px; height: 24px; z-index: 4; }
table.summary thead th.serial { text-align: right; }
table.summary thead th.qty-group {
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.22);
    letter-spacing: 0.04em;
}
table.summary thead th.amt-break {
    box-shadow: inset 3px 0 0 rgba(255, 255, 255, 0.55);
}
table.summary tbody td.amt-break {
    position: relative;
    border-left: none;
}
table.summary tbody td.amt-break::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #163045;
    pointer-events: none;
    z-index: 1;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    width: 100%;
    background: #ffffe0;
    padding: 8px;
}

.file-link { font-size: 12px; color: var(--navy); }
.ref-files { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 160px; }
table.grid td[rowspan] { vertical-align: top; }

.file-btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; }
.file-btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.format-help { margin: 8px 0 12px; }
.format-help summary { cursor: pointer; color: var(--muted); }
table.grid.compact th, table.grid.compact td { font-size: 12px; vertical-align: top; }
table.grid.compact td:first-child { white-space: nowrap; font-weight: 600; }

.stack { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.stack span { color: var(--muted); font-size: 12px; }
select.field { height: var(--field-h); padding: 0 4px; }

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(18, 40, 51, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 40;
    padding: 16px;
}
.modal {
    background: #fff;
    border-radius: 4px;
    padding: 12px 14px;
    width: min(400px, 100%);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
}
.modal h3 { margin: 0 0 6px; font-size: 13px; }
.copy-modal { width: min(440px, 94vw); max-height: 82vh; display: flex; flex-direction: column; }
.copy-tree { overflow: auto; max-height: 52vh; margin-top: 8px; padding: 2px 0; }

.btn.stretch { width: 100%; margin-top: 8px; justify-content: center; }
.takeoff-card { min-width: 0; padding: 8px; position: relative; }
.takeoff-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 8px;
    flex: 0 0 auto;
    margin-bottom: 6px;
    position: relative;
    z-index: 5;
}
.takeoff-title {
    font-size: 13px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.takeoff-scale { position: relative; }
.takeoff-sign { position: relative; }
.sign-pop {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 80;
    min-width: 140px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
    padding: 4px;
    display: grid;
}
.sign-opt {
    display: flex;
    align-items: center;
    gap: 6px;
    border: 0;
    background: transparent;
    padding: 6px 8px;
    border-radius: 6px;
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}
.sign-opt:hover { background: #eef3f7; }
.sign-tick {
    width: 14px;
    color: var(--navy, #163045);
    font-weight: 700;
}
.takeoff-badge { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.takeoff-color { margin: 0; gap: 6px; }
.scale-pop {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 40;
    width: 280px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
    padding: 10px 12px;
    display: grid;
    gap: 6px;
}
.scale-pop-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.scale-pop label { font-size: 12px; color: var(--muted); }
.scale-ratio {
    display: flex;
    align-items: center;
    gap: 4px;
}
.scale-ratio .scale-part {
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
}
.scale-colon {
    flex: 0 0 auto;
    font-weight: 700;
    color: var(--navy);
}
.takeoff-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.takeoff-toast {
    position: absolute;
    left: 8px;
    bottom: 8px;
    max-width: min(520px, 80%);
    background: rgba(22, 48, 69, 0.88);
    color: #fff;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    z-index: 12;
}
.takeoff-stage {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 520px;
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow: hidden;
    background: #e8eef3;
}
.takeoff-canvas, .takeoff-overlay {
    position: absolute;
    inset: 0;
    display: block;
}
.takeoff-overlay { cursor: crosshair; }
.dyn-input {
    position: absolute;
    z-index: 9;
    min-width: 36px;
    padding: 1px 6px 2px;
    background: #fff;
    border: 1px solid #222;
    font: 13px "Segoe UI", sans-serif;
    color: #111;
    pointer-events: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.dyn-input.typed { outline: 1px solid var(--accent); }

.info-shell {
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}
.info-shell .footer { display: none; }
.info-shell .main {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 8px 10px;
}
.info-page {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 8px 10px;
    overflow: hidden;
}
.info-page.is-locked {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 8px 10px;
}
.info-edit-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 10px;
    margin: 0 0 8px;
    padding: 6px 8px;
    background: #fff7ed;
    border: 1px solid #fdba74;
    border-radius: var(--radius);
    font-size: 12px;
}
.info-edit-banner strong { color: #9a3412; }
.info-lock-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    flex: 0 0 auto;
}
.info-lock-bar strong { font-size: 13px; margin-right: 8px; }
.info-lock-board {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(240px, 32%) minmax(0, 1fr);
    gap: 10px;
}
.info-lock-side {
    overflow: auto;
    min-width: 0;
}
.info-lock-viz {
    overflow: auto;
    min-width: 0;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 8px;
}
.info-block.tight {
    margin: 0 0 8px;
    padding: 6px 8px;
}
.info-block.tight h3 { font-size: 12px; }
.info-page.is-locked .info-block { background: #f4f7fa; }
table.lock-sum th, table.lock-sum td {
    padding: 2px 5px;
    font-size: 11px;
}
table.typo-sheet {
    border-collapse: collapse;
    font-size: 11px;
    background: #fff;
    flex: 0 0 auto;
}
table.typo-sheet th, table.typo-sheet td {
    border: 1px solid #c5d0da;
    padding: 2px 6px;
    text-align: center;
    white-space: nowrap;
}
table.typo-sheet thead tr:first-child th {
    background: var(--navy);
    color: #fff;
    font-size: 12px;
    padding: 4px 8px;
}
.typo-select-actions {
    float: right;
    display: inline-flex;
    gap: 4px;
    align-items: center;
}
.typo-select-all {
    margin-left: 0;
    padding: 0.1rem 0.45rem;
    font-size: 0.72rem;
    vertical-align: middle;
}
table.typo-sheet thead tr:last-child th {
    background: #e4edf3;
    color: var(--navy);
    font-weight: 600;
}
table.typo-sheet td.typo-fl { font-weight: 700; width: 2.2rem; }
table.typo-sheet td.typo-fl .typo-fl-qty {
    display: block;
    font-weight: 600;
    font-size: 10px;
    color: var(--navy);
    margin-top: 1px;
}
table.typo-sheet tr.stripe td { background: #f3f6f8; }
table.typo-sheet tr.refuge td { background: #eef3e6; }
.info-page h2 { margin: 8px 0 4px; font-size: 16px; }
.info-page h3 { margin: 14px 0 6px; font-size: 13px; }
.info-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}
.info-step {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--navy);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.info-step span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--band);
    font-size: 11px;
}
.info-step.on { background: var(--navy); color: #fff; }
.info-step.on span { background: #fff; color: var(--navy); }
.info-counts {
    display: grid;
    grid-template-columns: 160px 160px;
    gap: 12px;
    max-width: 360px;
}
.info-add {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 8px 0;
}
.info-add-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
form.info-add, form.define-add, form.summary-toolbar-add {
    margin: 0;
}
.info-add .field { max-width: 200px; height: var(--field-h); }
.info-block {
    margin: 12px 0 16px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f8fafc;
}
.info-block-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 18px;
    margin-bottom: 8px;
}
.info-block-head h3 { margin: 0; }
.info-block-head .stack.tight { margin: 0; }
.info-warn { color: #9a3412; font-size: 12px; margin: 4px 0; }
.info-missing {
    margin: 10px 0 0;
    padding: 8px 10px;
    background: #fff4e8;
    border: 1px solid #e8c39e;
    border-radius: 4px;
    color: #9a3412;
    font-size: 12px;
}
.info-missing ul { margin: 6px 0 0 18px; padding: 0; }
.info-missing li { margin: 2px 0; }
table.grid tr.warn-row td { background: #fff4e8; }
.info-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.info-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 4px 2px 6px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #fff;
}
.info-chip .field { width: 120px; height: var(--field-h); }
.info-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}
.info-nav .muted { flex: 1; color: #9a3412; }
.info-copy {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px 12px;
    margin: 8px 0 10px;
    padding: 8px 10px;
    background: #fff;
    border: 1px dashed var(--line);
    border-radius: 4px;
}
.info-copy .field { min-width: 160px; height: var(--field-h); }
.floor-stack {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px 14px;
    margin: 8px 0 4px;
}
.floor-stack > span { font-weight: 600; color: var(--navy); font-size: 12px; }
.floor-stack .stack.tight .field { width: 72px; }
.floor-pick-btn { text-align: left; white-space: normal; max-width: 28rem; }
.modal.floor-pick {
    width: min(340px, 100%);
    max-height: 86vh;
    display: flex;
    flex-direction: column;
}
.floor-pick-list {
    overflow: auto;
    max-height: 52vh;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #fff;
}
.floor-pick-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-bottom: 1px solid #e8eef3;
    cursor: pointer;
    font-size: 13px;
}
.floor-pick-row:last-child { border-bottom: 0; }
.floor-pick-row:hover { background: #f4f7fa; }

.define-float {
    position: fixed;
    z-index: 60;
    display: flex;
    flex-direction: column;
    min-width: 280px;
    min-height: 220px;
    max-width: 92vw;
    max-height: 86vh;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    box-shadow: 0 10px 28px rgba(22, 48, 69, 0.22);
    overflow: hidden;
}
.define-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: #163045;
    color: #fff;
    cursor: grab;
    user-select: none;
    flex: 0 0 auto;
}
.define-head.drag { cursor: grabbing; }
.define-head h3 { margin: 0; font-size: 12px; font-weight: 700; color: #fff; flex: 1; }
.define-head .btn { height: 22px; padding: 0 8px; color: #fff; border-color: rgba(255,255,255,.35); background: transparent; }
.define-mask { position: fixed; inset: 0; z-index: 61; cursor: grabbing; }
.define-mask.is-resize { cursor: nwse-resize; }
.define-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 8px 4px; flex: 0 0 auto; }
.define-tabs .btn.sm { height: 22px; padding: 0 8px; font-size: 11px; }
.define-body { flex: 1; min-height: 0; overflow: auto; padding: 4px 8px 8px; }
.define-body h4 { margin: 8px 0 4px; font-size: 11px; letter-spacing: 0.02em; text-transform: uppercase; color: #467498; }
.define-body .muted { margin: 0 0 4px; font-size: 11px; }
.tick-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2px 8px;
    margin: 0 0 6px;
}
@media (max-width: 520px) {
    .tick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.tick { display: flex; align-items: center; gap: 3px; font-size: 11px; line-height: 1.25; min-width: 0; }
.tick label { display: flex; align-items: center; gap: 4px; min-width: 0; flex: 1; overflow: hidden; }
.tick label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tick input { margin: 0; }
.tick .field.num { width: 28px; min-width: 28px; height: 18px; padding: 0 2px; font-size: 11px; flex: 0 0 28px; }
.define-add { display: flex; align-items: center; gap: 4px; margin: 0 0 6px; }
.define-add .field { height: 24px; padding: 2px 6px; font-size: 12px; flex: 1; min-width: 0; }
.define-door-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 2px; }
.define-door-head h4 { margin: 0; }
.define-float table.grid.compact th,
.define-float table.grid.compact td { padding: 2px 4px; }
.define-float table.grid.compact .field { height: 22px; padding: 1px 4px; font-size: 11px; }
.define-foot {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    padding: 6px 8px;
    border-top: 1px solid var(--line);
    background: #f6f8fa;
    flex: 0 0 auto;
}
.define-resize {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 14px;
    height: 14px;
    cursor: nwse-resize;
    background:
        linear-gradient(135deg, transparent 0 55%, #8aa0b2 55% 62%, transparent 62% 72%, #8aa0b2 72% 79%, transparent 79%);
}

@media (max-width: 980px) {
    .workspace { grid-template-columns: 1fr; }
    .units-board {
        grid-template-columns: 1fr;
        grid-template-rows: 160px minmax(0, 1fr) 7px minmax(120px, var(--units-results, 32%));
    }
    .units-side { grid-row: 1; flex-direction: row; }
    .units-work { grid-column: 1; grid-row: 2; grid-template-columns: 1fr; }
    .units-board > .pane-split { grid-row: 3; }
    .units-results { grid-row: 4; }
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr 1fr; }
    .topbar { flex-direction: column; }
    .scale-pop { width: min(280px, calc(100vw - 40px)); }
}

/* === Global compact density (match measure left panel) === */
.units-side .pane-head,
.units-pane .pane-head {
    padding: 3px 6px;
    min-height: 26px;
}
.units-side .pane-head strong,
.units-pane .pane-head strong { font-size: 12px; }
.units-pane .pane-body {
    padding: 4px 6px 6px;
    font-size: 11px;
    line-height: 1.2;
}
.units-pane .pane-fields { padding: 3px 6px 4px; }
.units-pane .pane-fields label { margin: 2px 0 1px; font-size: 10px; }
.units-pane .pick-list { padding: 2px 4px 4px; }
.units-pane .pane-foot { padding: 4px 6px; }
.units-pane .pane-body h3 { margin: 0 0 4px; font-size: 12px; }
.units-pane table.grid th,
.units-pane table.grid td { padding: 2px 5px; font-size: 11px; }
.units-pane .open-add { margin-top: 4px; }
.units-results .tabs-lite { margin-bottom: 2px; }
.units-results-body { padding: 4px 6px; }

.pick {
    padding: 3px 6px;
    border-radius: var(--radius);
    font-size: 11px;
    line-height: 1.2;
}
.pick-list li { margin: 0 0 1px; }
.draw-tree .draw-folder { padding: 4px 6px 1px; font-size: 11px; }

tr.qty-section td {
    padding: 3px 6px !important;
    font-size: 10px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

table.grid .field,
table.grid select.field {
    height: 20px;
    padding: 0 4px;
    font-size: 11px;
    border-radius: var(--radius);
}

.btn.icon {
    width: 18px;
    height: 18px;
    min-width: 18px;
    padding: 0;
    border-radius: var(--radius);
    font-size: 13px;
    line-height: 1;
}

.info-page { padding: 8px 10px 10px; }
.info-page h2 { margin: 4px 0 4px; font-size: 14px; }
.info-page h3 { margin: 8px 0 4px; font-size: 12px; }
.info-edit-banner { flex: 0 0 auto; }
.info-edit-layout {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(260px, 0.9fr) minmax(340px, 1.2fr) minmax(300px, 1.15fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 8px;
    overflow: hidden;
}
.info-pane {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #f8fafc;
    padding: 6px 8px;
}
.info-pane-left {
    overflow-x: hidden;
    overflow-y: auto;
}
.info-pane-left .info-block {
    margin: 0 0 8px;
    padding: 6px 8px;
}
.info-pane-left .info-block:last-child { margin-bottom: 0; }
.info-pane-mid > .info-block-head,
.info-pane-right > .info-block-head {
    flex: 0 0 auto;
    margin-bottom: 6px;
}
.tower-stack {
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 2px;
}
.tower-stack .tower-card {
    flex: 0 0 auto;
}
.info-preview-scroll {
    flex: 1;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
}
.info-preview-track {
    display: inline-flex;
    align-items: flex-start;
    gap: 12px;
    width: max-content;
    min-width: 100%;
    min-height: min-content;
    padding-bottom: 4px;
}
.info-preview-track .typo-sheet {
    flex: 0 0 auto;
}
.tower-head {
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.tower-title-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.tower-name {
    width: 150px;
    max-width: 44vw;
}
.tower-copy-compact {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.tower-copy-compact .field {
    min-width: 130px;
    width: auto;
}
.tower-card { margin: 0; }
.info-counts {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
    max-width: none;
}
.info-add .field { max-width: 260px; }
.info-nav {
    flex: 0 0 auto;
    margin-top: 8px;
    padding-top: 8px;
}
.info-missing { flex: 0 0 auto; }

@media (max-width: 1100px) {
    .info-edit-layout {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(220px, 32%) minmax(260px, 36%) minmax(220px, 32%);
        overflow: auto;
    }
    .info-pane-left,
    .info-pane-mid,
    .info-pane-right {
        min-height: 220px;
    }
}
.info-lock-bar { margin-bottom: 6px; gap: 6px; }
.info-lock-bar strong { font-size: 12px; }
.info-lock-board { gap: 8px; }
.info-block.tight { margin: 0 0 6px; padding: 4px 6px; }

.directory .card { padding: 8px 10px; }
.directory h2 { font-size: 14px; }
.directory .card-head { gap: 8px; margin: 0 0 6px; }

.takeoff-card { padding: 6px; }
.takeoff-bar { gap: 4px 6px; margin-bottom: 4px; }
.takeoff-title { font-size: 12px; }

.summary-shell .main,
.info-shell .main,
.units-shell .main { padding: 6px 8px; }

table.summary thead tr:first-child th { height: 22px; }
table.summary thead tr:first-child th[rowspan] { height: 42px; }
table.summary thead tr:last-child:not(:first-child) th { top: 22px; height: 20px; }
table.summary th { font-size: 11px; }

.drag-slot,
.drag-grip {
    width: 14px;
    min-height: 18px;
    flex-basis: 14px;
    font-size: 11px;
}

.muted.tight { margin: 2px 0 4px; font-size: 10px; }
.empty { margin: 10px 0; font-size: 11px; }
.grid-2, .grid-3, .grid-4 { gap: 8px; }
.radio { font-size: 11px; margin: 3px 0; gap: 6px; }

.file-btn.btn { height: 20px; }
.units-pane .pane-body > .card { padding: 4px 0; margin: 0; border-radius: 0; box-shadow: none; }

.boq-board {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 0 14px minmax(0, 1fr);
    gap: 0;
    overflow: hidden;
    padding: 0;
    align-items: stretch;
}
.invoice-board {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}
.invoice-board .invoice-pane {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.invoice-board .boq-table-wrap {
    flex: 1;
    min-height: 0;
    background: #fff;
}
/* Invoice data area: clean white (override locked-pane / boq-locked mute) */
.invoice-pane.boq-edit-pane.is-locked,
.invoice-pane.boq-edit-pane.is-locked table.boq-edit tr.boq-item td,
.invoice-pane.boq-edit-pane.is-locked table.boq-edit tr.boq-desc td {
    background: #fff;
}
.invoice-edit td.invoice-desc-cell {
    white-space: normal;
    overflow: visible;
    vertical-align: top;
}
.invoice-edit .invoice-desc {
    display: block;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.35;
    font-size: 11px;
    padding: 1px 0;
    color: var(--navy);
}
table.invoice-edit.boq-edit {
    table-layout: fixed;
    min-width: 100%;
    background: #fff;
    color: var(--navy);
}
table.invoice-edit.boq-edit tbody tr,
table.invoice-edit.boq-edit tbody tr:nth-child(even),
table.invoice-edit.boq-edit tbody td {
    background: #fff;
}
table.invoice-edit.boq-edit tbody td {
    border-bottom: 1px solid #e6e6e6;
    border-right: 1px solid #ececec;
    color: var(--navy);
}
table.invoice-edit.boq-edit .boq-locked {
    background: #fff;
    color: var(--navy);
}
table.invoice-edit.boq-edit tr.boq-subhead td {
    background: #fff;
    color: var(--navy);
    font-weight: 700;
}
table.invoice-edit.boq-edit tr.boq-subtotal td,
table.invoice-edit.boq-edit tr.total td {
    background: #f7f7f7;
    color: var(--navy);
    border-bottom-color: #ddd;
}
table.invoice-edit.boq-edit td.invoice-proj {
    background: #fff;
}
table.invoice-edit.boq-edit thead th {
    position: sticky;
    z-index: 5;
    left: auto;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.2;
    vertical-align: middle;
    text-align: center;
    padding: 3px 6px 3px 4px;
    background: var(--navy);
    color: #fff;
    box-sizing: border-box;
}
table.invoice-edit.boq-edit thead tr:first-child th {
    top: 0;
    z-index: 6;
    height: 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.22);
}
table.invoice-edit.boq-edit thead tr:first-child th[rowspan] {
    height: 58px;
    vertical-align: middle;
    border-bottom: none;
    box-shadow: 0 1px 0 var(--navy);
}
table.invoice-edit.boq-edit thead tr:last-child:not(:first-child) th {
    top: 22px;
    z-index: 5;
    height: auto;
    min-height: 36px;
    vertical-align: middle;
    box-shadow: 0 1px 0 var(--navy);
}
table.invoice-edit.boq-edit thead th.num,
table.invoice-edit.boq-edit td.num {
    text-align: right;
}
table.invoice-edit.boq-edit thead th.num {
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.15;
}
table.invoice-edit.boq-edit td.num {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
    font-variant-numeric: tabular-nums;
}
table.invoice-edit.boq-edit thead th.serial {
    text-align: left;
    white-space: normal;
}
table.invoice-edit.boq-edit td.serial {
    white-space: nowrap;
    vertical-align: top;
    font-variant-numeric: tabular-nums;
}
table.invoice-edit.boq-edit thead th.inv-item {
    text-align: left;
    white-space: normal;
}
table.invoice-edit.boq-edit thead th.qty-group {
    text-align: center;
    letter-spacing: 0.04em;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.22);
    white-space: nowrap;
}
/* Continuous qty|amount separator (header + every body row) */
table.invoice-edit.boq-edit thead th.amt-break,
table.invoice-edit.boq-edit tbody td.amt-break {
    border-left: 3px solid #163045 !important;
    box-shadow: none;
}
table.invoice-edit.boq-edit thead th.amt-break {
    border-left-color: rgba(255, 255, 255, 0.65) !important;
}
table.invoice-edit.boq-edit tbody td.amt-break {
    position: static;
}
table.invoice-edit.boq-edit tbody td.amt-break::before {
    content: none;
    display: none;
}
table.invoice-edit.boq-edit th.inv-sticky,
table.invoice-edit.boq-edit td.inv-sticky,
table.invoice-edit.boq-edit .inv-sticky-last {
    position: static;
    left: auto;
    box-shadow: none;
}
.inv-dir {
    display: inline-block;
    width: 11px;
    height: 11px;
    margin: 0 6px 0 1px;
    vertical-align: -1px;
    flex: 0 0 auto;
}
.inv-dir-up {
    background: #e53935;
    clip-path: polygon(50% 4%, 96% 92%, 4% 92%);
}
.inv-dir-down {
    background: #43a047;
    clip-path: polygon(4% 8%, 96% 8%, 50% 96%);
}
.inv-dir-flat {
    background: #9e9e9e;
    clip-path: polygon(8% 4%, 96% 50%, 8% 96%);
}
.inv-serial-text {
    vertical-align: middle;
}
.invoice-pane.is-locked table.invoice-edit .boq-col-grip {
    display: block;
}
.boq-board.summary-open {
    grid-template-columns: minmax(220px, 0.75fr) 14px minmax(420px, 1.35fr);
}
.boq-board:not(.summary-open) .boq-summary-pane {
    visibility: hidden;
    pointer-events: none;
    overflow: hidden;
}
.boq-split {
    position: relative;
    width: 14px;
    background: #e8eef3;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.boq-split-toggle {
    width: 14px;
    height: 48px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: #fff;
    color: var(--navy);
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.boq-split-toggle:hover {
    background: #f4f7fa;
}
.boq-pane {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    overflow: hidden;
}
.boq-summary-pane {
    margin-right: 0;
}
.boq-edit-pane {
    margin-left: 0;
}
.boq-edit-pane.is-locked {
    background: #f6f8fa;
}
.boq-edit-pane.is-locked table.boq-edit tr.boq-item td {
    background: #f6f8fa;
}
.boq-edit-pane.is-locked table.boq-edit tr.boq-desc td {
    background: #f0f3f6;
}
.boq-edit-pane.is-locked td.boq-qty-drop-cell {
    background: #fff !important;
}
.boq-edit-pane .boq-ro-text {
    display: block;
    white-space: pre-wrap;
    padding: 2px 4px;
    font-size: 11px;
    line-height: 1.35;
}
.boq-pane-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    padding: 4px 6px;
    border-bottom: 1px solid var(--line);
    background: #f4f7fa;
}
.boq-pane-head strong {
    font-size: 12px;
    color: var(--navy);
}
.boq-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}
.boq-table-wrap {
    flex: 1;
    min-height: 0;
    overflow: auto;
}
table.boq-ref {
    border-collapse: separate;
    border-spacing: 0;
}
table.boq-ref thead th,
table.boq-edit thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--navy);
    color: #fff;
    box-shadow: 0 1px 0 var(--navy);
}
table.boq-edit {
    table-layout: fixed;
    width: max-content;
    min-width: 100%;
    /* separate keeps sticky thead reliable; collapse often lets headers scroll away */
    border-collapse: separate;
    border-spacing: 0;
}
table.boq-edit thead th {
    font-size: 10px;
    padding: 3px 6px 3px 4px;
    white-space: nowrap;
}
.boq-msg {
    margin: 2px 6px;
    font-size: 10px;
    line-height: 1.35;
}
.boq-spec {
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
    font-size: 11px;
}
table.boq-ref td,
table.boq-edit td {
    vertical-align: top;
    padding: 2px 4px;
}
table.boq-ref .serial,
table.boq-edit .serial,
table.boq-ref th.serial,
table.boq-edit th.serial {
    text-align: left;
}
table.boq-edit .boq-col-grip {
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
}
table.boq-edit .boq-col-grip:hover {
    background: rgba(255, 255, 255, 0.35);
}
table.boq-edit .stretch-field {
    width: 100%;
    min-width: 0;
    min-height: 1.45rem;
    height: auto;
    padding: 2px 4px;
    font-size: 11px;
    line-height: 1.35;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    resize: none;
    overflow: hidden;
    box-sizing: border-box;
}
table.boq-edit .serial-field {
    width: 100%;
    text-align: left;
    font-size: 11px;
    padding: 2px 4px;
}
table.boq-edit .uom-field {
    width: 100%;
    font-size: 11px;
    padding: 2px 3px;
}
/* Hide native datalist dropdown arrow — suggestions still work on click / type. */
table.boq-edit input.boq-uom-suggest {
    padding-right: 3px;
}
table.boq-edit input.boq-uom-suggest::-webkit-calendar-picker-indicator {
    display: none !important;
    -webkit-appearance: none;
    opacity: 0;
    width: 0;
    height: 0;
}
table.boq-edit input.boq-uom-suggest::-webkit-list-button {
    display: none !important;
    opacity: 0;
    width: 0;
}
table.boq-edit .boq-pick-col {
    text-align: center;
    width: 2rem;
    vertical-align: middle;
}
table.boq-edit tr.boq-selected td {
    background: #e8f0e0;
}
table.boq-edit tr.boq-subhead.boq-selected td,
table.boq-edit tr.boq-subtotal.boq-selected td {
    background: #dce8d0;
}
table.boq-edit .boq-head-col {
    text-align: center;
    width: 3.4rem;
}
table.boq-edit .boq-qty-cell {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
    width: 100%;
}
table.boq-edit .boq-loc-btn {
    font-size: 12px;
    line-height: 1;
    color: var(--navy);
    flex: 0 0 auto;
    padding: 0 2px;
    min-width: 0;
}
.boq-loc-backdrop {
    z-index: 40;
}
.boq-loc-modal {
    z-index: 50;
}
.boq-loc-modal .boq-loc-head {
    flex-wrap: nowrap;
    align-items: center;
}
.boq-loc-modal .boq-loc-total {
    flex: 0 0 auto;
    font-size: 13px;
    color: var(--navy);
    white-space: nowrap;
    max-width: 12rem;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: auto;
}
.boq-loc-modal .qty-layout-head h3 {
    display: none;
}
table.typo-sheet td.typo-common {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
table.typo-sheet td.typo-edit {
    padding: 1px 2px;
    min-width: 0;
    width: 4.2rem;
    max-width: 4.8rem;
}
table.typo-sheet.typo-edit-mode th:nth-child(n+3) {
    width: 4.2rem;
    max-width: 4.8rem;
    padding: 2px 3px;
    font-size: 10px;
}
table.typo-sheet td.typo-edit .field.num {
    width: 2.6rem;
    min-width: 2.4rem;
    max-width: 3rem;
    height: 20px;
    padding: 0 2px;
    text-align: right;
    font-size: 11px;
}
.typo-qty-edit {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    justify-content: flex-end;
    width: 100%;
}
.typo-qty-edit.locked .field.num {
    background: #eef3e6;
    color: var(--navy);
}
.typo-qty-edit.is-projected .field.num {
    background: #f7f4ec;
}
.typo-qty-edit.is-invoiced .field.num {
    background: #e5f0ea;
}
.typo-proj-badge {
    flex: 0 0 auto;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #8a6a28;
    background: #f3e8c8;
    border: 1px solid #e0c988;
    border-radius: 2px;
    padding: 1px 3px;
    white-space: nowrap;
    line-height: 1.2;
}
table.typo-sheet td.typo-forecast-invoiced {
    background: #d9ebe2 !important;
}
table.typo-sheet td.typo-forecast-projected {
    background: #f3e8c8 !important;
}
table.typo-sheet td.typo-forecast-empty {
    background: transparent;
}
.typo-forecast-val {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
    width: 100%;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}
.typo-forecast-val.typo-forecast-invoiced { color: #1f5c40; }
.typo-forecast-val.typo-forecast-projected { color: #8a6a28; }
.forecast-stack-body {
    display: flex;
    align-items: stretch;
    gap: 0;
    min-height: 0;
    flex: 1;
}
.forecast-stack-main {
    flex: 1;
    min-width: 0;
    overflow: auto;
}
.forecast-legend {
    flex: 0 0 148px;
    border-left: 1px solid var(--line);
    background: #f7f9fb;
    padding: 10px 12px;
    font-size: 11px;
    line-height: 1.35;
    color: var(--navy);
}
.forecast-legend strong {
    display: block;
    margin-bottom: 8px;
    font-size: 11px;
}
.forecast-legend-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
}
.forecast-swatch {
    width: 16px;
    height: 16px;
    border-radius: 2px;
    border: 1px solid var(--line);
    flex: 0 0 auto;
}
.forecast-swatch.invoiced { background: #d9ebe2; border-color: #9fc4b0; }
.forecast-swatch.projected { background: #f3e8c8; border-color: #e0c988; }
.forecast-swatch.empty { background: #fff; }
.forecast-legend .muted { color: var(--muted); font-size: 10px; }
.invoice-proj-panel {
    border-bottom: 1px solid var(--line);
    background: #f7f9fb;
    padding: 8px 10px;
    font-size: 11px;
}
.invoice-proj-panel .proj-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 6px;
}
.invoice-proj-panel label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 10px;
    color: var(--muted);
}
.invoice-proj-panel select {
    min-width: 10rem;
    font-size: 11px;
}
.invoice-proj-sources {
    max-height: 9rem;
    overflow: auto;
    border: 1px solid var(--line);
    background: #fff;
    margin-top: 6px;
}
.invoice-proj-sources button {
    display: flex;
    width: 100%;
    text-align: left;
    gap: 8px;
    padding: 5px 8px;
    border: 0;
    border-bottom: 1px solid #eef2f5;
    background: transparent;
    cursor: pointer;
    font-size: 11px;
}
.invoice-proj-sources button:hover,
.invoice-proj-sources button.is-on {
    background: #eef6f1;
}
.invoice-proj-sources .qty {
    margin-left: auto;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.invoice-proj-active {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.invoice-proj-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f3e8c8;
    border: 1px solid #e0c988;
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 10px;
    color: #8a6a28;
}
.invoice-edit td.invoice-proj {
    color: #8a6a28;
}
.typo-lock-tick {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    padding: 0;
    border: 1px solid var(--steel-light);
    border-radius: 2px;
    background: #fff;
    color: var(--muted);
    font-size: 10px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.typo-lock-tick:hover {
    border-color: var(--accent);
    color: var(--navy);
}
.typo-lock-tick.on {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    font-weight: 700;
}
.boq-edit-pane.is-locked table.boq-edit .boq-col-grip {
    display: block;
}
table.boq-edit .boq-locked {
    background: #eef1f3;
    color: #9aa4ad;
}
table.boq-edit tr.boq-subhead td {
    font-weight: 700;
    background: #e8eef3;
}
table.boq-edit tr.boq-subhead .stretch-field {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
table.boq-edit tr.boq-subtotal td {
    font-weight: 600;
    background: #dcdcdc;
}
table.invoice-edit.boq-edit tr.boq-subtotal td.num,
table.invoice-edit.boq-edit tr.total td.num {
    color: var(--navy);
    font-weight: 700;
}
table.boq-edit .boq-subtotal-label {
    display: block;
    padding: 2px 4px;
    font-size: 11px;
}
table.boq-edit tr.boq-desc td {
    background: #fafbfc;
}
table.boq-edit tr.boq-item td {
    background: #fff;
}
table.boq-edit .boq-item-cell {
    white-space: normal;
}
table.boq-edit td.num .field {
    font-size: 11px;
}
.boq-summary-pane button.boq-qty-pick {
    cursor: grab;
    font: inherit;
    font-weight: 600;
    color: #1f4e79;
    background: #eef5fc;
    border: 1px solid #b7d0ea;
    padding: 2px 6px;
    border-radius: 3px;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.boq-summary-pane button.boq-qty-pick:hover {
    color: #0f2f4d;
    background: #dceafc;
    border-color: #2f6fed;
}
.boq-summary-pane button.boq-qty-pick.qty-selected {
    background: #c5dbf7;
    border-color: #2f6fed;
    box-shadow: inset 0 0 0 1px #2f6fed;
}
.boq-summary-pane button.boq-qty-pick.qty-dragging {
    opacity: 0.55;
    cursor: grabbing;
}
table.boq-edit td.boq-qty-drop-cell {
    min-width: 4.5rem;
    transition: background 0.12s ease;
}
table.boq-edit td.boq-qty-drop-cell.drop-over {
    background: #e8f2ff;
    box-shadow: inset 0 0 0 2px #2f6fed;
}
table.boq-edit .boq-qty-empty {
    display: inline-block;
    min-width: 2rem;
    text-align: right;
}
table.boq-edit button.qty-link {
    cursor: pointer;
    font: inherit;
    color: var(--navy);
    background: transparent;
    border: 0;
    padding: 2px 4px;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.boq-link-backdrop {
    z-index: 1200;
}
.boq-link-modal {
    width: min(420px, 92vw);
    max-height: min(70vh, 520px);
    overflow: auto;
}
.boq-link-modal .boq-link-actions {
    display: flex;
    gap: 8px;
    margin: 8px 0 12px;
}
.boq-link-modal p.tight {
    margin: 4px 0 0;
    font-size: 12px;
}
@media (max-width: 1100px) {
    .boq-board {
        grid-template-columns: 1fr;
        grid-template-rows: 0 14px minmax(0, 1fr);
    }
    .boq-board.summary-open {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(140px, 0.32fr) 14px minmax(0, 1fr);
    }
    .boq-split {
        width: 100%;
        height: 14px;
        border-left: none;
        border-right: none;
        border-top: 1px solid var(--line);
        border-bottom: 1px solid var(--line);
    }
    .boq-split-toggle {
        width: 48px;
        height: 14px;
    }
    .boq-board:not(.summary-open) .boq-split-toggle::before {
        content: none;
    }
}

.str-building-tabs {
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.str-typical-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 8px 0 12px;
}
.str-typical-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    padding: 6px 8px;
    border: 1px solid var(--line);
    background: #fff;
}
.str-typical-row strong {
    min-width: 4.5rem;
}
.str-floor-pick-backdrop {
    z-index: 80;
}
.str-floor-pick.modal {
    width: min(440px, 92vw);
    max-height: min(72vh, 560px);
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}
.str-floor-pick .qty-layout-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--navy);
    color: #fff;
    flex: 0 0 auto;
}
.str-floor-pick .qty-layout-head h3 {
    margin: 0;
    flex: 1;
    font-size: 12px;
    color: #fff;
}
.str-floor-pick .define-body {
    overflow: auto;
    flex: 1;
    min-height: 0;
    padding: 10px 12px;
}
.str-floor-pick .define-foot {
    border-top: 1px solid var(--line);
}
.str-zoning-block {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}
.str-zoning-toggle {
    font-weight: 600;
}
.str-zone-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 8px 0;
}
.str-zone-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.str-zone-row .field {
    flex: 1;
    min-width: 0;
}
.structure-units-board {
    min-height: 0;
    flex: 1;
}
.structure-units-board .units-side .units-pane {
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.structure-host-work {
    grid-template-columns: minmax(0, 1fr) !important;
}
.str-summary-page {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 0;
    height: 100%;
}
.str-summary-titlebar {
    margin: 0;
    padding: 0;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--navy, #163045);
}
.units-shell .main:has(.str-summary-page),
.summary-shell .main:has(.str-summary-page) {
    padding-top: 2px;
    padding-bottom: 4px;
}
.str-host-list .str-host-pick {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    text-align: left;
}
.str-host-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.str-host-mult {
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 700;
    color: var(--navy, #163045);
    background: #e8eef3;
    padding: 1px 6px;
    border-radius: 3px;
}
.str-host-pick.active .str-host-mult {
    background: rgba(255, 255, 255, 0.22);
    color: inherit;
}
.str-side-kpi {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin-top: auto;
    padding: 5px 8px;
    border-top: 1px solid var(--line);
    background: #eef5fb;
    font-size: 11px;
    color: #445;
}
.str-side-kpi b {
    color: var(--navy, #163045);
}
.str-dual-panels {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 6px;
    align-items: stretch;
    min-height: 0;
    height: 100%;
}
.str-dual-arrow {
    align-self: center;
    font-size: 18px;
    font-weight: 700;
    color: var(--navy, #163045);
    opacity: 0.4;
    padding: 0 1px;
}
.str-qty-panel {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    background: #fff;
    overflow: hidden;
}
.str-qty-panel-head {
    flex: 0 0 auto;
    padding: 5px 8px;
    background: var(--navy, #163045);
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}
.str-qty-panel-head strong {
    font-size: 11px;
    letter-spacing: 0.02em;
}
.str-qty-panel-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 0;
    background: #fff;
}
table.str-qty-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    font-size: 11px;
    margin: 0;
}
table.str-qty-table thead th {
    background: var(--navy, #163045);
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
    padding: 4px 7px;
    line-height: 1.25;
    border: none;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: none;
}
table.str-qty-table thead th:last-child {
    border-right: none;
}
table.str-qty-table thead tr:first-child th {
    position: sticky;
    top: 0;
    z-index: 3;
}
table.str-qty-table thead tr:last-child:not(:first-child) th {
    position: sticky;
    top: 22px;
    z-index: 2;
}
table.str-qty-table thead th.concrete-group {
    text-align: center;
    letter-spacing: 0.03em;
}
table.str-qty-table tbody td {
    padding: 3px 7px;
    border-bottom: 1px solid #e6ebf0;
    border-right: 1px solid #eef1f4;
    white-space: nowrap;
    background: #fff;
}
table.str-qty-table tbody td:last-child {
    border-right: none;
}
table.str-qty-table tbody tr:nth-child(even) td { background: #f7f9fb; }
table.str-qty-table tbody tr.total td {
    font-weight: 700;
    background: #eef2f6;
    border-top: 1px solid var(--line);
}
table.str-qty-table td.num,
table.str-qty-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.str-qty-table th.show-col,
table.str-qty-table td.show-cell {
    width: 26px;
    text-align: center;
    padding-left: 3px;
    padding-right: 3px;
}
.str-project-pane {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0 !important;
    overflow: hidden;
}
.str-project-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px 12px;
    margin: 0;
    padding: 4px 8px;
    background: var(--navy, #163045);
    color: #fff;
    flex: 0 0 auto;
}
.str-project-bar strong {
    font-size: 11px;
}
.str-project-kpis {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.88);
}
.str-project-kpis b {
    color: #fff;
    font-weight: 700;
    margin-right: 2px;
}
.str-project-pane .units-results-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 0 !important;
    margin: 0;
}
.str-project-pane .str-qty-panel {
    border: none;
    border-radius: 0;
}
@media (max-width: 1100px) {
    .str-dual-panels {
        grid-template-columns: 1fr;
    }
    .str-dual-arrow { display: none; }
}



