/* HVAC lab workspace. Uses the site's tokens; adds the trade's air colours
   (red supply, blue return, green exhaust). Every class starts with hv- so
   nothing here touches the rest of the site. */
.hvac-lab-page { max-width: none; }
.hv {
    --hv-supply: #d63a2f; --hv-return: #1f6fd1; --hv-exhaust: #1f8a46; --hv-retex: #12839b;
    --hv-equip: #7a4cc2; --hv-unknown: #7b8a8e; --hv-measure: #c47600; --hv-paper: #ffffff; --hv-stage: #dfe6e8;
    --hv-shadow: 0 8px 24px rgb(11 18 20 / .12);
    font-family: var(--font-family-sans);
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .hv {
        --hv-supply: #ef5b4f; --hv-return: #4b93ee; --hv-exhaust: #33a862; --hv-retex: #2bb3c9;
        --hv-equip: #a27be0; --hv-unknown: #8fa0a4; --hv-measure: #f5a524; --hv-stage: #172326;
        --hv-shadow: 0 8px 24px rgb(0 0 0 / .45);
    }
}
[data-theme="dark"] .hv {
    --hv-supply: #ef5b4f; --hv-return: #4b93ee; --hv-exhaust: #33a862; --hv-retex: #2bb3c9;
    --hv-equip: #a27be0; --hv-unknown: #8fa0a4; --hv-measure: #f5a524; --hv-stage: #172326;
    --hv-shadow: 0 8px 24px rgb(0 0 0 / .45);
}
.hv [hidden] { display: none !important; }
.hv-c-supply { --k: var(--hv-supply); } .hv-c-return { --k: var(--hv-return); } .hv-c-exhaust { --k: var(--hv-exhaust); }
.hv-c-retex { --k: var(--hv-retex); } .hv-c-equipment { --k: var(--hv-equip); } .hv-c-unknown { --k: var(--hv-unknown); }
.hv-c-fit { --k: var(--color-text-muted); } .hv-c-measure { --k: var(--hv-measure); } .hv-c-review { --k: var(--color-status-review); } .hv-c-ink { --k: var(--color-text); }
.hv-c-action { --k: var(--color-action); }
.hv-sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex: none; background: var(--k); vertical-align: -1px; }

/* start */
.hv-start { display: grid; gap: var(--space-4); max-width: 46rem; margin: var(--space-6) auto; }
.hv-drop { display: grid; justify-items: center; gap: var(--space-2); padding: var(--space-10) var(--space-6); text-align: center;
    border: 2px dashed var(--color-border-strong); border-radius: var(--radius-lg); background: var(--color-surface); cursor: pointer; }
.hv-drop.is-over { border-color: var(--color-action); background: var(--color-action-soft); }
.hv-drop svg { width: 2rem; height: 2rem; fill: none; stroke: var(--color-action); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hv-drop__title { font-size: var(--font-size-lg); font-weight: 700; }
.hv-drop__hint { color: var(--color-text-muted); font-size: var(--font-size-sm); }
.hv-drop input { max-width: 100%; }
.hv-start__or { text-align: center; margin: 0; }
.hv-start__or .button { width: auto; }
.hv-status { color: var(--color-text-muted); min-height: 1.5em; text-align: center; margin: 0; }
.hv-status.is-error { color: var(--color-status-suspicious); }

/* shell */
.hv-app { border: 1px solid var(--color-border); border-radius: var(--radius-lg); overflow: hidden; background: var(--color-surface); }
.hv-bar { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--color-border); }
.hv-file { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex: 1; white-space: nowrap; }
.hv-file b { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hv-file__meta { color: var(--color-text-muted); font-size: var(--font-size-sm); overflow: hidden; text-overflow: ellipsis; }
.hv-bar__actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.hv-bar { position: relative; }
.hv-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--color-border);
    background: var(--color-surface); color: var(--color-text); cursor: pointer; font: inherit; font-size: var(--font-size-sm); white-space: nowrap; }
.hv-btn:hover { border-color: var(--color-border-strong); }
.hv-btn--primary { background: var(--color-action); border-color: var(--color-action); color: var(--color-text-on-action); font-weight: 700; }
.hv-btn--primary:hover { background: var(--color-action-hover); }
.hv-btn:disabled { opacity: .55; cursor: progress; }
.hv-work { display: grid; grid-template-columns: 210px minmax(0, 1fr) 340px; height: max(560px, calc(100vh - 13rem)); }
.hv-rail, .hv-panel { overflow-y: auto; min-height: 0; background: var(--color-surface); }
.hv-rail { border-right: 1px solid var(--color-border); padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-5); }
.hv-panel { border-left: 1px solid var(--color-border); display: flex; flex-direction: column; }
.hv-label { font-size: var(--font-size-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--color-text-muted); margin: 0 0 var(--space-2); }
.hv-muted { color: var(--color-text-muted); font-size: var(--font-size-sm); }
.hv-thumbs { display: flex; flex-direction: column; gap: var(--space-2); }
.hv-thumb { border: 1px solid var(--color-border); border-radius: 8px; padding: 6px; background: var(--color-surface); cursor: pointer; text-align: left; color: var(--color-text); font: inherit; }
.hv-thumb[aria-current="true"] { border-color: var(--color-action); box-shadow: 0 0 0 2px var(--color-action-soft); }
.hv-thumb img { display: block; width: 100%; border-radius: 4px; background: var(--hv-paper); }
.hv-thumb__row { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: var(--font-size-xs); }
.hv-thumb__row b { font-family: var(--font-family-mono); }
.hv-thumb__row span { color: var(--color-text-muted); margin-left: auto; }
.hv-layers { display: flex; flex-direction: column; gap: 2px; }
.hv-layer { display: flex; align-items: center; gap: 8px; padding: 4px; border-radius: 6px; cursor: pointer; font-size: var(--font-size-sm); }
.hv-layer:hover { background: var(--color-surface-subtle); }
.hv-layer .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.hv-layer .n { margin-left: auto; color: var(--color-text-muted); font: var(--font-size-xs) var(--font-family-mono); }

/* drawing */
.hv-center { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-height: 0; min-width: 0; }
.hv-stage { position: relative; overflow: hidden; background: var(--hv-stage); min-height: 0; touch-action: none; }
.hv-stage.is-pan, .hv-stage.is-pan * { cursor: grab; }
.hv-stage.is-dragging, .hv-stage.is-dragging * { cursor: grabbing !important; }
.hv-stage.is-cross { cursor: crosshair; }
.hv-sheet { position: absolute; left: 0; top: 0; transform-origin: 0 0; box-shadow: 0 2px 18px rgb(11 18 20 / .25); background: var(--hv-paper); }
.hv-sheet img { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }
.hv-sheet svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.hv-stage.is-hot { cursor: pointer; }
.hv-mark { stroke: var(--k); fill: var(--k); }
.hv-line { stroke: var(--k); fill: none; stroke-linecap: round; stroke-linejoin: round; }
.hv-ring { stroke: var(--k); fill: none; }
.hv-label-text { fill: var(--color-text); stroke: var(--hv-paper); paint-order: stroke; font-family: var(--font-family-mono); font-weight: 700; }
.hv-dot { fill: var(--hv-paper); stroke: var(--k); }
.hv-toolbar { position: absolute; left: 10px; top: 10px; right: 10px; display: flex; flex-wrap: wrap; gap: 8px; pointer-events: none; }
.hv-tools, .hv-zoom, .hv-sub { pointer-events: auto; display: flex; align-items: center; gap: 2px; padding: 4px; background: var(--color-surface);
    border: 1px solid var(--color-border); border-radius: 10px; box-shadow: var(--hv-shadow); }
.hv-tool { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 9px; border: 0; border-radius: 7px; background: transparent;
    color: var(--color-text); cursor: pointer; font: inherit; font-size: var(--font-size-sm); }
.hv-tool svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hv-tool:hover { background: var(--color-surface-subtle); }
.hv-tool[aria-pressed="true"] { background: var(--color-text); color: var(--color-surface); }
.hv-tool kbd { font: 10px var(--font-family-mono); color: var(--color-text-muted); }
.hv-tool[aria-pressed="true"] kbd { color: var(--color-border); }
.hv-zoom { margin-left: auto; }
.hv-zoom output { font: var(--font-size-xs) var(--font-family-mono); min-width: 48px; text-align: center; }
.hv-sub { gap: 8px; padding: 4px 8px; font-size: var(--font-size-sm); flex-wrap: wrap; }
.hv-sub select, .hv-sub input, .hv-fields input, .hv-fields select, .hv-feet input {
    height: 30px; border: 1px solid var(--color-border); border-radius: 7px; padding: 0 8px; background: var(--color-surface); color: var(--color-text); font: inherit; font-size: var(--font-size-sm); min-width: 0; }
.hv-sub input { width: 90px; font-family: var(--font-family-mono); }
.hv-pick { display: flex; gap: 4px; flex-wrap: wrap; }
.hv-pick button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 9px; border-radius: 7px; border: 1px solid var(--color-border);
    background: var(--color-surface); color: var(--color-text); cursor: pointer; font: inherit; font-size: var(--font-size-xs); }
.hv-pick button[aria-pressed="true"] { border-color: var(--color-text); box-shadow: inset 0 0 0 1px var(--color-text); }
.hv-scale { position: absolute; left: 10px; bottom: 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 10px;
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 10px; box-shadow: var(--hv-shadow); font-size: var(--font-size-sm); max-width: calc(100% - 20px); }
.hv-scale b { font-family: var(--font-family-mono); }
.hv-scale.is-warn { border-color: var(--color-status-review); background: var(--color-status-review-surface); }
.hv-hint { position: absolute; right: 10px; bottom: 10px; max-width: min(420px, 55%); padding: 7px 12px 7px 30px; border-radius: 10px;
    background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border); box-shadow: var(--hv-shadow); font-size: var(--font-size-sm); line-height: 1.4; }
.hv-hint::before { content: "i"; position: absolute; left: 10px; top: 8px; width: 14px; height: 14px; border-radius: 50%; background: var(--color-action);
    color: var(--color-text-on-action); font: 700 10px/14px var(--font-family-sans); text-align: center; }
.hv-stage:has(.hv-ins:not([hidden])) .hv-hint { display: none; }
.hv-hint { display: flex; align-items: flex-start; gap: 8px; }
/* notes sit above the scale box, whatever the screen: on tablets they would otherwise cover its buttons */
@media (max-width: 1365px) { .hv-hint { bottom: calc(var(--hv-scale-h, 40px) + 18px); } }
.hv-hint[hidden] { display: none; }
.hv-hint__x { flex: none; margin: -3px -6px -3px 0; width: 24px; height: 24px; border: 0; border-radius: 6px; background: none; color: var(--color-text-muted);
    font: inherit; font-size: 18px; line-height: 1; cursor: pointer; }
.hv-hint__x:hover { background: var(--color-surface-muted); color: var(--color-text); }
.hv-card { position: absolute; left: 50%; top: 64px; transform: translateX(-50%); width: min(360px, calc(100% - 24px)); background: var(--color-surface);
    border: 1px solid var(--color-border); border-radius: 12px; box-shadow: var(--hv-shadow); padding: var(--space-4); display: grid; gap: var(--space-3); }
.hv-card h3 { margin: 0; font-size: var(--font-size-md); }
.hv-card p { margin: 0; color: var(--color-text-muted); font-size: var(--font-size-sm); }
.hv-feet { display: flex; gap: 8px; align-items: center; }
.hv-feet input { width: 80px; font-family: var(--font-family-mono); }
.hv-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* table */
.hv-table { background: var(--color-surface); border-top: 1px solid var(--color-border); min-width: 0; }
.hv-table__bar { display: flex; align-items: center; gap: 10px; padding: 3px 8px; border-bottom: 1px solid var(--color-border); }
.hv-table__wrap { height: var(--hv-table-h, 150px); overflow: auto; }
.hv-table__grip { height: 7px; margin-top: -4px; position: relative; cursor: row-resize; touch-action: none; }
.hv-table__grip::after { content: ""; position: absolute; left: 50%; top: 2px; width: 44px; height: 3px; margin-left: -22px; border-radius: 2px; background: var(--color-border-strong); opacity: .7; }
.hv-table__grip:hover::after, .hv-table__grip:focus-visible::after { background: var(--color-action); opacity: 1; }
.hv-table.is-closed .hv-table__grip { display: none; }
.hv-table.is-closed .hv-table__wrap { display: none; }
.hv-grid { width: 100%; border-collapse: collapse; font-size: var(--font-size-xs); }
.hv-grid th { position: sticky; top: 0; background: var(--color-surface-subtle); text-align: left; font-weight: 700; color: var(--color-text-muted);
    padding: 5px 10px; border-bottom: 1px solid var(--color-border); white-space: nowrap; }
.hv-grid td { padding: 4px 10px; border-bottom: 1px solid var(--color-border); white-space: nowrap; }
.hv-grid .num { text-align: right; font-family: var(--font-family-mono); font-variant-numeric: tabular-nums; }
.hv-grid tr.hv-grp td { font-weight: 700; }
.hv-grid tr.hv-item { cursor: pointer; }
.hv-grid tr.hv-item td:first-child { padding-left: 28px; }
.hv-grid tr.hv-item:hover td { background: var(--color-surface-subtle); }
.hv-grid tr.hv-item[aria-current="true"] td { background: var(--color-action-soft); }
.hv-grid tr.is-off td { color: var(--color-text-muted); text-decoration: line-through; }

/* panel */
.hv-summary { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-border); display: grid; gap: var(--space-3); }
.hv-sumhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hv-sumhead .hv-label { margin: 0; }
.hv-scope { display: inline-flex; border: 1px solid var(--color-border); border-radius: 8px; overflow: hidden; }
.hv-scope button { border: 0; background: var(--color-surface); color: var(--color-text-muted); padding: 4px 10px; font: inherit; font-size: var(--font-size-xs); cursor: pointer; }
.hv-scope button[aria-pressed="true"] { background: var(--color-text); color: var(--color-surface); }
.hv-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.hv-stat { padding: 8px; border-radius: 8px; background: var(--color-surface-subtle); }
.hv-stat i { display: block; height: 3px; border-radius: 2px; margin-bottom: 6px; background: var(--k); }
.hv-stat b { display: block; font: 700 20px/1.1 var(--font-family-mono); }
.hv-stat span { font-size: 11px; color: var(--color-text-muted); }
.hv-duct { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.hv-duct b { font: 700 18px var(--font-family-mono); }
.hv-bars { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--color-surface-subtle); }
.hv-bars span { display: block; height: 100%; background: var(--k); }
.hv-tabs { display: flex; gap: 2px; padding: 6px 10px 0; border-bottom: 1px solid var(--color-border); }
.hv-tab { border: 0; background: none; padding: 8px 10px; border-bottom: 2px solid transparent; cursor: pointer; color: var(--color-text-muted); font: inherit; font-weight: 600; font-size: var(--font-size-sm); }
.hv-tab[aria-selected="true"] { color: var(--color-text); border-bottom-color: var(--color-action); }
.hv-list { padding: 6px 6px 14px; display: flex; flex-direction: column; }
.hv-group > button { width: 100%; display: flex; align-items: center; gap: 8px; padding: 7px 8px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; color: var(--color-text); font: inherit; font-size: var(--font-size-sm); }
.hv-group > button:hover { background: var(--color-surface-subtle); }
.hv-group .q { margin-left: auto; font: 700 var(--font-size-xs) var(--font-family-mono); }
.hv-caret { width: 12px; height: 12px; transition: transform .15s; color: var(--color-text-muted); fill: none; stroke: currentColor; stroke-width: 1.6; }
.hv-group.is-open .hv-caret { transform: rotate(90deg); }
.hv-items { padding: 0 0 6px 28px; display: none; }
.hv-group.is-open .hv-items { display: block; }
.hv-it { display: flex; align-items: center; gap: 8px; width: 100%; padding: 4px 8px; border: 0; background: none; border-radius: 6px; cursor: pointer; text-align: left; color: var(--color-text); font: inherit; font-size: var(--font-size-sm); }
.hv-it:hover { background: var(--color-surface-subtle); }
.hv-it[aria-current="true"] { background: var(--color-action-soft); }
.hv-it .t { font-family: var(--font-family-mono); font-size: var(--font-size-xs); }
.hv-it .m { margin-left: auto; color: var(--color-text-muted); font: var(--font-size-xs) var(--font-family-mono); }
.hv-pill { font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--color-border); color: var(--color-text-muted); white-space: nowrap; }
.hv-pill--hand { border-color: var(--color-action); color: var(--color-action); }
.hv-pill--check { border-color: var(--color-status-review); color: var(--color-status-review); background: var(--color-status-review-surface); }
.hv-pill--off { text-decoration: line-through; }
.hv-pill--legend { border-color: var(--hv-equip); color: var(--hv-equip); }
.hv-empty { color: var(--color-text-muted); font-size: var(--font-size-sm); padding: 10px 8px; margin: 0; }
.hv-notes { display: grid; gap: 6px; }
.hv-note { margin: 0; font-size: var(--font-size-xs); padding: 6px 8px; border-radius: 6px; background: var(--color-status-review-surface); color: var(--color-status-review); }
.hv-detail { border-top: 1px solid var(--color-border); padding: var(--space-3) var(--space-4); display: grid; gap: 10px; margin-top: auto; background: var(--color-surface); }
.hv-detail h3 { margin: 0; font-size: var(--font-size-md); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hv-fields { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 6px 10px; align-items: center; font-size: var(--font-size-sm); }
.hv-fields label { color: var(--color-text-muted); }
.hv-ev { margin: 0; padding-left: 18px; font-size: var(--font-size-xs); color: var(--color-text-muted); }
.hv-ev--warn { color: var(--color-status-review); }

/* selected item */
.hv-ins { position: absolute; left: 10px; top: 58px; z-index: 3; width: 336px; max-height: calc(100% - 70px); overflow: auto; display: grid; gap: 8px;
    padding: 12px 14px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 12px; box-shadow: var(--hv-shadow); font-size: var(--font-size-sm); }
.hv-ins__head { display: flex; align-items: center; gap: 8px; }
.hv-ins__head h3 { margin: 0; font-size: var(--font-size-md); line-height: 1.3; flex: 1; min-width: 0; overflow-wrap: break-word; }
.hv-ins__x { width: 28px; height: 28px; border: 0; border-radius: 6px; background: none; color: var(--color-text-muted); font: 20px/1 var(--font-family-sans); cursor: pointer; flex: none; }
.hv-ins__x:hover { background: var(--color-surface-subtle); color: var(--color-text); }
.hv-ins__num { font-family: var(--font-family-mono); }
.hv-seg { display: inline-flex; justify-self: start; border: 1px solid var(--color-border); border-radius: 8px; overflow: hidden; }
.hv-seg button { border: 0; background: var(--color-surface); color: var(--color-text-muted); padding: 4px 10px; font: inherit; font-size: var(--font-size-xs); cursor: pointer; }
.hv-seg button[aria-pressed="true"] { background: var(--color-text); color: var(--color-surface); }
.hv-ins .hv-fields { gap: 4px 10px; }
.hv-ins .hv-fields input, .hv-ins .hv-fields select, .hv-ins .hv-fields textarea { width: 100%; }
.hv-ins .hv-fields input, .hv-ins .hv-fields select { height: 28px; }
.hv-fields textarea { border: 1px solid var(--color-border); border-radius: 7px; padding: 6px 8px; background: var(--color-surface); color: var(--color-text);
    font: inherit; font-size: var(--font-size-sm); resize: vertical; min-height: 34px; }
.hv-ins input[aria-invalid="true"], .hv-list input[aria-invalid="true"] { border-color: var(--color-status-suspicious); color: var(--color-status-suspicious); }
.hv-unit { display: flex; align-items: center; gap: 6px; }
.hv-unit input { flex: 1; font-family: var(--font-family-mono); }
.hv-unit span { color: var(--color-text-muted); font-size: var(--font-size-xs); }
.hv-was, .hv-hintline { grid-column: 1 / -1; margin: -2px 0 2px; font-size: var(--font-size-xs); color: var(--color-text-muted); }
.hv-was { color: var(--color-action); }
.hv-hintline--warn { color: var(--color-status-review); margin: 0; }
.hv-link { border: 0; background: none; padding: 0; color: var(--color-action); text-decoration: underline; cursor: pointer; font: inherit; }
.hv-err { margin: 0; font-size: var(--font-size-xs); color: var(--color-status-suspicious); }
.hv-why summary { cursor: pointer; font-size: var(--font-size-xs); color: var(--color-text-muted); }
.hv-why[open] summary { margin-bottom: 6px; }
.hv-cost { display: grid; gap: 6px; padding-top: 8px; border-top: 1px solid var(--color-border); }
.hv-cost__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hv-cost__head .hv-label { margin: 0; }
.hv-check { display: inline-flex; align-items: center; gap: 6px; font-size: var(--font-size-xs); color: var(--color-text-muted); cursor: pointer; }
.hv-rates { display: grid; grid-template-columns: 62px minmax(0, 1fr) minmax(0, 1fr); gap: 2px 6px; align-items: center; }
.hv-rates label { color: var(--color-text-muted); font-size: var(--font-size-xs); }
.hv-rates select, .hv-price__row select { height: 30px; border: 1px solid var(--color-border); border-radius: 7px; padding: 0 6px; background: var(--color-surface);
    color: var(--color-text); font: inherit; font-size: var(--font-size-sm); }
.hv-money { display: flex; align-items: center; gap: 4px; height: 30px; padding: 0 8px; border: 1px solid var(--color-border); border-radius: 7px; background: var(--color-surface); min-width: 0; }
.hv-money:focus-within { outline: 2px solid var(--color-focus); outline-offset: 1px; }
.hv-money input { flex: 1; min-width: 0; height: 28px; border: 0; padding: 0; background: transparent; color: var(--color-text); font: var(--font-size-sm) var(--font-family-mono); outline: none; }
.hv-money span { color: var(--color-text-muted); font-size: var(--font-size-xs); }
.hv-cost__out { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; margin: 0; }
.hv-cost__out dt { color: var(--color-text-muted); }
.hv-cost__out dd { margin: 0; text-align: right; font-family: var(--font-family-mono); font-variant-numeric: tabular-nums; }
.hv-cost__total { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--color-action-soft); }
.hv-cost__total span { font-size: var(--font-size-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.hv-cost__total b { font: 700 20px var(--font-family-mono); font-variant-numeric: tabular-nums; }
.hv-btn--danger { color: var(--color-status-suspicious); }
.hv-btn--icon { width: 34px; padding: 0; justify-content: center; }
.hv-btn--icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hv-undo { display: inline-flex; gap: 2px; }
.hv-dirty { display: inline-flex; align-items: center; gap: 5px; flex: none; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
    color: var(--color-status-review); background: var(--color-status-review-surface); }
.hv-dirty::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.hv-pill--edit { border-color: var(--color-action); color: var(--color-action); background: var(--color-action-soft); }
.hv-shapes { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 6px 0 0; font-size: var(--font-size-xs); color: var(--color-text-muted); }
.hv-shapes b, .hv-est__split b { font-family: var(--font-family-mono); color: var(--color-text); }
.hv-est { display: grid; gap: 6px; }
.hv-est__split { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: var(--font-size-xs); color: var(--color-text-muted); }
.hv-est__left { margin: 0; font-size: var(--font-size-xs); color: var(--color-text-muted); }
.hv-price { padding: 8px; border-bottom: 1px solid var(--color-border); display: grid; gap: 6px; }
.hv-price__head { display: flex; align-items: center; gap: 8px; font-size: var(--font-size-sm); }
.hv-price__head .hv-muted { margin-left: auto; font-size: var(--font-size-xs); white-space: nowrap; }
.hv-price__row { display: grid; grid-template-columns: 62px minmax(0, 1fr) minmax(0, 1fr); gap: 6px; }
.hv-price__out { display: flex; justify-content: space-between; gap: 8px; font: var(--font-size-xs) var(--font-family-mono); color: var(--color-text-muted); }
.hv-price__out b { color: var(--color-text); }
.hv-empty--tight { padding-top: 4px; }
.hv-start__or { display: flex; gap: var(--space-3); justify-content: center; flex-wrap: wrap; }

/* dashboard: on a desktop-sized window the open workspace fills the window
   below the site menu, and only its own panels scroll */
@media (min-width: 761px) and (min-height: 500px) {
    body.hv-body.hv-open { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
    body.hv-body.hv-open { padding-top: 0; padding-bottom: 0; }
    body.hv-body.hv-open > .app-header { flex: none; margin: 8px auto 0; width: calc(100% - 24px); max-width: none; }
    body.hv-body.hv-open .app-header__bar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-4); padding: 6px var(--space-4); }
    body.hv-body.hv-open .app-header__bar > .site-nav { grid-column: 2; grid-row: 1; justify-content: center; }
    body.hv-body.hv-open .app-header__bar > .app-header__utilities { grid-column: 3; grid-row: 1; }
    body.hv-body.hv-open .privacy-signal { display: none; }
    body.hv-body.hv-open > .app-header .page-heading, body.hv-body.hv-open > .site-footer { display: none; }
    body.hv-body.hv-open > main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; max-width: none; margin: 0; padding: 8px 12px 12px; }
    body.hv-body.hv-open > main:focus { outline: none; }
    body.hv-body.hv-open .hv { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
    body.hv-body.hv-open .hv-app { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
    body.hv-body.hv-open .hv-work { flex: 1 1 auto; height: auto; min-height: 0; }
}


/* scanning */
.hv-drop.is-busy { opacity: .5; pointer-events: none; }
.hv-progress { display: grid; gap: var(--space-2); padding: var(--space-4) var(--space-5); border: 1px solid var(--color-border); border-radius: var(--radius-lg);
    background: var(--color-surface); box-shadow: var(--shadow-sm); }
.hv-progress__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); }
.hv-progress__head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.hv-progress__time { font: var(--font-size-sm) var(--font-family-mono); color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.hv-progress__bar { position: relative; height: 10px; border-radius: 5px; overflow: hidden; background: var(--color-surface-subtle); }
.hv-progress__bar span { display: block; height: 100%; width: 2%; border-radius: 5px; background: var(--color-action); transition: width .4s ease; }
.hv-progress__bar.is-unknown span { width: 30% !important; animation: hv-slide 1.4s ease-in-out infinite; }
@keyframes hv-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }
.hv-progress__msg { margin: 0; font-weight: 600; }
.hv-progress__detail, .hv-progress__note { margin: 0; font-size: var(--font-size-sm); color: var(--color-text-muted); }
.hv-progress .hv-btn { justify-self: start; }

/* picked and hovered items */
.hv-halo { fill: none; stroke: var(--color-action); stroke-opacity: .35; stroke-linecap: round; stroke-linejoin: round; animation: hv-pulse 1.6s ease-in-out infinite; }
.hv-selline { fill: none; stroke: var(--color-action); stroke-linecap: round; stroke-linejoin: round; }
.hv-selinner { fill: none; stroke: var(--hv-paper); }
.hv-selend { fill: var(--hv-paper); stroke: var(--color-action); }
.hv-hoverhalo { fill: none; stroke: var(--k); stroke-opacity: .35; stroke-linecap: round; stroke-linejoin: round; }
@keyframes hv-pulse { 50% { stroke-opacity: .12; } }
.hv-sheet svg .hv-hit.is-off { opacity: .35; }
.hv-sheet svg.has-sel .hv-hit:not(.is-sel) { opacity: .45; }
.hv-sheet svg.has-sel .hv-hit.is-off:not(.is-sel) { opacity: .2; }
.hv-ins__head { cursor: move; user-select: none; }
.hv-ins.is-moving { box-shadow: 0 14px 40px rgb(11 18 20 / .3); }

/* tag letters */
.hv-fam { margin: 2px 2px 8px; padding: 6px 8px; border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-surface-subtle); }
.hv-fam summary { cursor: pointer; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.hv-fam summary .hv-label { margin: 0; }
.hv-fam summary .hv-muted { font-size: var(--font-size-xs); }
.hv-fam__rows { display: grid; gap: 4px; margin-top: 8px; }
.hv-fam__row { display: grid; grid-template-columns: 34px 34px minmax(0, 1fr) 104px; gap: 6px; align-items: center; }
.hv-fam__tag { font-family: var(--font-family-mono); }
.hv-fam__row .hv-muted { font: var(--font-size-xs) var(--font-family-mono); }
.hv-fam__row input, .hv-fam__row select { height: 28px; min-width: 0; border: 1px solid var(--color-border); border-radius: 7px; padding: 0 6px;
    background: var(--color-surface); color: var(--color-text); font: inherit; font-size: var(--font-size-xs); }

/* shortcuts */
.hv-keys { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: var(--font-size-sm); }
.hv-keys dt { text-align: right; }
.hv-keys dd { margin: 0; color: var(--color-text-muted); }
.hv-keys kbd { font: var(--font-size-xs) var(--font-family-mono); padding: 1px 6px; border: 1px solid var(--color-border); border-bottom-width: 2px; border-radius: 5px; background: var(--color-surface-subtle); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) { .hv * { transition: none !important; animation: none !important; } }

/* finish */
.hv input[type="checkbox"], .hv input[type="radio"] { accent-color: var(--color-action); }
.hv-drop { position: relative; }
.hv-drop__input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.hv-drop:focus-within { outline: 3px solid var(--color-focus); outline-offset: 3px; }
.hv-drop:hover { border-color: var(--color-action); }
.hv-drop__btn { display: inline-flex; align-items: center; height: 40px; padding: 0 18px; margin: 4px 0; border-radius: 10px; background: var(--color-action);
    color: var(--color-text-on-action); font-weight: 700; }
.hv-drop:hover .hv-drop__btn { background: var(--color-action-hover); }
.hv-linkbtn { border: 0; background: none; padding: 8px; color: var(--color-action); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.hv-start__privacy { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0; color: var(--color-text-muted); font-size: var(--font-size-xs); text-align: center; }
.hv-start__privacy svg { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hv-start__limits { margin: 4px 0 0; color: var(--color-text-muted); font-size: var(--font-size-xs); text-align: center; }
.hv-start__limits b { color: var(--color-text); }
.hv-signout { display: inline; margin: 0; }
.hv-about { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr)); gap: 14px 24px; max-width: min(60rem, 100%); margin: 28px auto 0; padding-top: 20px; border-top: 1px solid var(--color-border); text-align: left; }
.hv-about h3 { margin: 0 0 4px; font-size: var(--font-size-sm); }
.hv-about p { margin: 0; color: var(--color-text-muted); font-size: var(--font-size-sm); line-height: 1.5; }
.hv-about .hv-about__more { grid-column: 1 / -1; text-align: center; font-size: var(--font-size-xs); }
.hv-signout .hv-linkbtn { font-size: inherit; }
.hv-flag { display: inline-block; margin-right: 8px; padding: 1px 6px; border-radius: 999px; vertical-align: 3px; font: 700 10px var(--font-family-sans);
    letter-spacing: .02em; color: var(--color-status-review); background: var(--color-status-review-surface); cursor: help; }
.hv-footnote { margin: 6px 0 0; font-size: var(--font-size-xs); color: var(--color-text-muted); }
.hv-est .hv-duct .hv-muted { font-size: var(--font-size-sm); }
/* tool names give way to icons when the drawing area is narrow, so the toolbar stays on one line */
.hv-stage { container-type: inline-size; }
@container (max-width: 940px) { .hv-tool span, .hv-tool kbd { display: none; } .hv-tool[aria-pressed="true"] span { display: inline; } }

/* review */
.hv-btn--sm { height: 30px; padding: 0 10px; font-size: var(--font-size-xs); }
.hv-btn--ghost { border-color: transparent; background: transparent; }
.hv-review { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px;
    background: var(--color-status-review-surface); border: 1px solid color-mix(in srgb, var(--color-status-review) 35%, transparent); }
.hv-review__text { display: grid; gap: 2px; font-size: var(--font-size-sm); }
.hv-review__text b { font-family: var(--font-family-mono); }
.hv-review__text > span:not(.hv-review__head) { font-size: var(--font-size-xs); color: var(--color-text-muted); }
.hv-review__head { font-size: var(--font-size-sm); font-weight: 600; }
.hv-review__actions { display: flex; gap: 6px; }
.hv-review.is-done { justify-content: flex-start; gap: 8px; background: var(--color-action-soft); border-color: transparent; font-size: var(--font-size-sm); font-weight: 600; }
.hv-review.is-done svg { width: 18px; height: 18px; fill: none; stroke: var(--color-action); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.hv-reviewbar { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 4; display: flex; align-items: center; gap: 8px;
    padding: 6px 8px 6px 14px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 12px; box-shadow: var(--hv-shadow);
    max-width: calc(100% - 24px); white-space: nowrap; }
.hv-reviewbar__count { font-size: var(--font-size-sm); }
.hv-reviewbar__count b { font-family: var(--font-family-mono); }
.hv-reviewbar__count--done { font-weight: 600; color: var(--color-action); }
.hv-reviewbar__track { width: 90px; height: 6px; border-radius: 3px; background: var(--color-surface-subtle); overflow: hidden; flex: none; }
.hv-reviewbar__track span { display: block; height: 100%; width: 0; background: var(--color-action); transition: width .3s ease; }
.hv-stage:has(.hv-reviewbar:not([hidden])) .hv-scale { bottom: 62px; }
.hv-stage:has(.hv-reviewbar:not([hidden])) .hv-ins { max-height: calc(100% - 128px); }
.hv-sheet svg.is-reviewing .hv-hit:not(.is-need):not(.is-sel) { opacity: .22; }
.hv-quick { display: grid; gap: 8px; padding: 10px; border-radius: 10px; background: var(--color-surface-subtle); }
.hv-trace { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: var(--font-size-xs); }
.hv-trace b { font-size: var(--font-size-sm); }
.hv-quick__row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 4px; }
.hv-airbtn { white-space: nowrap; }
.hv-airbtn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 32px; padding: 0 6px; border: 1px solid var(--color-border);
    border-radius: 8px; background: var(--color-surface); color: var(--color-text); font: inherit; font-size: var(--font-size-xs); font-weight: 600; cursor: pointer; }
.hv-airbtn:hover { border-color: var(--k, var(--color-border-strong)); box-shadow: inset 0 0 0 1px var(--k, var(--color-border-strong)); }
.hv-airbtn .hv-sw { width: 10px; height: 10px; }
@media (pointer: coarse) { .hv-airbtn { min-height: 44px; } .hv-btn--sm { min-height: 40px; } }

/* fittings */
.hv-fitmark { fill: var(--hv-paper); stroke: var(--k); }
.hv-sw--fit, .hv-c-fit.hv-sw, .hv-sw.hv-c-fit { width: 9px; height: 9px; margin: 0 1.5px; border-radius: 1px; transform: rotate(45deg); background: transparent;
    box-shadow: inset 0 0 0 1.6px var(--color-text-muted); }
.hv-listhead { margin: 12px 4px 4px; font-size: var(--font-size-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--color-text-muted); }
.hv-trace--line { grid-column: 1 / -1; margin: 0 0 2px; padding: 6px 8px; border-radius: 8px; background: var(--color-surface-subtle); }

/* marked-up PDF options */
.hv-card--wide { width: min(470px, calc(100% - 24px)); max-height: calc(100% - 80px); overflow-y: auto; z-index: 7; }
.hv-card .hv-muted { margin: 0 0 10px; font-size: var(--font-size-sm); }
.hv-xrow { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.hv-xset { margin: 12px 0 0; padding: 0; border: 0; min-width: 0; }
.hv-xset legend { padding: 0; margin-bottom: 6px; font-size: var(--font-size-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--color-text-muted); }
.hv-xgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 14px; }
.hv-radio { display: inline-flex; align-items: center; gap: 6px; font-size: var(--font-size-sm); cursor: pointer; }
.hv-radio input { accent-color: var(--color-action); }
.hv-xchecks { display: grid; gap: 6px; margin-top: 12px; }
.hv-xchecks .hv-check { font-size: var(--font-size-sm); color: var(--color-text); }
.hv-card .hv-row { margin-top: 14px; justify-content: flex-end; }
@media (max-width: 760px) { .hv-xgrid { grid-template-columns: minmax(0, 1fr); } }

.hv-thumb__file { display: block; padding: 0 6px 4px; font-size: 10px; color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* phones and tablets */
.hv-mnav, .hv-for-phone, .hv-for-tablet { display: none; }
.hv-work { position: relative; }
.hv-scrim { position: absolute; inset: 0; z-index: 4; background: rgb(11 18 20 / .28); }
.hv-chip { display: inline-flex; align-items: center; height: 30px; padding: 0 10px; border: 1px solid var(--color-border); border-radius: 999px;
    background: var(--color-surface); color: var(--color-text); font: inherit; font-size: var(--font-size-xs); cursor: pointer; }
.hv-chip[aria-pressed="true"] { background: var(--color-text); border-color: var(--color-text); color: var(--color-surface); }
.hv-chip--go { background: var(--color-action); border-color: var(--color-action); color: var(--color-text-on-action); font-weight: 700; }
.hv-chip:disabled { opacity: .5; cursor: default; }

/* tablets: the sheet list slides out from the left when asked for */
@media (max-width: 1100px) {
    .hv-work { grid-template-columns: minmax(0, 1fr) 300px; }
    .hv-for-tablet { display: inline-flex; }
    .hv-rail { position: absolute; left: 0; top: 0; bottom: 0; z-index: 5; width: 260px; transform: translateX(-105%); visibility: hidden;
        transition: transform .2s ease, visibility .2s; box-shadow: var(--hv-shadow); }
    .hv-work[data-drawer="sheets"] .hv-rail { transform: none; visibility: visible; }
    body.hv-body.hv-open .app-header__bar > .site-nav { display: none; }
    body.hv-body.hv-open .app-header__bar { grid-template-columns: auto 1fr auto; }
}
@media (max-width: 1000px) { .hv-tool span { display: none; } }

/* phones: a full-screen app; the panels slide up from a bar at the bottom */
@media (max-width: 760px) {
    .hv-for-tablet { display: none; }
    .hv-for-phone { display: inline-flex; }
    .hv-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    body.hv-body.hv-open { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; padding: 0; }
    body.hv-body.hv-open > .app-header { flex: none; margin: 0; width: 100%; max-width: none; }
    body.hv-body.hv-open .app-header__bar { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 8px;
        padding: 4px 10px; border-radius: 0; border-width: 0 0 1px; box-shadow: none; }
    body.hv-body.hv-open .app-header__bar > .site-nav, body.hv-body.hv-open .privacy-signal, body.hv-body.hv-open .theme-control__label,
    body.hv-body.hv-open > .app-header .page-heading, body.hv-body.hv-open > .site-footer { display: none; }
    body.hv-body.hv-open .app-header__utilities { flex-direction: row; }
    body.hv-body.hv-open > main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; max-width: none; margin: 0; padding: 0; }
    body.hv-body.hv-open > main:focus { outline: none; }
    body.hv-body.hv-open .hv, body.hv-body.hv-open .hv-app { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
    body.hv-body.hv-open .hv-app { border: 0; border-radius: 0; }
    .hv-bar { flex-wrap: nowrap; gap: 6px; padding: 6px 8px; }
    .hv-file { font-size: var(--font-size-sm); }
    .hv-dirty { display: block; }
    .hv-bar__actions { display: none; position: absolute; right: 8px; top: calc(100% + 4px); z-index: 30; flex-direction: column; align-items: stretch;
        min-width: 220px; padding: 8px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 12px; box-shadow: var(--hv-shadow); }
    .hv-bar__actions.is-open { display: flex; }
    .hv-bar__actions .hv-btn { justify-content: flex-start; }
    .hv-work { display: block; flex: 1 1 auto; min-height: 0; height: auto; }
    .hv-center { display: block; height: 100%; }
    .hv-stage { height: 100%; }
    .hv-rail, .hv-panel, .hv-table { position: absolute; left: 0; right: 0; top: auto; bottom: 0; width: auto; z-index: 5; max-height: 74%;
        overflow-y: auto; border: 1px solid var(--color-border); border-radius: 16px 16px 0 0; box-shadow: 0 -10px 30px rgb(11 18 20 / .22);
        transform: translateY(105%); visibility: hidden; transition: transform .22s ease, visibility .22s; display: flex; flex-direction: column; }
    .hv-table { overflow: hidden; }
    .hv-work[data-drawer="sheets"] .hv-rail, .hv-work[data-drawer="takeoff"] .hv-panel, .hv-work[data-drawer="table"] .hv-table { transform: none; visibility: visible; }
    .hv-rail::before, .hv-panel::before, .hv-table::before { content: ""; display: block; flex: none; width: 40px; height: 4px; margin: 8px auto 2px;
        border-radius: 2px; background: var(--color-border-strong); }
    .hv-table__wrap { height: auto; flex: 1; min-height: 0; max-height: none; }
    .hv-table__grip, [data-hv-tabletoggle] { display: none; }
    .hv-mnav { display: flex; flex: none; border-top: 1px solid var(--color-border); background: var(--color-surface);
        padding-bottom: env(safe-area-inset-bottom, 0px); }
    .hv-mnav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 4px 6px; border: 0; background: none;
        color: var(--color-text-muted); font: inherit; font-size: 11px; font-weight: 600; cursor: pointer; }
    .hv-mnav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
    .hv-mnav button[aria-pressed="true"] { color: var(--color-action); }
    .hv-toolbar { left: 6px; right: 6px; top: 6px; gap: 6px; }
    .hv-zoom { margin-left: auto; }
    .hv-zoom [data-hv-zin], .hv-zoom [data-hv-zout], .hv-zoom output { display: none; }
    .hv-scale { left: 6px; bottom: 6px; max-width: calc(100% - 12px); padding: 4px 4px 4px 8px; gap: 6px; font-size: var(--font-size-xs); flex-wrap: nowrap; }
    .hv-scale > span:first-child { white-space: nowrap; }
    .hv-scale .hv-muted { white-space: nowrap; }
    .hv-scale__how, .hv-scale__word { display: none; }
    .hv-scale .hv-btn { min-height: 36px; padding-inline: 8px; }
    .hv-scale b { letter-spacing: -0.03em; }
    .hv-hint { left: 6px; right: 6px; max-width: none; bottom: calc(var(--hv-scale-h, 40px) + 12px); font-size: var(--font-size-xs); }
    .hv-hint__x { width: 36px; height: 36px; margin: -8px -8px -8px 0; }
    .hv-card { top: 112px; }
    .hv-ins { left: 6px !important; right: 6px; top: auto !important; bottom: 6px; width: auto; max-height: 58%; z-index: 6; }
    .hv-ins__head { cursor: pointer; }
    .hv-ins.is-peek { max-height: 52px; overflow: hidden; }
    .hv-reviewbar { top: 112px; bottom: auto; padding: 4px 6px 4px 10px; gap: 4px; }
    .hv-reviewbar__track { display: none; }
    .hv-stage:has(.hv-reviewbar:not([hidden])) .hv-scale { bottom: 6px; }
    .hv-stage:has(.hv-reviewbar:not([hidden])) .hv-ins { max-height: 52%; }
}

/* the narrowest phones: the amber box alone says the scale is not confirmed */
@media (max-width: 359px) {
    .hv-scale .hv-muted { display: none; }
}

/* fingers: bigger targets, and inputs large enough that iPhones do not zoom in on them */
@media (pointer: coarse) {
    .hv-tool, .hv-btn, .hv-chip { min-height: 44px; }
    .hv-btn--icon, .hv-zoom .hv-tool { min-width: 44px; justify-content: center; }
    .hv-tool kbd { display: none; }
    .hv-pick button { height: 40px; }
    .hv .hv-fields input, .hv .hv-fields select, .hv .hv-fields textarea, .hv-money, .hv-rates select, .hv-price__row select,
    .hv-fam__row input, .hv-fam__row select, .hv-sub input, .hv-sub select, .hv-feet input { min-height: 40px; font-size: 16px; }
    .hv-money input { font-size: 16px; }
    .hv-it, .hv-group > button { padding-top: 10px; padding-bottom: 10px; }
    .hv-layer { padding: 8px 4px; }
    .hv-scope button, .hv-seg button { padding: 9px 12px; }
    .hv-ins__x { width: 40px; height: 40px; }
    .hv-grid td { padding-top: 9px; padding-bottom: 9px; }
}

/* liner and wrap */
.hv-insline { stroke: #fff; fill: none; stroke-linejoin: round; pointer-events: none; }
.hv-insline--wrap { stroke-linecap: round; }
.hv-is-off .hv-insline, .is-off .hv-insline { display: none; }
.hv-insrow { display: flex; align-items: center; gap: 8px; }
.hv-insrow input[type="checkbox"] { width: 18px; height: 18px; flex: none; accent-color: var(--color-action); }
.hv-insrow .hv-unit { flex: 1; min-width: 0; }
.hv-insrow input:disabled { opacity: .5; }
.hv-ins-sf b { font-variant-numeric: tabular-nums; }
.hv-instag { display: inline-block; margin-left: 4px; padding: 0 5px; border-radius: 4px; font-size: 11px; line-height: 16px;
    background: var(--color-surface-muted); color: var(--color-text-muted); white-space: nowrap; }
.hv-sw--liner, .hv-sw--wrap, .hv-insmark { background: var(--color-text-muted); }
.hv-sw--liner, .hv-insmark--liner { background: repeating-linear-gradient(90deg, var(--color-text) 0 4px, transparent 4px 6px); height: 4px; vertical-align: 2px; border-radius: 0; }
.hv-sw--wrap, .hv-insmark--wrap { background: radial-gradient(circle, var(--color-text) 1.3px, transparent 1.6px) 0 50% / 5px 5px repeat-x; height: 5px; vertical-align: 2px; border-radius: 0; }
.hv-insmark { display: inline-block; width: 14px; margin-right: 5px; }
.hv-price__group { margin: 14px 2px 4px; font-size: var(--font-size-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--color-text-muted); }
.hv-price__group:first-of-type { margin-top: 6px; }

/* comparing with an older version */
.hv-chg { fill: none; pointer-events: none; stroke-linecap: round; stroke-linejoin: round; }
.hv-chg--added { stroke: #16a34a; stroke-opacity: .45; }
.hv-chg--changed { stroke: #d97706; stroke-opacity: .5; }
.hv-chg--removed { stroke: #dc2626; stroke-opacity: .9; }
.hv-cmp { display: grid; gap: 8px; }
.hv-cmp__counts { display: flex; flex-wrap: wrap; gap: 6px; }
.hv-cmp__counts span { padding: 2px 8px; border-radius: 999px; font-size: var(--font-size-xs); font-weight: 600; background: var(--color-surface-muted); }
.hv-cmp--added { color: #15803d; } .hv-cmp--changed { color: #b45309; } .hv-cmp--removed { color: #b91c1c; }
.hv-chgrow { display: grid; grid-template-columns: 20px 1fr auto; gap: 8px; align-items: start; width: 100%; padding: 7px 8px; text-align: left;
    border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-surface); color: var(--color-text); font: inherit; cursor: pointer; }
.hv-chgrow:hover { border-color: var(--color-action); }
.hv-chgrow i { font-style: normal; font-weight: 800; text-align: center; }
.hv-chgrow--added i { color: #15803d; } .hv-chgrow--changed i { color: #b45309; } .hv-chgrow--removed i { color: #b91c1c; }
.hv-chgrow small { display: block; color: var(--color-text-muted); font-size: var(--font-size-xs); }
.hv-chgrow em { font-style: normal; font-size: var(--font-size-xs); color: var(--color-text-muted); white-space: nowrap; }
.hv-filebtn { display: inline-flex; align-items: center; cursor: pointer; }
.hv-status.is-error { color: var(--color-status-review); }
/* five tabs once a comparison is open: they share the row, and scroll rather than spill */
.hv-tabs { overflow-x: auto; scrollbar-width: none; }
.hv-tabs::-webkit-scrollbar { display: none; }
.hv-tab { flex: 0 0 auto; white-space: nowrap; }
.hv-tabs:has(.hv-tab:nth-child(5)) { gap: 0; padding-inline: 4px; }
.hv-tabs:has(.hv-tab:nth-child(5)) .hv-tab { padding-inline: 6px; font-size: 13px; }

/* progress: what is installed */
.is-progress .hv-hit { --k: #9aa6a9; }
.is-progress .hv-hit.is-done { --k: #16a34a; }
.is-progress .hv-hit .hv-mark { fill-opacity: .1; }
.is-progress .hv-hit.is-done .hv-mark { fill-opacity: .35; }
.is-progress .hv-hit.is-done .hv-line { stroke-opacity: 1; }
.hv-progress-sum { display: grid; gap: 8px; }
.hv-prog__head { display: flex; justify-content: space-between; font-size: var(--font-size-sm); }
.hv-prog__head b { font-variant-numeric: tabular-nums; color: #15803d; }
.hv-prog__bar { height: 8px; border-radius: 999px; background: var(--color-surface-muted); overflow: hidden; margin: 3px 0 2px; }
.hv-prog__bar span { display: block; height: 100%; width: 0; background: #16a34a; border-radius: 999px; }
.hv-done span { color: var(--color-text-muted); }
.hv-instag--done { background: #dcfce7; color: #166534; }

/* first-visit tour: the rest of the screen dims around a ring on each stop */
.hv-tour { position: fixed; inset: 0; z-index: 1000; }
.hv-tour__ring { position: fixed; border: 2px solid var(--color-action); border-radius: 12px; box-shadow: 0 0 0 9999px rgba(8, 18, 20, .55);
    transition: left .2s, top .2s, width .2s, height .2s; pointer-events: none; }
.hv-tour__card { position: fixed; padding: 14px 16px; border-radius: 12px; background: var(--color-surface); color: var(--color-text);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .3); border: 1px solid var(--color-border); }
.hv-tour__card h3 { margin: 2px 0 6px; font-size: 1.05rem; }
.hv-tour__card p { margin: 0 0 12px; line-height: 1.45; }
.hv-tour__step { margin: 0 !important; font-size: var(--font-size-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--color-text-muted); }
.hv-tour__row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
@media (prefers-reduced-motion: reduce) { .hv-tour__ring { transition: none; } }
.hv-hint .hv-link { white-space: nowrap; }

/* Gauges tab: the estimator's gauge schedule and the pounds it gives */
.hv-gauges { margin: 0 0 12px; padding: 8px 10px 10px; border: 1px solid var(--color-border); border-radius: 8px; }
.hv-gauges legend { padding: 0 4px; font-size: var(--font-size-xs); font-weight: 600; }
.hv-gauges__row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: var(--font-size-xs); }
.hv-gauges__row .hv-unit input { width: 4.5em; }
.hv-gauges__row select { min-width: 5.5em; }
.hv-gauges__allow { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 12px; font-size: var(--font-size-xs); }
.hv-gauges__allow .hv-unit input { width: 4.5em; }
.hv-weights { padding-top: 8px; border-top: 1px solid var(--color-border); }
.hv-weights__table { width: 100%; border-collapse: collapse; margin: 6px 0; font-size: var(--font-size-xs); font-variant-numeric: tabular-nums; }
.hv-weights__table th, .hv-weights__table td { padding: 3px 4px; border-bottom: 1px solid var(--color-border); text-align: left; }
.hv-weights__table .num { text-align: right; }

/* "How did this scan do?" */
.hv-fb fieldset { margin: 0 0 10px; padding: 0; border: 0; display: grid; gap: 4px; }
.hv-fb legend { margin-bottom: 4px; font-size: var(--font-size-sm); font-weight: 600; }
.hv-fb .hv-check { font-size: var(--font-size-sm); color: var(--color-text); }
.hv-fb fieldset.hv-fb__verdict { grid-auto-flow: column; justify-content: start; gap: 14px; }
.hv-card { max-height: calc(100% - 80px); overflow-y: auto; }

/* Hangers tab: one schedule row per size range, wrapping on narrow panels */
.hv-hang__row { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.2rem, 1fr)); gap: 6px 8px; align-items: end;
  margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px dashed var(--color-border); font-size: var(--font-size-xs); }
.hv-hang__row label { display: grid; gap: 2px; color: var(--color-text-muted); }
.hv-hang__row input, .hv-hang__row select { width: 100%; min-width: 0; }
.hv-hang__row .hv-unit input { width: 100%; }
.hv-hang__row .hv-hang__what { grid-column: 1 / -1; }
.hv-hang__row > .hv-link { justify-self: start; }

.hv-hang-own { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 4px; }
.hv-hang-own .hv-unit input { width: 4.5em; }

/* bid lines: the estimator's own column layout */
.hv-bidcols { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 15rem; overflow-y: auto; }
.hv-bidcol { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; align-items: center; gap: 6px; }
.hv-bidcol input[type="text"] { min-width: 0; padding: 3px 6px; font: inherit; font-size: .85rem; }
.hv-bidcol .hv-chip { padding: 2px 8px; min-width: 0; }
.hv-bidcol.is-off input[type="text"] { opacity: .55; }
.hv-bidcol__key { font-size: .72rem; color: var(--color-text-muted); max-width: 7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hv-bidcol__key:empty { display: none; }

/* areas and phases */
.hv-area__box { fill: var(--hv-equip); fill-opacity: .04; stroke: var(--hv-equip); stroke-opacity: .75; pointer-events: none; }
.hv-area__box.is-on { fill-opacity: .1; stroke-opacity: 1; }
.hv-area__name { fill: var(--hv-equip); stroke: var(--hv-paper); paint-order: stroke; font-weight: 700; pointer-events: none; }
.hv-areas { pointer-events: none; }
.hv-areapick { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: var(--font-size-xs); color: var(--color-text-muted); }
.hv-areapick select { flex: 1; min-width: 0; font: inherit; font-size: var(--font-size-sm); padding: 3px 6px; }
.hv-arealist { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 8px; }
.hv-area { display: grid; gap: 4px; padding: 8px; border: 1px solid var(--color-border); border-left: 3px solid var(--hv-equip); border-radius: 8px; }
.hv-area.is-on { background: var(--color-surface-subtle); }
.hv-area input[type="text"] { font: inherit; font-weight: 600; padding: 4px 6px; min-width: 0; }
.hv-area__meta { font-size: var(--font-size-xs); color: var(--color-text-muted); }
.hv-area__warn { font-size: var(--font-size-xs); color: var(--color-status-review); }
.hv-area__do { display: flex; gap: 14px; flex-wrap: wrap; }
.hv-pieces__in { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 4px 0; }
.hv-pieces__in label { display: flex; align-items: center; gap: 6px; font-size: var(--font-size-xs); }
.hv-pieces__in input { width: 4.5em; }
.hv-weights__table tfoot td { font-weight: 700; border-bottom: 0; }
