/* Look: calm and Dutch, in the spirit of government calculators (NL Design System): white and light grey,
   dark blue as the only interface colour, clear form fields, thin rules instead of cards, no shadows or gradients.
   Orange is reserved for heat loss in the drawing and the charts. */
:root {
  --bg: #f3f3f3;
  --bg-2: #f3f3f3;
  --surface: #ffffff;
  --surface-2: #f3f3f3;
  --ink: #1e1e1e;
  --muted: #535353;
  --line: #cccccc;
  --field: #8c8c8c;
  --grid: #f0f0f0;
  --grid-major: #e2e2e2;
  --paper: #ffffff;
  --room: rgba(255, 255, 255, 0.85);
  --accent: #154273;
  --accent-ink: #ffffff;
  --accent-hover: #0d2d52;
  --accent-soft: rgba(21, 66, 115, 0.06);
  --accent-soft-2: rgba(21, 66, 115, 0.13);
  --link: #01689b;
  --heat: #d45800;
  --heat-soft: rgba(212, 88, 0, 0.08);
  --warn: #c3291c;
  --ok: #39870c;
  --glass: #8fcae7;
  --under: #c4c4c4;
  --wall: #1e1e1e;
  --hdr: #ffffff;
  --hdr-ink: #1e1e1e;
  --hdr-line: #cccccc;
  --seg-fabric: #d45800;
  --seg-glass: #f0a35e;
  --seg-air: #8fa9c2;
  --c-air: #007bc7;
  --seg-track: #e6e6e6;
  --c-loss: #d45800;
  --c-hp: #007bc7;
  --shadow: none;
  --radius: 0;
  --r: 4px;
  --font-display: 'Source Sans 3', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  --font-body: 'Source Sans 3', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  --font-mono: 'Source Sans 3', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #161616;
    --bg-2: #161616;
    --surface: #1f1f1f;
    --surface-2: #2a2a2a;
    --ink: #ececec;
    --muted: #b0b0b0;
    --line: #3a3a3a;
    --field: #707070;
    --grid: #232323;
    --grid-major: #2e2e2e;
    --paper: #1b1b1b;
    --room: rgba(255, 255, 255, 0.04);
    --accent: #8db6e2;
    --accent-ink: #0d1f33;
    --accent-hover: #b3cfee;
    --accent-soft: rgba(141, 182, 226, 0.08);
    --accent-soft-2: rgba(141, 182, 226, 0.18);
    --link: #8db6e2;
    --heat: #f08a3c;
    --heat-soft: rgba(240, 138, 60, 0.12);
    --warn: #f07b6e;
    --ok: #7cc35a;
    --glass: #5a9cbf;
    --under: #4a4a4a;
    --wall: #e6e6e6;
    --hdr: #1f1f1f;
    --hdr-ink: #ececec;
    --hdr-line: #3a3a3a;
    --seg-fabric: #f08a3c;
    --seg-glass: #f6c18a;
    --seg-air: #7f98b0;
    --c-air: #4fb3f0;
    --seg-track: #2e2e2e;
    --c-loss: #e07a2e;
    --c-hp: #4fb3f0;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #161616;
  --bg-2: #161616;
  --surface: #1f1f1f;
  --surface-2: #2a2a2a;
  --ink: #ececec;
  --muted: #b0b0b0;
  --line: #3a3a3a;
  --field: #707070;
  --grid: #232323;
  --grid-major: #2e2e2e;
  --paper: #1b1b1b;
  --room: rgba(255, 255, 255, 0.04);
  --accent: #8db6e2;
  --accent-ink: #0d1f33;
  --accent-hover: #b3cfee;
  --accent-soft: rgba(141, 182, 226, 0.08);
  --accent-soft-2: rgba(141, 182, 226, 0.18);
  --link: #8db6e2;
  --heat: #f08a3c;
  --heat-soft: rgba(240, 138, 60, 0.12);
  --warn: #f07b6e;
  --ok: #7cc35a;
  --glass: #5a9cbf;
  --under: #4a4a4a;
  --wall: #e6e6e6;
  --hdr: #1f1f1f;
  --hdr-ink: #ececec;
  --hdr-line: #3a3a3a;
  --seg-fabric: #f08a3c;
  --seg-glass: #f6c18a;
  --seg-air: #7f98b0;
  --c-air: #4fb3f0;
  --seg-track: #2e2e2e;
  --c-loss: #e07a2e;
  --c-hp: #4fb3f0;
  color-scheme: dark;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
* {
  box-sizing: border-box;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
.app {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0;
}
.top {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
  background: var(--hdr);
  color: var(--hdr-ink);
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--line);
}
.brand {
  font-weight: 700;
  font-size: 20px;
  color: var(--accent);
  white-space: nowrap;
  line-height: 1.2;
}
.brand small {
  display: block;
  font-weight: 400;
  font-size: 13px;
  color: var(--muted);
}
.top .spacer {
  flex: 1;
}
.pill {
  font-size: 13px;
  padding: 2px 8px;
  border-radius: 2px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface);
  white-space: nowrap;
}
.top .pill {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 0;
}
.pill.ok {
  color: var(--ok);
}
.pill.warn {
  color: var(--warn);
}
.top .pill.ok,
.top .pill.warn {
  color: var(--muted);
}
.total {
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.total b {
  color: var(--ink);
  font-weight: 700;
  font-size: 20px;
}
select.proj {
  max-width: 260px;
  padding: 6px 10px;
  border: 1px solid var(--field);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
  font-weight: 600;
}
.btn:hover {
  background: var(--accent-soft-2);
}
.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn.danger {
  color: var(--warn);
  border-color: var(--warn);
}
.btn.small {
  padding: 3px 9px;
  font-size: 14px;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn:focus-visible,
.tool:focus-visible,
input:focus-visible,
select:focus-visible,
.tab:focus-visible,
.segbtn:focus-visible,
.linkrow:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.main {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) var(--panel-w, 420px);
  gap: 0;
  min-height: 0;
}
.tools {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
}
.tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 9px 2px 7px;
  border: none;
  border-left: 3px solid transparent;
  line-height: 1.25;
  border-radius: 0;
  background: none;
  cursor: pointer;
  font-size: 12px;
  color: var(--ink);
}
.tool:hover {
  background: var(--accent-soft);
}
.tool svg {
  width: 22px;
  height: 22px;
  stroke: var(--ink);
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tool[aria-pressed='true'] {
  background: var(--accent-soft-2);
  border-left-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.tool[aria-pressed='true'] svg {
  stroke: var(--accent);
}
.tool kbd {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--muted);
}
.tools .sep {
  height: 1px;
  flex: none;
  background: var(--line);
  margin: 4px 0;
}
.stage {
  position: relative;
  overflow: hidden;
  background: var(--paper);
  min-height: 0;
  touch-action: none;
}
.stage svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  -webkit-user-select: none;
}
.hint {
  position: absolute;
  left: 10px;
  top: 50px;
  right: 10px;
  pointer-events: none;
  display: flex;
}
.floorbar {
  position: absolute;
  left: 10px;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  pointer-events: none;
}
.floorbar > * {
  pointer-events: auto;
}
.floors {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--r);
  overflow: hidden;
  max-width: 100%;
  overflow-x: auto;
}
.floors button {
  border: none;
  background: none;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 14px;
  color: var(--accent);
  border-right: 1px solid var(--accent);
  white-space: nowrap;
}
.floors button:last-child {
  border-right: none;
}
.floors button[aria-pressed='true'] {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.floors button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.undbtn[aria-pressed='true'],
.floorbar [data-heatview][aria-pressed='true'] {
  background: var(--accent);
  color: var(--accent-ink);
}
.hint span {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 5px 10px;
  font-size: 14px;
  color: var(--ink);
  max-width: 640px;
}
.hud {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  pointer-events: none;
  flex-wrap: wrap;
}
.coords {
  font-size: 11.5px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 2px 6px;
}
.scalebar {
  font-size: 10.5px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.scalebar i {
  display: block;
  height: 5px;
  border: 1.5px solid var(--muted);
  border-top: none;
}
.legend {
  position: absolute;
  right: 10px;
  bottom: 52px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 7px 9px;
  font-size: 11.5px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 240px;
  pointer-events: none;
}
.legend div {
  display: flex;
  gap: 7px;
  align-items: center;
  min-width: 0;
}
.legend div span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.legend.heat {
  width: 230px;
}
.legend.heat .hbar {
  display: block;
  height: 9px;
  border-radius: 5px;
  margin-top: 3px;
}
.legend.heat .hlab {
  display: block;
  position: relative;
  height: 14px;
  margin: 0 6px;
  font-size: 10px;
  color: var(--muted);
}
.legend.heat .hlab span {
  position: absolute;
  transform: translateX(-50%);
}
.sw {
  flex: none;
  width: 16px;
  height: 5px;
  border-radius: 2px;
  display: inline-block;
}
.zoom {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: flex;
  gap: 4px;
}
.zoom .btn {
  padding: 4px 9px;
}
.panel {
  position: relative;
  background: var(--surface);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.tabs {
  display: flex;
  flex: none;
  border-bottom: 1px solid var(--line);
  padding: 0 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar {
  display: none;
}
.tab {
  flex: 1 0 auto;
  font-size: 14px;
  border: none;
  background: none;
  padding: 11px 5px 8px;
  cursor: pointer;
  color: var(--link);
  border-bottom: 4px solid transparent;
  white-space: nowrap;
}
.tab:hover {
  color: var(--accent);
  text-decoration: underline;
}
.tab[aria-selected='true'] {
  color: var(--ink);
  font-weight: 700;
  border-bottom-color: var(--accent);
}
.pbody {
  flex: 1 1 auto;
  overflow: auto;
  padding: 18px 20px 30px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-height: 0;
}
.pbody > * {
  flex: none;
}
h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  line-height: 1.25;
  text-wrap: balance;
}
h3 {
  font-size: 17px;
  color: var(--ink);
  margin: 0;
  font-weight: 700;
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sec {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.crumb {
  border: none;
  background: none;
  padding: 0;
  color: var(--link);
  text-decoration: underline;
  cursor: pointer;
  font-size: 15px;
  text-align: left;
}
.fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px 10px;
}
label.f {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  min-width: 0;
}
label.f .u {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  margin-top: -4px;
}
input.in,
select.in {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--field);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  font-weight: 400;
  min-width: 0;
}
input.in:hover,
select.in:hover {
  border-color: var(--ink);
}
input.title {
  font-size: 22px;
  font-weight: 700;
  border: 1px solid transparent;
  background: none;
  padding: 2px 4px;
  margin-left: -5px;
  width: 100%;
  border-radius: var(--r);
}
input.title:hover,
input.title:focus {
  border-color: var(--line);
  background: var(--surface-2);
}
.big {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: baseline;
}
.big .kpi {
  display: flex;
  flex-direction: column;
}
.big .kpi b {
  font-weight: 700;
  font-size: 24px;
}
.kcard {
  border-radius: 0;
  background: var(--surface);
  border: none;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.kcard .kh {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}
.kcard .kh span {
  font-weight: 600;
  color: var(--ink);
  font-size: 15px;
}
.kcard .kh b {
  white-space: nowrap;
  font-weight: 700;
  font-size: 26px;
}
.segbar {
  display: flex;
  gap: 2px;
  height: 8px;
}
.segbar i {
  display: block;
  border-radius: 0;
  min-width: 3px;
}
.seglegend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
}
.seglegend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-variant-numeric: tabular-nums;
}
.seglegend span::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 0;
  background: var(--c);
}
.roomcards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.roomcard {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  text-align: left;
}
.roomcard:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.roomcard .rn {
  font-size: 15px;
  font-weight: 600;
  color: var(--link);
  text-decoration: underline;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.roomcard .rk {
  font-size: 20px;
  font-weight: 700;
}
.roomcard .rs {
  font-size: 13px;
  color: var(--muted);
}
.big .kpi b.heat {
  color: var(--heat);
}
.big .kpi span {
  font-size: 13px;
  color: var(--muted);
}
.wallbar {
  display: flex;
  height: 30px;
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--line);
}
.segbtn {
  border: none;
  border-right: 1px solid var(--surface);
  cursor: pointer;
  color: #fff;
  font-size: 12px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  padding: 0 4px;
  min-width: 6px;
  position: relative;
}
.segbtn:last-child {
  border-right: none;
}
.segbtn.none {
  background: repeating-linear-gradient(45deg, var(--surface-2) 0 6px, var(--line) 6px 12px);
  color: var(--muted);
}
.segbtn.cur {
  box-shadow: inset 0 0 0 3px var(--ink);
}
.wallrow {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.segrow {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}
.segrow:hover,
.segrow:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.segrow .sw {
  width: 6px;
  height: 28px;
  border-radius: 0;
}
.segrow .sr-t {
  flex: 1;
  min-width: 0;
}
.segrow small {
  display: block;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wallrow .meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.wallrow .meta b {
  color: var(--ink);
  font-weight: 500;
}
.scale {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--muted);
}
table.calc {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.calc th {
  font-weight: 600;
  color: var(--ink);
  font-size: 13px;
  text-align: right;
  padding: 4px 4px;
  border-bottom: 1px solid var(--line);
}
table.calc th:first-child,
table.calc td:first-child {
  text-align: left;
}
table.calc td {
  padding: 4px 4px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: top;
}
table.calc td:first-child {
  font-family: var(--font-body);
  min-width: 0;
}
table.calc td small {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
}
table.calc tr.sum td {
  font-weight: 700;
  border-bottom: none;
  border-top: 2px solid var(--ink);
}
table.calc tr.miss td {
  color: var(--warn);
}
.tablewrap {
  overflow-x: auto;
}
.card {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
}
.card.cur {
  border-color: var(--accent);
  box-shadow: inset 4px 0 0 var(--accent);
}
.row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.row > * {
  min-width: 0;
}
.grow {
  flex: 1;
}
.note {
  font-size: 14px;
  color: var(--muted);
}
.note a,
.pbody a {
  color: var(--link);
}
.warnbox {
  font-size: 14px;
  color: var(--ink);
  border: none;
  border-left: 4px solid var(--warn);
  background: color-mix(in srgb, var(--warn) 8%, transparent);
  border-radius: var(--r);
  padding: 6px 9px;
}
.det {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
  background: var(--surface-2);
  border-radius: var(--r);
  padding: 7px 9px;
}
.linkrow {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.linkrow:hover {
  border-color: var(--accent);
}
.linkrow:hover {
  background: var(--accent-soft);
}
.linkrow > span:first-child {
  color: var(--link);
  text-decoration: underline;
}
.linkrow > span:last-child {
  flex: none;
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}
.colorin {
  width: 34px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: none;
  cursor: pointer;
  flex: none;
}
.opgrid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.8fr) minmax(0, 0.8fr) auto;
  gap: 6px;
  align-items: end;
}
.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  background: var(--hdr);
  color: var(--hdr-ink);
  padding: 10px 16px;
  border-radius: var(--r);
  font-size: 13px;
  display: flex;
  gap: 12px;
  align-items: center;
  z-index: 20;
  max-width: calc(100% - 32px);
}
.toast {
  background: var(--ink) !important;
  color: var(--surface) !important;
}
.toast button {
  background: none;
  border: none;
  color: var(--surface);
  text-decoration: underline;
  cursor: pointer;
  font-weight: 600;
  padding: 0;
}
svg text {
  paint-order: stroke;
  stroke: var(--paper);
  stroke-width: 3px;
  stroke-linejoin: round;
}
svg .rname {
  font-family: var(--font-body);
  font-weight: 600;
  fill: var(--ink);
}
svg .rsub {
  fill: var(--muted);
  font-family: var(--font-body);
  font-weight: 500;
}
svg .rheat {
  fill: var(--ink);
  font-family: var(--font-body);
  font-weight: 700;
}
svg .dim {
  fill: var(--heat);
  font-size: 11px;
  font-weight: 600;
}
/* a soft halo in the background colour so labels stay readable over lines, hatching and treads */
svg .dim,
svg .rname,
svg .rsub,
svg .rheat {
  paint-order: stroke;
  stroke: var(--surface);
  stroke-opacity: 0.9;
  stroke-width: 3.5px;
  stroke-linejoin: round;
}
svg .pilltxt {
  fill: var(--heat);
  font-size: 10.5px;
  font-weight: 600;
  stroke: none;
}
.hit {
  stroke: transparent;
  fill: none;
  cursor: pointer;
}
.stage.t-select .room {
  cursor: move;
}
.stage.t-poly,
.stage.t-rect,
.stage.t-split,
.stage.t-wall,
.stage.t-vv,
.stage.t-pipe,
.stage.t-hp {
  cursor: crosshair;
}
.ask {
  position: absolute;
  left: 50%;
  top: 96px;
  transform: translateX(-50%);
  width: min(380px, calc(100% - 32px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  z-index: 5;
}
.ask[hidden] {
  display: none;
}
.stage.is3d .scalebar,
.stage.is3d .coords {
  visibility: hidden;
}
.stage.is3d svg {
  cursor: grab;
}
.stage.is3d.panning svg {
  cursor: grabbing;
}
#z-3d[aria-pressed='true'] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.stage:has(.ask:not([hidden])) .hint {
  display: none;
}
.ask p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}
.stage.panning {
  cursor: grabbing;
}
/* the heat pump list scrolls on its own, so the rest of the tab stays close */
.hplist {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: min(420px, 55vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.hprow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.hprow:hover {
  border-color: var(--accent);
}
.hprow.cur {
  border-color: var(--accent);
  box-shadow: inset 4px 0 0 var(--accent);
  background: var(--accent-soft);
}
.hprow .hn {
  font-weight: 700;
  min-width: 0;
}
.hprow .hn small {
  display: block;
  font-weight: 500;
  color: var(--muted);
  font-size: 11.5px;
}
.hprow .hk {
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}
.hprow .hs {
  grid-column: 1/-1;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.chip {
  font-size: 13px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 2px;
  background: var(--surface-2);
  color: var(--ink);
}
.chip.ok {
  color: var(--ok);
}
.chip.bad {
  color: var(--warn);
}
.chart {
  position: relative;
}
.chart svg {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
}
.chart svg text {
  font-family: var(--font-body);
  stroke: none;
  fill: var(--muted);
  font-size: 10.5px;
}
.tip {
  position: absolute;
  pointer-events: none;
  background: var(--ink);
  color: var(--surface);
  font-size: 11.5px;
  padding: 7px 10px;
  border-radius: var(--r);
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 10px));
  line-height: 1.5;
  z-index: 2;
}
.chartleg {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
}
.chartleg span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chartleg i {
  display: inline-block;
  width: 18px;
  height: 3px;
  border-radius: 2px;
}
.concard {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
}
.concard.open {
  border-color: var(--accent);
  box-shadow: inset 4px 0 0 var(--accent);
}
.conhead {
  display: flex;
  align-items: center;
  padding-right: 6px;
}
.condup {
  flex: none;
}
.consum {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
}
.consum .nm {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.consum .val {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.conbody {
  padding: 0 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
label.chk {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 15px;
  color: var(--ink);
}
label.chk input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}
.layers {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.layside {
  font-size: 13px;
  color: var(--muted);
}
.layer {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 5px 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: var(--surface-2);
}
.layer.ign {
  opacity: 0.55;
}
.lrow {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 78px 58px auto;
  gap: 5px;
  align-items: center;
}
.lmove {
  display: flex;
  flex-direction: column;
}
.lmove button {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 9px;
  line-height: 1;
  padding: 1px 3px;
}
.lmove button:disabled {
  opacity: 0.3;
  cursor: default;
}
.lrow .in {
  padding: 4px 6px;
  font-size: 12.5px;
  background: var(--surface);
}
.mmwrap {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--muted);
}
.rd {
  font-size: 13px;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.xbtn {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--muted);
  padding: 2px 4px;
}
.xbtn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.subrow {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
  padding-left: 22px;
}
.subrow .in {
  width: auto;
  padding: 3px 6px;
  font-size: 12px;
  background: var(--surface);
}
.xsec {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--paper);
  overflow: hidden;
}
.xsec svg {
  display: block;
  width: 100%;
  height: auto;
}
.xsec svg text {
  font-size: 10px;
  fill: var(--muted);
}
.linkbtn {
  border: none;
  background: none;
  color: var(--link);
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font-size: 14px;
}
.matrow {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.matrow .in {
  width: auto;
}
@media (max-width: 900px) {
  html,
  body {
    height: auto;
  }
  .app {
    height: auto;
  }
  .main {
    grid-template-columns: 1fr;
    grid-template-rows: auto 62vh auto;
  }
  .tools {
    flex-direction: row;
    overflow-x: auto;
  }
  .tools .sep {
    width: 1px;
    height: auto;
    margin: 6px 2px;
  }
  .tool {
    min-width: 58px;
  }
  .panel {
    max-height: none;
  }
  .pbody {
    overflow: visible;
  }
  .legend {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* air flows between rooms (ventilation): moving dashes along the arrow */
.airflow {
  stroke-dasharray: 9 6;
  animation: airflow 1.1s linear infinite;
}
@keyframes airflow {
  to {
    stroke-dashoffset: -15;
  }
}

/* where a construction or material is used */
.uselist {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 220px;
  overflow: auto;
}
.matuse {
  margin: -2px 0 8px 32px;
}

/* drag handle to make the side panel wider or narrower */
.panel-resize {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 9px;
  cursor: col-resize;
  touch-action: none;
  z-index: 3;
}
.panel-resize::after {
  content: '';
  position: absolute;
  left: -1px;
  top: 0;
  width: 3px;
  height: 100%;
  background: transparent;
}
.panel-resize:hover::after,
.panel-resize:focus-visible::after,
.panel-resize.dragging::after {
  background: var(--accent);
  top: 0;
  height: 100%;
  margin-top: 0;
}
.panel-resize:focus-visible {
  outline: none;
}
@media (max-width: 900px) {
  .panel-resize {
    display: none;
  }
}

/* layers menu above the drawing */
.layersmenu {
  position: relative;
}
.layersmenu > summary {
  list-style: none;
  cursor: pointer;
}
.layersmenu > summary::-webkit-details-marker {
  display: none;
}
.layersmenu .lmenu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 6;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  white-space: nowrap;
}

/* schema of the pipe network */
.schema {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 70%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.schema[hidden] {
  display: none;
}
.schbox {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px 18px;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: min(520px, 100%);
}
.schhead {
  display: flex;
  align-items: center;
  gap: 8px;
}
.schhead h2 {
  margin: 0 auto 0 0;
  font-size: 18px;
}
.schwrap {
  overflow: auto;
  min-height: 0;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.schsvg {
  display: block;
  font-family: var(--font-body);
}
.schsvg text {
  font-family: var(--font-body);
  stroke: none;
}
.schsvg .schl {
  fill: var(--ink);
}
.schsvg .schs {
  fill: var(--muted);
}
.schsvg .warn {
  fill: var(--warn);
}
.schem:hover rect {
  stroke: var(--accent);
}
@media print {
  body:not(.rep-open) > *:not(.schema) {
    display: none !important;
  }
  .schema {
    position: static;
    padding: 0;
    background: none;
  }
  .schbox {
    box-shadow: none;
    border: 0;
    max-height: none;
  }
  .schwrap {
    overflow: visible;
  }
  .schhead .btn {
    display: none;
  }
}

/* report: a printable document over the app */
.report {
  position: fixed;
  inset: 0;
  z-index: 60;
  overflow: auto;
  background: var(--bg);
  padding: 16px;
}
.report[hidden] {
  display: none;
}
.reptools {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  max-width: 820px;
  margin: 0 auto 12px;
}
.repdoc {
  max-width: 820px;
  margin: 0 auto;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 28px 32px;
  font-size: 13px;
  line-height: 1.5;
}
.repdoc h1 {
  font-size: 24px;
  margin: 0;
}
.repdoc h2 {
  font-size: 17px;
  margin: 0 0 10px;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--ink);
}
.repdoc h3 {
  font-size: 14px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
  margin: 14px 0 6px;
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}
.repdoc h3::before {
  display: none;
}
.repdoc .sec > h3 {
  margin-top: 16px;
}
.repdoc table.calc td.txt {
  text-align: left;
  font-family: var(--font-body);
}
.repplan text {
  font-family: var(--font-body);
  stroke: #fff;
  stroke-width: 3px;
}
.repdoc .chart {
  max-width: 460px;
  break-inside: avoid;
}
.repdoc .chartleg,
.repdoc h3 {
  break-after: avoid;
}
.repschema text {
  stroke: none;
}
.repdoc h3 small {
  font-weight: 400;
  color: var(--muted);
}
.repdoc h3 b {
  margin-left: auto;
}
.repdoc .sw {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  align-self: center;
}
.rephead p {
  margin: 2px 0 14px;
  color: var(--muted);
}
.repkpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}
.repkpi div {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 8px 10px;
}
.repkpi span {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
}
.repkpi b {
  font-size: 18px;
}
.rsec {
  margin-top: 26px;
}
.repblock {
  break-inside: avoid;
}
.repfig {
  margin: 0 0 14px;
  break-inside: avoid;
}
.repfig figcaption {
  font-weight: 600;
  margin-bottom: 4px;
}
.repplan,
.repschema svg,
.repdoc .chart svg {
  max-width: 100%;
  height: auto;
}
.repschema {
  overflow-x: auto;
  margin-bottom: 10px;
}
.repdoc table.calc {
  width: 100%;
  margin: 4px 0 8px;
}
.repdoc table.calc tr.grp td {
  font-family: var(--font-body);
  font-weight: 600;
  padding-top: 10px;
}
.repdoc table.calc tr.off td {
  color: var(--muted);
}
.repdoc table.kv td:first-child {
  width: 45%;
}
.repdoc table.calc th.txt {
  text-align: left;
}
.repdoc table.calc td.nw {
  white-space: nowrap;
}
.repdoc small.warn {
  color: var(--warn);
}
.repdoc .steps {
  margin: 0 0 8px;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.repdoc .sec {
  padding: 0;
  border: 0;
}
.repdoc .fields,
.repdoc input,
.repdoc select,
.repdoc .linkbtn,
.repdoc .row .btn {
  display: none !important;
}
.repdoc .crumb {
  pointer-events: none;
  color: inherit;
  text-decoration: none;
}
.repfoot {
  margin-top: 28px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
}
@media (max-width: 600px) {
  .report {
    padding: 8px;
  }
  .repdoc {
    padding: 16px;
  }
}
@media print {
  @page {
    margin: 14mm;
  }
  body.rep-open > *:not(.report) {
    display: none !important;
  }
  .report {
    position: static;
    padding: 0;
    overflow: visible;
    background: none;
  }
  .reptools {
    display: none;
  }
  html,
  body.rep-open {
    background: #fff !important;
    height: auto;
  }
  .repdoc {
    max-width: none;
    border: 0;
    box-shadow: none;
    padding: 0;
    border-radius: 0;
    font-size: 11px;
    background: none;
  }
  .repdoc table.calc td,
  .repdoc table.calc th {
    padding-top: 2px;
    padding-bottom: 2px;
  }
  .repdoc table.calc td small {
    display: inline;
    margin-left: 6px;
  }
  .repfig {
    display: inline-block;
    width: 49%;
    vertical-align: top;
  }
  .rsec {
    break-before: auto;
  }
  .rsec > h2 {
    break-after: avoid;
  }
  .repdoc table.calc tr {
    break-inside: avoid;
  }
}

/* underlay image: moving and measuring */
.stage.bgedit svg {
  cursor: crosshair;
}
.stage.dropping {
  outline: 3px dashed var(--accent);
  outline-offset: -6px;
}

/* appendages bij de warmtepomp */
.fitrow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: end;
}
.fitrow > label:first-child {
  grid-column: 1 / -1;
}
.fitrow .fitdp {
  font-size: 13px;
  padding-bottom: 10px;
  white-space: nowrap;
}
