/* Copyright (c) 2026. All rights reserved. See LICENSE. */
:root {
  --film: #e9ece8;        /* drafting film */
  --paper: #fbfbf9;       /* sheet */
  --graphite: #23272b;    /* lines, text */
  --lead: #5c636a;        /* secondary text */
  --rule: #cfd5d1;        /* hairlines */
  --rule-strong: #9aa39e;
  --blue: #7fb3c8;        /* non-photo blue: grid, focus, selection */
  --ink: #2b6f9e;         /* chart marks */
  --red: #c8322b;         /* redline: code issues only */
  --sheet-w: 360px;
  --rail-w: 56px;
  --font: "Archivo", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--film);
  color: var(--graphite);
  font: 400 15px/1.5 var(--font);
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* the frame: the rail of sizes, the controls, and the drawings over the aspects and the run board */
.app {
  display: grid; height: 100vh;
  grid-template-columns: var(--rail-w) var(--sheet-w) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto auto;
  grid-template-areas: "rail sheet film" "rail sheet aspects" "rail sheet run";
}
.app.side-off { grid-template-columns: var(--rail-w) 0 minmax(0, 1fr); }
/* hidden controls stay laid out off screen: the aspects and the rail still measure what each size and aspect holds */
.app.side-off .sheet { position: fixed; left: -10000px; top: 0; width: var(--sheet-w); height: 100vh; visibility: hidden; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---- the rail: the sizes, and the rule book, saved plans and settings ---------------- */
.rail {
  grid-area: rail; position: relative; z-index: 20;
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 0 12px;
  background: var(--graphite); color: #c9cfcb;
}
.rail-proj { position: relative; margin-bottom: 8px; padding: 0; cursor: pointer; list-style: none; border-radius: 8px; }
.rail-proj::-webkit-details-marker { display: none; }
.proj-tile {
  display: flex; align-items: center; justify-content: center; flex: none; width: 38px; height: 38px; border-radius: 8px;
  background: var(--tile, var(--ink)); color: var(--paper); font-size: 14px; font-weight: 700; letter-spacing: .02em;
}
.rail-proj:hover .proj-tile, .proj-pop[open] .proj-tile { box-shadow: 0 0 0 2px var(--paper); }
.proj-pop.pop-side .pop-body { top: 0; bottom: auto; width: 320px; padding: 8px 0 4px; }
.proj-head { display: flex; align-items: baseline; justify-content: space-between; padding: 2px 14px 6px; }
.proj-head .pop-title { margin: 0; }
.proj-head span { font-size: 12px; color: var(--lead); }
.proj-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 14px; border: 0; cursor: pointer;
  background: transparent; text-align: left;
}
.proj-item:hover { background: var(--film); }
.proj-item[aria-checked="true"] { background: #e6f0f4; }
.proj-item .proj-tile { width: 32px; height: 32px; border-radius: 7px; font-size: 12px; }
.proj-item-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.proj-item-txt b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-item-txt span { font-size: 12px; color: var(--lead); }
#proj-new { color: var(--ink); font-weight: 600; }
#proj-delete { color: var(--red); }
.proj-open {
  display: block; max-width: 100%; margin: 0 0 6px; padding: 0; border: 0; background: none; cursor: pointer;
  font-size: 12.5px; font-weight: 600; color: var(--lead); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.proj-open::after { content: " \25BE"; }
.proj-open:hover { color: var(--graphite); }
.rail-add { margin-bottom: 6px; color: var(--paper); box-shadow: inset 0 0 0 1.5px #6b7378; }
.rail-add svg { stroke-width: 2; }
.rail-sizes, .rail-tools { display: flex; flex-direction: column; gap: 2px; }
.rail-sizes { padding-top: 8px; border-top: 1px solid #4a5156; }
.rail-tools { margin-top: auto; }
.rail-btn {
  position: relative; display: flex; align-items: center; justify-content: center; flex: none;
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: 6px; cursor: pointer;
  background: transparent; color: #c9cfcb; list-style: none;
}
.rail-btn svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.rail-btn:hover { background: #3a4146; color: var(--paper); }
.rail-btn.bare { color: #7d858b; }
.rail-btn[aria-pressed="true"] { background: var(--paper); color: var(--graphite); }
.rail-btn.bare[aria-pressed="true"] { color: var(--lead); }
.rail .rail-btn.file-btn { display: flex; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #c9cfcb; }
.rail .rail-btn.file-btn:hover { background: #3a4146; color: var(--paper); }
.rail-btn .badge:not(:empty) {
  position: absolute; top: 3px; right: 0; min-width: 16px; margin: 0; padding: 0 4px;
  background: var(--blue); color: var(--graphite); font-size: 10px; line-height: 16px;
}
summary.rail-btn::-webkit-details-marker { display: none; }
/* each icon's name, on hover or keyboard focus */
.rail [data-label]:hover::after, .rail [data-label]:focus-visible::after {
  content: attr(data-label); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  z-index: 30; pointer-events: none; white-space: nowrap;
  padding: 5px 10px; border-radius: 4px; background: var(--graphite); color: var(--paper);
  font-size: 13px; font-weight: 600; line-height: 1.3; box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
}
.rail details[open] > summary::after { display: none; }

/* ---- popovers (details.pop): the settings, the generator, the trade-offs ---------------- */
.pop { position: relative; }
.pop > summary { list-style: none; cursor: pointer; }
.pop > summary::-webkit-details-marker { display: none; }
.pop-body {
  position: absolute; z-index: 40; width: 320px; padding: 12px 14px 14px;
  background: var(--paper); color: var(--graphite); border: 1px solid var(--graphite); border-radius: 4px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .22);
}
.pop-side .pop-body { left: calc(100% + 8px); bottom: 0; }
.pop-up .pop-body { left: 0; bottom: calc(100% + 8px); }
.pop-down .pop-body { left: 0; right: 0; top: calc(100% + 4px); width: auto; padding: 4px 0; }

/* ---- the project's buildings (project.js): a letter in each one's color ------------------------ */
.bld-tag {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 20px; height: 20px; border-radius: 3px; background: var(--tag, var(--graphite)); color: var(--paper);
  font-size: 11.5px; font-weight: 700; line-height: 1; font-stretch: 100%;
}
.bld-pop { flex: 1; min-width: 0; }
.bld-btn {
  display: flex; align-items: center; gap: 9px; padding: 5px 30px 5px 8px; position: relative;
  border: 1px solid var(--rule-strong); border-radius: 4px; background: var(--paper);
}
.bld-btn::after { content: "\25BE"; position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--lead); }
.bld-btn:hover, .bld-pop[open] .bld-btn { border-color: var(--graphite); }
.bld-btn .bld-tag { width: 26px; height: 26px; font-size: 14px; border-radius: 4px; }
.bld-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.bld-txt b { font-size: 15px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bld-item {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 12px; border: 0; cursor: pointer;
  background: transparent; text-align: left;
}
.bld-item:hover { background: var(--film); }
.bld-item[aria-checked="true"] { background: #e6f0f4; }
.bld-item-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bld-item-use { font-size: 12px; color: var(--lead); }
.bld-actions { display: flex; flex-direction: column; margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--rule); }
.bld-actions button { padding: 8px 12px; border: 0; background: none; cursor: pointer; text-align: left; font-size: 14px; }
.bld-actions button:hover { background: var(--film); }
#bld-add { color: var(--ink); font-weight: 600; }
#bld-remove { color: var(--lead); }
#scope-one .bld-tag { width: 16px; height: 16px; font-size: 10px; margin-right: 3px; vertical-align: -2px; }
.run-head .bld-tag, .hi-runs .bld-tag { width: 16px; height: 16px; font-size: 10px; margin-right: 5px; vertical-align: 1px; }
.bld-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; max-width: 1180px; margin: 0 auto 14px; }
.bld-filter .cap { margin-right: 4px; }
.bld-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px 4px 6px; border: 1px solid var(--rule-strong);
  border-radius: 14px; background: var(--paper); cursor: pointer; font-size: 13.5px;
}
.bld-pill:first-of-type { padding-left: 11px; }
.bld-pill .bld-tag { width: 18px; height: 18px; border-radius: 9px; }
.bld-pill[aria-pressed="true"] { background: var(--graphite); border-color: var(--graphite); color: var(--paper); }

/* ---- Add a building (project.js) -------------------------------------------------------------- */
.addb {
  width: min(1040px, calc(100vw - 32px)); height: min(780px, calc(100vh - 32px)); padding: 0;
  border: 1px solid var(--graphite); border-radius: 4px; background: var(--paper); color: var(--graphite);
  box-shadow: 0 24px 60px rgba(35, 39, 43, .35);
}
.addb[open] { display: flex; flex-direction: column; }
.addb::backdrop { background: rgba(35, 39, 43, .45); }
.addb-head { display: flex; align-items: flex-start; gap: 16px; padding: 16px 20px 12px; border-bottom: 1px solid var(--rule); }
.addb-head > div { flex: 1; }
.addb-head h2 { margin: 0; font-size: 32px; line-height: 1; font-weight: 740; font-stretch: 64%; }
.addb-head p { margin: 4px 0 0; font-size: 13.5px; color: var(--lead); max-width: 70ch; }
.addb-body { flex: 1; min-height: 0; display: flex; }
.addb-modes { flex: 0 0 210px; display: flex; flex-direction: column; padding: 10px 0; border-right: 1px solid var(--rule); }
.addb-modes button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 11px 18px 12px;
  border: 0; background: none; cursor: pointer; text-align: left;
}
.addb-modes b { font-size: 17px; font-weight: 680; font-stretch: 80%; }
.addb-modes span { font-size: 12.5px; color: var(--lead); }
.addb-modes button:hover { background: var(--film); }
.addb-modes button[aria-selected="true"] { background: #e6f0f4; box-shadow: inset 3px 0 0 var(--ink); }
.addb-modes button:focus-visible { outline-offset: -2px; }
.soon {
  display: inline-block; margin-left: 6px; padding: 0 5px; border: 1px solid var(--blue); border-radius: 3px;
  font-size: 10.5px; font-style: normal; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink);
  vertical-align: 2px;
}
.addb-pane { flex: 1; min-width: 0; overflow-y: auto; padding: 14px 20px 18px; background: #f3f5f2; }
.addb-pane h3 { margin: 0 0 4px; font-size: 22px; font-weight: 720; font-stretch: 68%; }
.addb-pane .hint { margin: 0 0 14px; max-width: 60ch; }
.addb-pane .cell { max-width: 520px; border: 1px solid var(--rule); background: var(--paper); }
.addb-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 12px; }
.addb-card {
  position: relative; display: flex; flex-direction: column; width: 100%; height: 100%; padding: 0; overflow: hidden;
  border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); cursor: pointer; text-align: left;
}
.addb-card .art {
  display: flex; align-items: center; justify-content: center; height: 124px; border-bottom: 1px solid #e3e8e5;
  background-color: #fff;
  background-image: linear-gradient(#eef1ee 1px, transparent 1px), linear-gradient(90deg, #eef1ee 1px, transparent 1px);
  background-size: 12px 12px;
}
.addb-card .art img { max-width: 100%; max-height: 118px; mix-blend-mode: multiply; }
.addb-card .name { padding: 7px 10px 0; font-size: 14.5px; font-weight: 650; line-height: 1.2; }
.addb-card .blurb { padding: 2px 10px 9px; font-size: 12px; line-height: 1.3; color: var(--lead); }
.addb-card:hover { border-color: var(--rule-strong); }
.addb-card[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.addb-card[aria-pressed="true"]::after {
  content: "\2713"; position: absolute; top: 7px; right: 7px; width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; background: var(--ink); color: var(--paper); font-size: 14px; font-weight: 700;
}
.addb-more { display: flex; flex-direction: column; gap: 3px; max-width: 420px; margin-top: 16px; }
.addb-more select { padding: 6px 8px; border: 1px solid var(--rule-strong); border-radius: 3px; background: var(--paper); font-size: 14px; }
.addb-pane textarea {
  width: 100%; max-width: 680px; padding: 10px 12px; border: 1px solid var(--rule-strong); border-radius: 4px;
  background: var(--paper); font: 15px/1.45 var(--font); resize: vertical;
}
.addb-later { font-size: 13px; color: var(--lead); }
.addb-later .soon { margin: 0 6px 0 0; }
.addb-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 20px; border-top: 1px solid var(--graphite); }
.addb-name { display: flex; align-items: center; gap: 8px; }
.addb-name input { width: 240px; padding: 7px 9px; border: 1px solid var(--rule-strong); border-radius: 3px; background: var(--paper); font-size: 14px; }
.addb-run { display: flex; align-items: center; gap: 7px; margin-right: auto; font-size: 14px; cursor: pointer; }
.addb-run input { width: 16px; height: 16px; accent-color: var(--graphite); }
.addb-foot .primary { width: auto; padding: 10px 18px; font-size: 15px; }
.addb-foot .ghost { padding: 9px 14px; }
.addb-where { display: flex; align-items: center; gap: 10px; flex-basis: 100%; }
.addb-where .seg { margin-top: 0; }
@media (max-width: 760px) {
  .addb-body { flex-direction: column; }
  .addb-modes { flex: none; flex-direction: row; overflow-x: auto; padding: 0; border-right: 0; border-bottom: 1px solid var(--rule); }
  .addb-modes button { flex: none; padding: 9px 14px; }
  .addb-modes span { display: none; }
  .addb-name input { width: 160px; }
}
.pop-body.pop-wide { width: min(460px, 90vw); max-height: 70vh; overflow-y: auto; padding: 0; }
.pop-wide .block { border-bottom: 0; padding-bottom: 6px; }
.pop-title { display: block; margin-bottom: 8px; font-size: 18px; font-weight: 700; font-stretch: 75%; }
#settings .cell { padding: 0; border: 0; }
.seg.seg-list { flex-direction: column; gap: 4px; overflow: visible; box-shadow: none; background: none; }
.seg.seg-list label { flex: none; }
.seg.seg-list span, .rb-field .seg.seg-list span { margin: 0; padding: 6px 10px 7px; text-align: left; white-space: normal; border-radius: 3px; }
.seg-list b { font-weight: 650; }
.seg-list .eta { display: inline; margin-left: 6px; }
.seg-list em { display: block; font-style: normal; font-size: 12px; line-height: 1.35; color: var(--lead); }
.seg-list input:checked + span em { color: inherit; opacity: .8; }

/* ---- parameter sheet (title-block cells) -------------------------------------- */
.sheet {
  background: var(--paper);
  border-right: 1px solid var(--rule-strong);
  display: flex; flex-direction: column;
  min-height: 0;
}
.sheet { grid-area: sheet; }
/* the controls' head: the project and building, then the size and what is at it */
.sheet-head { padding: 10px 16px 0; border-bottom: 1px solid var(--graphite); }
.sh-row { display: flex; align-items: flex-end; gap: 8px; }
.sh-hide {
  flex: none; width: 32px; height: 32px; padding: 0; border: 1px solid var(--rule); border-radius: 4px; cursor: pointer;
  background: var(--paper); color: var(--lead); font-size: 15px;
}
.sh-hide:hover { border-color: var(--graphite); color: var(--graphite); }
.at-name { margin: 12px 0 0; min-height: 18px; font-size: 12.5px; color: var(--lead); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.at-title { margin: 0 0 10px; font-size: 30px; line-height: 1.05; font-weight: 740; font-stretch: 64%; }
/* a heading over each aspect's blocks at the size, kept at the top of the list while its blocks scroll under it */
.at-aspect {
  position: sticky; top: 0; z-index: 2; margin: 0; padding: 0;
  background: var(--paper); border-bottom: 2px solid var(--graphite);
}
.at-aspect .fold {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 14px 20px 6px; border: 0; background: none; cursor: pointer;
  font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink); text-align: left;
}
.at-aspect .fold:focus-visible { outline-offset: -2px; }
/* the fold's chevron: down when open, right when folded */
.fold::before {
  content: ""; flex: none; width: 7px; height: 7px; margin: 0 2px 3px 1px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .12s;
}
.fold[aria-expanded="false"]::before { transform: translate(-2px, 2px) rotate(-45deg); }
.at-row { display: flex; align-items: flex-end; gap: 8px; }
.at-row .at-title { flex: 1; }
.at-fold {
  flex: none; margin: 0 0 12px; padding: 3px 9px; border: 1px solid var(--rule); border-radius: 3px; cursor: pointer;
  background: var(--paper); color: var(--lead); font-size: 13px;
}
.at-fold:hover { border-color: var(--graphite); color: var(--graphite); }
#params:not(.measuring) [data-off] { display: none !important; }
.at-empty { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px; }
.at-empty p { margin: 0; color: var(--lead); max-width: 40ch; }
.at-empty > button { align-self: flex-start; }
.at-jump { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.at-jump span { width: 100%; font-size: 12px; color: var(--lead); }
.at-rules { align-self: flex-start; padding: 2px 0; font-size: 17px; font-weight: 500; text-align: left; }

#params { flex: 1; overflow-y: auto; min-height: 0; }
.block { border: 0; margin: 0; padding: 14px 0 0; border-bottom: 1px solid var(--graphite); }
.block legend {
  float: left; width: 100%;
  padding: 0 20px 8px; font-size: 19px; font-weight: 650; font-stretch: 75%; cursor: pointer;
}
.block legend .fold {
  display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin: 0 6px 0 -6px; padding: 0;
  vertical-align: 1px; border: 0; background: none; color: var(--lead); cursor: pointer;
}
.block legend:hover .fold { color: var(--graphite); }
.block legend .fold::before { margin: 0 0 3px; }
.block legend .fold[aria-expanded="false"]::before { transform: translate(-1px, 1px) rotate(-45deg); }
/* a folded block: its legend alone */
.block.folded { padding: 10px 0 2px; }
.block.folded > :not(legend) { display: none !important; }
.hint { clear: both; margin: 0 20px 10px; color: var(--lead); font-size: 13px; max-width: 46ch; }

.cells { clear: both; display: grid; border-top: 1px solid var(--rule); }
.c4 { grid-template-columns: repeat(4, 1fr); }
.cell {
  display: flex; flex-direction: column; gap: 1px; min-width: 0;
  padding: 6px 10px 7px 12px;
  border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.cells .cell:nth-child(4n), .cells .span4, .cells .span2:nth-child(2n) { border-right: 0; }
.facade-layers { display: contents; }  /* a facade's layers: two rows of two cells each (app.js renderFacadeLayers) */
.facade-layers .cell { border-right: 1px solid var(--rule); }
.facade-layers .cell.end { border-right: 0; }
.facade-layers .cap button { float: right; border: 0; background: none; padding: 0 2px; color: var(--lead); cursor: pointer; font-size: 14px; line-height: 1; }
.addlayer { border: 0; background: none; padding: 2px 0; color: var(--blue); cursor: pointer; font: inherit; text-align: left; }
.span2 { grid-column: span 2; }
.span4 { grid-column: span 4; }
.cell:focus-within { background: #eef5f8; box-shadow: inset 2px 0 0 var(--blue); }
.cap { font-size: 12px; font-stretch: 75%; font-weight: 500; color: var(--lead); }
.cell input[type="text"], .cell input[type="number"] {
  width: 100%; border: 0; padding: 0; background: transparent;
  font-size: 18px; font-weight: 500; font-variant-numeric: tabular-nums;
}
.cell input:focus { outline: none; }
.cell.check { justify-content: space-between; }
.cell.check input { width: 18px; height: 18px; accent-color: var(--graphite); }
.unit-input { display: flex; align-items: baseline; gap: 4px; }
.unit-input i { font-style: normal; color: var(--lead); font-size: 13px; }

.seg { display: flex; margin-top: 3px; }
.seg label { flex: 1; position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span {
  display: block; text-align: center; padding: 4px 6px; font-size: 14px;
  border: 1px solid var(--rule-strong); margin-left: -1px;
}
.seg label:first-child span { border-radius: 3px 0 0 3px; margin-left: 0; }
.seg label:last-child span { border-radius: 0 3px 3px 0; }
.seg input:checked + span { background: var(--graphite); border-color: var(--graphite); color: var(--paper); }
.seg input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 1px; position: relative; z-index: 1; }

body[data-use="residential"] .com-only, body[data-use="commercial"] .res-only,
body[data-use="multifamily"] .res-only, body[data-use="multifamily"] .com-only,
body[data-use="mixed"] .res-only,
body:not([data-use="multifamily"]):not([data-use="mixed"]) .mf-only,
body:not([data-use="mixed"]) .mix-only,
body:not([data-use="commercial"]) .only-commercial, body:not([data-use="multifamily"]) .only-multifamily { display: none; }
body:not([data-mode="neighborhood"]) .nb-only, body[data-mode="neighborhood"] .house-only { display: none !important; }
body[data-system="frame"] .wall-only { visibility: hidden; }
.cell select { width: 100%; border: 0; padding: 0; background: transparent; font-size: 18px; font-weight: 500; }
.cell select:focus { outline: none; }

.outlines { clear: both; display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--rule); }
.otile {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0;
  padding: 9px 4px 7px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  color: var(--rule-strong); cursor: pointer;
}
.otile:nth-child(4n) { border-right: 0; }
.otile input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.oicon { display: flex; align-items: center; justify-content: center; width: 46px; height: 38px; }
.oicon svg { max-width: 100%; max-height: 100%; }
.olabel { font-size: 12px; line-height: 1.15; font-stretch: 75%; color: var(--lead); text-align: center; }
.otile:hover { color: var(--lead); }
.otile.on { color: var(--graphite); background: #eef2ef; }
.otile.on .olabel { color: var(--graphite); font-weight: 600; }
.otile:focus-within { box-shadow: inset 0 0 0 2px var(--blue); }
.outline-note { margin-top: 10px; }

.ranges { clear: both; width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ranges th {
  font-size: 12px; font-stretch: 75%; font-weight: 500; color: var(--lead); text-align: left;
  padding: 4px 12px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.ranges th:nth-child(n+2), .ranges td:nth-child(n+2) { width: 74px; text-align: right; }
.ranges td { padding: 0 12px; border-bottom: 1px solid var(--rule); height: 34px; }
.ranges td:first-child { font-size: 14px; }
.ranges tr.off td:first-child { color: var(--lead); }
.ranges tr.req td:first-child { font-weight: 600; }
.ranges.auto th:nth-child(2), .ranges.auto td:nth-child(2) { width: 48px; text-align: center; }
.ranges td.auto input { width: 16px; height: 16px; accent-color: var(--graphite); vertical-align: middle; }
.ranges tr.is-auto td:first-child { font-weight: 600; }
.ranges tr.is-auto input[type="number"] { color: var(--lead); }
.ranges tr.group td { font-size: 12px; font-stretch: 75%; font-weight: 500; color: var(--lead); height: 28px; padding-top: 8px; }
.ranges input {
  width: 52px; text-align: right; border: 1px solid transparent; border-radius: 3px; padding: 2px 4px;
  background: transparent; font-size: 15px;
}
.ranges input:hover { border-color: var(--rule); }
.ranges input:focus { outline: none; border-color: var(--blue); background: #eef5f8; }

/* ---- the aspects, along the bottom ------------------------------------------------------ */
.aspects { grid-area: aspects; display: flex; overflow-x: auto; background: var(--paper); border-top: 1px solid var(--graphite); }
.aspects::before {
  content: "Aspect"; flex: none; align-self: center; padding: 0 12px 0 16px;
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--lead);
}
.aspects button {
  flex: 1 0 auto; display: flex; flex-direction: column; align-items: flex-start; gap: 0;
  padding: 4px 14px 6px; border: 0; border-left: 1px solid var(--rule); border-top: 3px solid transparent; cursor: pointer;
  background: transparent; text-align: left;
}
.aspects button b { font-size: 16px; font-weight: 600; font-stretch: 80%; }
.aspects button span { font-size: 12px; color: var(--lead); white-space: nowrap; }
.aspects button:hover { background: var(--film); }
.aspects button[aria-pressed="true"] { background: #e6f0f4; border-top-color: var(--ink); }
.aspects button[aria-pressed="true"] b { font-weight: 750; }
.aspects button.bare b { color: var(--lead); font-weight: 450; }
.aspects button:focus-visible { outline-offset: -2px; }
.aspects button:disabled { cursor: default; background: transparent; }

/* ---- the run board: what to generate, how, and the runs ----------------------------------- */
.runboard {
  grid-area: run; display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 8px 16px 10px;
  background: var(--paper); border-top: 1px solid var(--graphite);
}
.rb-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 14px; }
.rb-field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rb-field > .seg { flex: none; margin-top: 0; }
.rb-field .seg span { padding: 4px 9px; font-size: 13.5px; white-space: nowrap; }
details.rb-field > summary { display: flex; flex-direction: column; gap: 2px; }
details.rb-field > summary b {
  display: block; padding: 4px 9px; border: 1px solid var(--rule-strong); border-radius: 3px;
  font-size: 13.5px; font-weight: 600; white-space: nowrap; background: var(--paper);
}
details.rb-field > summary b::after { content: " \25BE"; color: var(--lead); }
details.rb-field[open] > summary b { border-color: var(--graphite); }
.rb-num input {
  width: 68px; padding: 4px 6px; border: 1px solid var(--rule-strong); border-radius: 3px;
  background: var(--paper); font-size: 14px; font-variant-numeric: tabular-nums;
}
.rb-num input:focus { outline: none; border-color: var(--blue); background: #eef5f8; }
.runboard .go { flex: none; margin-left: auto; }
.runboard button.primary { width: auto; padding: 10px 18px; font-size: 16px; }
.runboard .go .secondary { padding: 10px 14px; font-size: 16px; }
.rb-queue { display: flex; align-items: center; gap: 12px; min-width: 0; }
.runboard .runs { flex: 1; display: flex; gap: 8px; min-width: 0; max-height: none; margin: 0; padding-bottom: 2px; overflow-x: auto; overflow-y: hidden; }
.runboard .run { flex: 0 0 260px; min-width: 0; overflow: hidden; padding: 6px 9px 7px; border: 1px solid var(--rule-strong); border-radius: 3px; background: var(--paper); }
.runboard .run:first-child { padding-top: 6px; }
.runboard .run.running { border-color: var(--ink); }
.runboard .run.queued { border-style: dashed; }
.runboard .estimate { flex: 0 1 360px; margin: 0; }
.runboard .estimate ul {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  margin: 1px 0 0; padding: 0; list-style: none; font-size: 12px; line-height: 1.35;
}
.runboard .estimate li { display: inline; margin: 0; }
.runboard .estimate li + li::before { content: " \B7  "; }
.runboard .error { flex: 0 1 320px; margin: 0; }
button.primary {
  width: 100%; padding: 12px 16px; border: 0; border-radius: 3px; cursor: pointer;
  background: var(--graphite); color: var(--paper);
  font-size: 17px; font-weight: 650; font-stretch: 87%;
}
button.primary:hover { background: #3a4046; }
button.primary:disabled { opacity: .55; cursor: progress; }
.go { display: flex; gap: 8px; }
/* what Generate will take (estimateUI): under the buttons, and under each effort and generator */
.estimate { margin: 8px 0 0; font-size: 13px; color: var(--lead); }
.estimate b { color: var(--graphite); font-weight: 650; font-variant-numeric: tabular-nums; }
.estimate.busy { opacity: .6; }
.estimate ul { margin: 4px 0 0; padding-left: 16px; }
.estimate li { margin: 2px 0; }
.seg .eta { display: block; font-style: normal; font-size: 11px; line-height: 1.2; color: var(--lead); font-variant-numeric: tabular-nums; }
.seg .eta:empty { display: none; }
.seg input:checked + span .eta { color: inherit; opacity: .75; }
.go .primary { flex: 1; min-width: 0; }
.go .secondary {
  padding: 12px 16px; border: 1px solid var(--graphite); border-radius: 3px; cursor: pointer;
  background: var(--paper); color: var(--graphite); white-space: nowrap;
  font-size: 17px; font-weight: 650; font-stretch: 87%;
}
button.stop::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 8px; background: currentColor; vertical-align: 1px; }
.go .secondary:hover { background: #eef0ee; }

/* generation timeline: one row per run, one segment per option */
.runs { list-style: none; margin: 0 0 12px; padding: 0; max-height: 30vh; overflow-y: auto; }
.run { padding: 7px 0 8px; border-bottom: 1px solid var(--rule); }
.run:first-child { padding-top: 0; }
.run-head { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.run-name { font-weight: 650; font-stretch: 87%; white-space: nowrap; }
.run.queued .run-name { font-weight: 500; color: var(--lead); }
.run-note { flex: 1; min-width: 0; color: var(--lead); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-t { color: var(--lead); font-variant-numeric: tabular-nums; white-space: nowrap; }
.run.failed .run-t { color: var(--red); }
.run-x { border: 0; background: none; padding: 0 2px; cursor: pointer; color: var(--lead); font-size: 16px; line-height: 1; }
.run-x:hover { color: var(--graphite); }
.run.done .run-x, .run.stopped .run-x, .run.failed .run-x, .runs:not(.has-queue) .run.running .run-x { display: none; }
.run-bar { display: flex; gap: 2px; height: 8px; margin-top: 5px; }
.run-bar.dense { gap: 1px; }
.seg { position: relative; flex: 1; min-width: 1px; overflow: hidden; cursor: pointer; background: var(--paper); box-shadow: inset 0 0 0 1px var(--rule-strong); }
.seg i { position: absolute; top: 0; bottom: 0; left: 0; width: 0; background: var(--blue); transition: width .35s linear; }
.seg:not(.searching) i { display: none; }
.seg.searching { box-shadow: inset 0 0 0 1px var(--ink); }
.seg.ready { background: var(--graphite); box-shadow: none; }
.seg.failed { background: var(--red); box-shadow: none; }
.seg.stopped { background: var(--rule); box-shadow: none; }
.run.queued .seg { cursor: default; box-shadow: inset 0 0 0 1px var(--rule); }
.error { color: var(--red); margin: 8px 0 0; font-size: 14px; min-height: 0; }
.error:empty { display: none; }

/* ---- drafting film --------------------------------------------------------------- */
.film {
  grid-area: film; display: flex; flex-direction: column; min-width: 0; min-height: 0;
  background-color: var(--film);
  background-image:
    linear-gradient(rgba(127,179,200,.30) 1px, transparent 1px),
    linear-gradient(90deg, rgba(127,179,200,.30) 1px, transparent 1px),
    linear-gradient(rgba(127,179,200,.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(127,179,200,.14) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
}
.bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 20px; background: var(--paper); border-bottom: 1px solid var(--rule-strong);
}
.tabs { display: flex; gap: 2px; }
.tabs button {
  border: 0; background: none; padding: 6px 10px; cursor: pointer; font-size: 16px; font-weight: 600;
  font-stretch: 87%; color: var(--lead); border-bottom: 2px solid transparent;
}
.tabs button[aria-selected="true"] { color: var(--graphite); border-bottom-color: var(--graphite); }
.tabs button:disabled { opacity: .45; cursor: default; }
#count-badge { font-variant-numeric: tabular-nums; color: var(--lead); font-weight: 500; }
.status { margin: 0; flex: 1; color: var(--lead); font-size: 14px; min-width: 12ch; font-variant-numeric: tabular-nums; }
.sheet-show { align-self: center; }
.file-btn, a.btn, button.ghost {
  display: inline-block; padding: 6px 12px; border: 1px solid var(--rule-strong); border-radius: 3px;
  background: var(--paper); cursor: pointer; font-size: 14px; text-decoration: none; color: var(--graphite);
}
.file-btn:hover, a.btn:hover, button.ghost:hover { border-color: var(--graphite); }
.file-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-btn:focus-within { outline: 2px solid var(--blue); outline-offset: 2px; }

#grid { flex: 1; overflow-y: auto; padding: 24px; min-height: 0; }
.empty { max-width: 1180px; margin: 4vh auto 0; }
.empty h2 { margin: 0 0 6px; font-size: 24px; font-weight: 650; font-stretch: 80%; }
.empty p { margin: 0; color: var(--lead); max-width: 64ch; }
.empty .free { margin-top: 8px; color: var(--graphite); font-weight: 600; }
/* the starting templates: a row of example buildings that scrolls sideways; a card loads its example and generates */
.starters-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.starters-nav { display: flex; gap: 6px; flex: none; }
.starters-nav .slide-arrow { width: 34px; height: 34px; font-size: 22px; opacity: 1; }
.starters-nav .slide-arrow:disabled { opacity: .35; cursor: default; border-color: var(--rule-strong); }
.starters {
  display: grid; grid-auto-flow: column; grid-auto-columns: 252px; gap: 16px;
  margin: 0; padding: 2px 2px 14px; list-style: none;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding: 2px; scrollbar-width: thin;
}
.starters li { scroll-snap-align: start; display: flex; }
.starter {
  flex: 1; display: flex; flex-direction: column; text-align: left; padding: 0; cursor: pointer;
  background: var(--paper); border: 1px solid var(--rule-strong); border-radius: 2px;
}
.starter:hover { border-color: var(--graphite); }
.starter .art { position: relative; aspect-ratio: 4 / 3; border-bottom: 1px solid var(--rule); overflow: hidden; background: #fff; }
.starter img { position: absolute; inset: 10px; width: calc(100% - 20px); height: calc(100% - 20px); object-fit: contain; }
.starter .name { padding: 9px 12px 0; font-size: 17px; font-weight: 650; font-stretch: 80%; line-height: 1.25; }
.starter .blurb { padding: 2px 12px 11px; color: var(--lead); font-size: 13px; }
.sheets { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 22px; }

/* ---- neighborhood site plan (inline SVG, so lots can be hovered and clicked) ----------- */
.site { margin: 0 0 22px; background: var(--paper); border: 1px solid var(--rule-strong); border-radius: 2px; }
.site-view { position: relative; overflow: hidden; cursor: grab; }
.site-view:focus { outline: none; }
.site-view:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.site-view.dragging, .site-view.dragging .nb-lot { cursor: grabbing !important; }
.site-view.zoomed { touch-action: none; }
.site-art { padding: 10px; }
.site-art svg { display: block; width: 100%; height: auto; max-height: 78vh; user-select: none; }
.site-hint {
  position: absolute; inset: 0; margin: 0; display: grid; place-items: center; pointer-events: none;
  background: rgba(32,36,40,.45); color: #fff; font-size: 17px; font-weight: 600;
  opacity: 0; transition: opacity .25s;
}
.site-hint.on { opacity: 1; }
.site figcaption { padding: 9px 12px 11px; border-top: 1px solid var(--rule); color: var(--lead); font-size: 13px; }
.site-ctl { position: absolute; right: 14px; bottom: 14px; display: flex; gap: 8px; }
.site-ctl .zoom { position: static; }
.site-ctl button { display: grid; place-items: center; }
#site-north svg { transition: transform .15s; }
.site-scale {
  position: absolute; left: 14px; bottom: 14px; display: flex; align-items: center; gap: 8px; pointer-events: none;
  font-size: 12px; color: var(--graphite); font-variant-numeric: tabular-nums;
}
.site-scale .bar { height: 6px; border: 1px solid var(--graphite); border-top: 0; }
/* Neighborhood mode: an open site plan is the canvas and fills the pane; the homes live on their
   lots, so the board rows are hidden under it. */
body[data-mode="neighborhood"] #grid:not([hidden]):has(> .site:not([hidden])) { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
body[data-mode="neighborhood"] #grid:has(> .site:not([hidden])) > .boards { display: none; }
body[data-mode="neighborhood"] .site:not([hidden]) { flex: 1; display: flex; flex-direction: column; min-height: 0; margin: 0; border: 0; border-radius: 0; }
body[data-mode="neighborhood"] .site-view { flex: 1; min-height: 0; }
body[data-mode="neighborhood"] .site-art { position: absolute; inset: 0; padding: 0; }
body[data-mode="neighborhood"] .site-art svg { width: 100%; height: 100%; max-height: none; }
#site-art .nb-lot.queued .nb-env { opacity: .45; }
#site-art .nb-lot.searching .nb-parcel { fill: #eef5f8; }
#site-art .nb-lot.searching .nb-env { stroke: var(--ink); animation: nb-pulse 1.2s ease-in-out infinite alternate; }
#site-art .nb-lot.failed .nb-parcel { fill: #fbecea; }
#site-art .nb-lot.ready { cursor: pointer; }
#site-art .nb-lot.ready:hover .nb-parcel, #site-art .nb-lot[aria-current] .nb-parcel { fill: #e2eef3; }
#site-art .nb-lot:focus { outline: none; }
#site-art .nb-lot:focus-visible .nb-parcel { stroke: var(--blue); stroke-width: 3; }
@keyframes nb-pulse { from { opacity: .35; } to { opacity: 1; } }

.plan {
  display: flex; flex-direction: column; text-align: left; padding: 0; cursor: pointer;
  background: var(--paper); border: 1px solid var(--rule-strong); border-radius: 2px;
}
.plan:hover { border-color: var(--graphite); }
.plan[aria-current="true"] { outline: 2px solid var(--blue); outline-offset: 2px; }
.plan .art { position: relative; aspect-ratio: 16 / 9; border-bottom: 1px solid var(--rule); overflow: hidden; }
.plan img { position: absolute; inset: 10px; width: calc(100% - 20px); height: calc(100% - 20px); object-fit: contain; }
.plan.pending .art { display: grid; place-items: center; }
.plan .cap-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 9px 12px 11px; }
.plan h3 { margin: 0; font-size: 17px; font-weight: 650; font-stretch: 80%; }
.plan .meta { margin: 0; color: var(--lead); font-size: 13px; font-variant-numeric: tabular-nums; grid-column: 1; }
.plan .verdict { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.verdict.ok { color: var(--graphite); }
.verdict.bad { color: var(--red); }
.verdict svg { flex: none; }
.plan.pending { cursor: default; border-style: dashed; background: rgba(251,251,249,.55); }
.plan.pending .art { color: var(--lead); font-size: 14px; }
.plan.pending:hover { border-color: var(--rule-strong); }
.plan.pending[data-live] { background: var(--paper); }
.plan.pending img.live { opacity: .9; }
.plan .progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--rule); }
.plan .progress span { display: block; height: 100%; width: 0; background: var(--blue); transition: width .35s linear; }
.plan.arrived .art img { animation: plot .7s steps(14, end) both; }
@keyframes plot { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
/* option card carousel: arrows and the drawing's name over the card's art (the card stays one button) */
.card { position: relative; display: grid; }
.slides-nav { position: absolute; left: 1px; right: 1px; top: 1px; aspect-ratio: 16 / 9; pointer-events: none;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; padding: 6px; }
.slide-arrow { pointer-events: auto; flex: none; width: 28px; height: 28px; padding: 0; border: 1px solid var(--rule-strong);
  border-radius: 50%; background: var(--paper); color: var(--graphite); font-size: 18px; line-height: 1; cursor: pointer; opacity: .8; }
.slide-arrow:hover, .slide-arrow:focus-visible { opacity: 1; border-color: var(--graphite); }
.slide-label { min-width: 0; padding: 1px 6px; background: var(--paper); color: var(--lead); font-size: 12px;
  font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- analysis --------------------------------------------------------------------- */
#analysis { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#analysis[hidden] { display: none; }
.an-head { display: flex; align-items: center; gap: 16px; padding: 12px 20px; flex-wrap: wrap; background: var(--paper); }
.an-title { flex: 1; min-width: 200px; }
.an-title h2 { margin: 0; font-size: 26px; line-height: 1.1; font-weight: 700; font-stretch: 70%; }
.an-title p { margin: 2px 0 0; color: var(--lead); font-size: 14px; font-variant-numeric: tabular-nums; }
/* a lot of several buildings: the lot, or one of its buildings as a plan of its own (app.js lotScope) */
.an-scope { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.an-scope .bld-pill:first-of-type { padding-left: 11px; }
.toggle { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.toggle input { accent-color: var(--red); width: 16px; height: 16px; }
.an-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 380px; min-height: 0; border-top: 1px solid var(--rule-strong); }
.viewer { position: relative; overflow: hidden; cursor: grab; background: var(--film); min-height: 320px; }
.viewer.dragging { cursor: grabbing; }
.stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.stage img { display: block; user-select: none; -webkit-user-drag: none; background: #fff; box-shadow: 0 1px 2px rgba(35,39,43,.18), 0 6px 22px rgba(35,39,43,.16); }
.viewer.blueprint { background: #0b2a4f; }
.viewer.blueprint .stage img { filter: url(#blueprint-ink); box-shadow: 0 6px 26px rgba(0,0,0,.45); }
.toggle.bp input { accent-color: #1f4f8a; }
.toggle.sc input { accent-color: #4f6b45; }
.site-ctl button[aria-pressed="true"] { background: var(--graphite); color: var(--paper); }
/* an option's sheet or 3D model still drawing: a spinner, never the last option's drawing */
.viewer.loading .stage, .model3d.loading .m3-view { visibility: hidden; }
.viewer.loading::after, .model3d.loading::after { content: ""; position: absolute; left: 50%; top: 50%; width: 28px; height: 28px;
  margin: -14px 0 0 -14px; border: 3px solid var(--rule); border-top-color: var(--lead); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.zoom { position: absolute; right: 14px; bottom: 14px; display: flex; background: var(--paper); border: 1px solid var(--rule-strong); border-radius: 3px; }
.zoom button { border: 0; background: none; padding: 6px 12px; cursor: pointer; font-size: 15px; min-width: 38px; }
.zoom button + button { border-left: 1px solid var(--rule); }

/* sheet nav: every sheet of the set, grouped by discipline, in a column down the drawing's left side
   (a row above it on narrow screens) */
.an-canvas { display: flex; min-width: 0; min-height: 0; }
.an-canvas .viewer { flex: 1 1 auto; min-width: 0; }
.sheet-nav {
  position: relative; flex: none; display: flex; flex-direction: column; width: 196px; overflow: hidden auto; padding: 8px 0 12px;
  border-right: 1px solid var(--rule-strong); scrollbar-width: thin; overscroll-behavior: contain;
  /* edge shadows while more sheets are scrolled out of view: the paper covers them at either end */
  background:
    linear-gradient(var(--paper) 40%, rgba(251,251,249,0)) top / 100% 36px no-repeat local,
    linear-gradient(0deg, var(--paper) 40%, rgba(251,251,249,0)) bottom / 100% 36px no-repeat local,
    radial-gradient(farthest-side at 50% 0, rgba(35,39,43,.22), transparent) top / 100% 12px no-repeat scroll,
    radial-gradient(farthest-side at 50% 100%, rgba(35,39,43,.22), transparent) bottom / 100% 12px no-repeat scroll,
    var(--paper);
}
.sheet-nav:empty { display: none; }
.sn-group { flex: none; display: flex; flex-direction: column; }
.sn-group + .sn-group { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--rule); }
.sn-cap { padding: 2px 14px 3px; color: var(--lead); font-size: 11px; font-weight: 600; font-stretch: 87%; letter-spacing: .05em; text-transform: uppercase; }
.sn-tabs { display: flex; flex-direction: column; }
.sheet-nav button {
  display: flex; align-items: baseline; gap: 8px; min-width: 0; padding: 4px 12px 4px 11px; white-space: nowrap; cursor: pointer;
  border: 0; border-left: 3px solid transparent; background: none; color: var(--lead); font-size: 14px; text-align: left;
}
.sheet-nav button b { flex: none; width: 42px; font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; }
.sheet-nav button span { overflow: hidden; text-overflow: ellipsis; }
.sheet-nav button:hover { color: var(--graphite); background: var(--film); }
.sheet-nav button[aria-current="page"] { color: var(--graphite); border-left-color: var(--graphite); background: var(--film); }
.sheet-nav button:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
@media (max-width: 960px) {
  .an-canvas { flex-direction: column; }
  .sheet-nav {
    flex-direction: row; width: auto; overflow: auto hidden; padding: 6px 10px 0; border-right: 0; border-bottom: 1px solid var(--rule-strong);
    background:
      linear-gradient(90deg, var(--paper) 40%, rgba(251,251,249,0)) left / 36px 100% no-repeat local,
      linear-gradient(270deg, var(--paper) 40%, rgba(251,251,249,0)) right / 36px 100% no-repeat local,
      radial-gradient(farthest-side at 0 50%, rgba(35,39,43,.22), transparent) left / 12px 100% no-repeat scroll,
      radial-gradient(farthest-side at 100% 50%, rgba(35,39,43,.22), transparent) right / 12px 100% no-repeat scroll,
      var(--paper);
  }
  .sn-group { padding: 0 6px; }
  .sn-group + .sn-group { margin-top: 0; padding-top: 0; border-top: 0; border-left: 1px solid var(--rule); }
  .sn-cap { position: sticky; left: 0; align-self: flex-start; padding: 0 8px; }
  .sn-tabs { flex-direction: row; gap: 2px; }
  .sheet-nav button { padding: 3px 8px 6px; border-left: 0; border-bottom: 2px solid transparent; }
  .sheet-nav button b { width: auto; }
  .sheet-nav button:hover, .sheet-nav button[aria-current="page"] { background: none; }
  .sheet-nav button[aria-current="page"] { border-bottom-color: var(--graphite); }
}

/* downloads menu */
.menu { position: relative; margin-left: auto; }
.menu > button { display: inline-flex; align-items: center; gap: 6px; }
.menu > button[aria-expanded="true"] { border-color: var(--graphite); }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 5; display: grid; min-width: 210px; padding: 4px 0;
  background: var(--paper); border: 1px solid var(--rule-strong); border-radius: 3px; box-shadow: 0 6px 22px rgba(35,39,43,.16);
}
.menu-list[hidden] { display: none; }
.menu-list [role="menuitem"] {
  display: flex; justify-content: space-between; align-items: baseline; gap: 18px; padding: 7px 12px; cursor: pointer;
  border: 0; background: none; color: var(--graphite); font-size: 14px; text-align: left; text-decoration: none;
}
.menu-list [role="menuitem"]:hover, .menu-list [role="menuitem"]:focus-visible { background: var(--film); outline: none; }
.menu-list [role="menuitem"]:disabled, .menu-list a:not([href]) { color: var(--lead); cursor: default; background: none; }
.menu-list small { color: var(--lead); font-size: 12px; letter-spacing: .04em; }


/* ---- 3D view (static/model3d.js): the IFC model in place of the sheet, its controls over it ----------- */
.an-canvas .viewer[hidden], .model3d[hidden] { display: none; }
.model3d { position: relative; flex: 1 1 auto; min-width: 0; min-height: 320px; overflow: hidden; background: var(--film); outline: none; }
.model3d:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.m3-view { position: absolute; inset: 0; }
.m3-view canvas { display: block; touch-action: none; }
.m3-layers { gap: 4px; max-width: calc(100% - 28px); }
.m3-layers .chip { padding: 2px 8px 2px 6px; font-size: 12.5px; gap: 5px; }
.m3-layers .chip input { width: 13px; height: 13px; }
.m3-subs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; flex-basis: 100%; }
.m3-subs:empty { display: none; }
.m3-subs-l { font-size: 12px; color: var(--lead); margin-right: 2px; }
.m3-ctl { position: absolute; left: 14px; bottom: 14px; display: flex; flex-wrap: wrap; gap: 6px; max-width: calc(100% - 260px); }
.m3-field {
  display: flex; align-items: center; gap: 6px; padding: 4px 10px; font-size: 13px;
  background: var(--paper); border: 1px solid var(--rule-strong); border-radius: 14px;
}
.m3-field select { font: inherit; border: 0; background: none; color: inherit; }
.m3-field input[type=range] { width: 110px; margin: 0; accent-color: var(--graphite); }
.m3-field:has(input:disabled) { opacity: .45; }
.m3-sun-t { min-width: 36px; font-variant-numeric: tabular-nums; }
.m3-views button { font-size: 13px; min-width: 0; }
.m3-ctl > button {
  padding: 4px 12px; font-size: 13px; cursor: pointer; color: var(--graphite);
  background: var(--paper); border: 1px solid var(--rule-strong); border-radius: 14px;
}
.m3-ctl > button[aria-pressed="true"] { color: var(--paper); background: var(--graphite); border-color: var(--paper); box-shadow: 0 0 0 1px var(--graphite); }
.m3-samples { align-self: center; padding: 2px 8px; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--lead); background: rgba(251,251,249,.85); border-radius: 10px; }
.m3-samples[hidden] { display: none; }
.m3-tip {
  position: absolute; z-index: 3; pointer-events: none; max-width: 340px; padding: 3px 8px; font-size: 12.5px; white-space: nowrap;
  color: #fff; background: rgba(35,39,43,.86); border-radius: 3px;
}
.m3-tip[hidden] { display: none; }
.m3-room {
  padding: 1px 6px; font-size: 12px; font-weight: 600; white-space: nowrap; pointer-events: none;
  color: var(--graphite); background: rgba(251,251,249,.88); border: 1px solid var(--rule); border-radius: 3px;
}

/* ---- drawing layers ------------------------------------------------------------------- */
.layers { position: absolute; left: 14px; top: 14px; display: flex; flex-wrap: wrap; gap: 6px; max-width: calc(100% - 28px); }
.layers .chip {
  display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; font-size: 13px; cursor: pointer;
  background: var(--paper); border: 1px solid var(--rule-strong); border-radius: 14px; user-select: none;
}
.layers .chip input { width: 14px; height: 14px; margin: 0; accent-color: var(--chip, var(--graphite)); }
.layers .chip:has(input:checked) { border-color: var(--chip, var(--graphite)); }
.layers .chip:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 1px; }
.chip.L-clearances { --chip: #2b6cb0; }
.chip.L-power { --chip: #7a3e9d; }
.chip.L-lighting { --chip: #b7791f; }
.chip.L-plumbing { --chip: #2f855a; }
.chip.L-ventilation { --chip: #4a5568; }

/* ---- rules ------------------------------------------------------------------------------ */
.badge:not(:empty) {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px;
  background: var(--graphite); color: var(--paper); font-size: 11px; line-height: 18px; text-align: center;
}
#rulebook, #library { flex: 1; overflow-y: auto; min-height: 0; background: var(--paper); }
#rulebook[hidden], #library[hidden] { display: none; }

/* the rooms table's template picker, under a room's name */
#rooms td.has-tpl { padding-top: 4px; padding-bottom: 4px; }
#rooms td.has-tpl > span { display: block; }
#rooms select.tpl { width: 100%; margin-top: 2px; padding: 1px 4px; border: 1px solid var(--rule); border-radius: 3px; background: var(--paper);
  font-size: 12px; color: var(--lead); }
#rooms select.tpl:focus { outline: none; border-color: var(--blue); }

/* ---- boards: the current one on top, then the history, newest first ----------------------- */
.board { border-top: 1px solid var(--rule-strong); padding: 12px 0 26px; }
#board-now .board { border-top: 0; padding-top: 0; }
.board .sheets { margin-top: 12px; }
.board:not(.filled) .sheets { min-height: 250px; } /* a saved row's cards load as it nears the view */
.hist-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; padding: 14px 0 2px; border-top: 2px solid var(--graphite); }
.hist-head[hidden] { display: none; }
#board-now:empty + .hist-head { padding-top: 0; border-top: 0; }
.hist-head h2 { margin: 0; font-size: 22px; line-height: 1.1; font-weight: 700; font-stretch: 70%; }
.hist-head .note { flex: 1; margin: 0; color: var(--lead); font-size: 13px; }
.hist-head button { padding: 4px 10px; font-size: 13px; }
.hi-day { margin: 18px 0 8px; font-size: 13px; font-weight: 600; font-stretch: 80%; color: var(--lead); text-transform: uppercase; letter-spacing: .04em; }
.hi-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hi-top h4 { margin: 0; font-size: 18px; font-weight: 650; font-stretch: 80%; font-variant-numeric: tabular-nums; }
.hi-sum { flex: 1; color: var(--lead); font-size: 14px; }
.hi-live { font-size: 13px; font-weight: 600; }
.hi-top button { padding: 4px 10px; font-size: 13px; }
.hi-runs { list-style: none; margin: 6px 0 0; padding: 0; font-size: 14px; }
.hi-runs li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 12px; align-items: baseline; padding: 3px 0; }
.hi-detail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hi-stat { color: var(--lead); font-size: 13px; font-variant-numeric: tabular-nums; }
button.link { border: 0; background: none; padding: 0; cursor: pointer; font-size: 13px; color: var(--graphite); text-decoration: underline; text-underline-offset: 2px; }
button.link:hover { text-decoration-thickness: 2px; }

/* ---- About: what this is and how to start (a dialog, on the first visit and from the top bar) ---- */
.about {
  width: min(600px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0;
  border: 1px solid var(--graphite); border-radius: 3px; background: var(--paper); color: var(--graphite);
  box-shadow: 0 18px 48px rgba(35,39,43,.25);
}
.about:focus { outline: none; }
.about::backdrop { background: rgba(35,39,43,.45); }
.about form { padding: 22px 24px 20px; }
.about header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding-bottom: 12px; border-bottom: 1px solid var(--graphite);
}
.about h2 { margin: 0; font-size: 46px; line-height: .95; font-weight: 760; font-stretch: 62%; letter-spacing: -.01em; }
.about-x { border: 0; background: none; padding: 0 4px; cursor: pointer; font-size: 26px; line-height: 1; color: var(--lead); }
.about-x:hover { color: var(--graphite); }
.about-lede { margin: 14px 0 0; }
.about-free { margin: 12px 0 0; padding: 8px 12px; background: var(--film); box-shadow: inset 3px 0 0 var(--graphite); }
.about h3 { margin: 20px 0 8px; font-size: 19px; font-weight: 650; font-stretch: 75%; }
.about-uses { margin: 0; font-size: 14px; }
.about-uses dt { font-weight: 600; }
.about-uses dd { margin: 0 0 8px; color: var(--lead); }
.about-steps { margin: 0; padding-left: 22px; }
.about-steps li { margin: 0 0 6px; padding-left: 4px; }
.about-keys { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
.about-keys dt { font-weight: 600; }
.about-keys dd { margin: 0; color: var(--lead); }
.about kbd {
  display: inline-block; min-width: 1.7em; padding: 0 5px; text-align: center;
  border: 1px solid var(--rule-strong); border-bottom-width: 2px; border-radius: 3px;
  background: #fff; color: var(--graphite); font: 600 12px/1.5 var(--font);
}
.about .keys { white-space: nowrap; }
.about-note { margin: 18px 0 0; font-size: 13px; color: var(--lead); }
.about-contact { margin: 6px 0 0; font-size: 13px; color: var(--lead); }
.about-contact a { color: var(--graphite); }
.about footer { display: flex; justify-content: flex-end; margin-top: 18px; }
.about footer .primary { width: auto; padding: 10px 32px; }
@media (max-width: 560px) {
  .about form { padding: 18px 16px 16px; }
  .about-keys { grid-template-columns: 1fr; gap: 0; }
  .about-keys dd { margin-bottom: 8px; }
}


@media (max-width: 960px) {
  /* one column: the rail along the top, then the aspects, the controls, the run board and the drawings */
  .app, .app.side-off {
    grid-template-columns: minmax(0, 1fr); grid-template-rows: none; height: auto;
    grid-template-areas: "rail" "aspects" "sheet" "run" "film";
  }
  .app.side-off .sheet { position: static; width: auto; height: auto; visibility: visible; }
  .sh-hide, .sheet-show { display: none !important; }
  .rail { position: sticky; top: 0; flex-direction: row; padding: 6px 10px; overflow-x: auto; }
  .rail-proj { margin: 0 6px 0 0; }
  .proj-pop .pop-body { top: 60px; left: 10px; right: auto; }
  .rail-sizes, .rail-tools { flex-direction: row; }
  .rail-sizes { padding: 0 0 0 6px; border-top: 0; border-left: 1px solid #4a5156; }
  .rail-tools { margin: 0 0 0 auto; }
  .rail [data-label]:hover::after, .rail [data-label]:focus-visible::after { display: none; }
  .pop-side .pop-body { position: fixed; top: 60px; right: 10px; left: auto; bottom: auto; }
  .rail-btn { width: 40px; height: 40px; }
  .aspects { border-top: 0; border-bottom: 1px solid var(--graphite); }
  .aspects::before { display: none; }
  .aspects button span { display: none; }
  .at-aspect { position: static; }
  .rb-queue { flex-wrap: wrap; }
  .runboard { border-bottom: 1px solid var(--graphite); }
  .runboard .go { width: 100%; margin-left: 0; }
  .runboard .go .primary { flex: 1; }
  .sheet { border-right: 0; border-bottom: 1px solid var(--rule-strong); }
  #params { overflow: visible; }
  .film { min-height: 100vh; }
  .an-body { grid-template-columns: 1fr; }
  .viewer, .model3d { height: 60vh; }
  .m3-ctl { max-width: calc(100% - 28px); bottom: 56px; }
  .report { border-left: 0; border-top: 1px solid var(--rule-strong); }
  .starters { grid-auto-columns: min(252px, 78%); }
  .starters-nav { display: none; }
  #grid { padding: 16px; }
  .bar { padding: 10px 16px; }
  .rb-head, .rule-list { padding-left: 16px; padding-right: 16px; }
  .lib { grid-template-columns: minmax(0, 1fr); }
  .lib-list { border-right: 0; border-bottom: 1px solid var(--rule); padding-left: 16px; }
  .lib-ed { padding-left: 16px; padding-right: 16px; }
  .hi-runs li { grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; }
  .hi-stat, .hi-runs .link { grid-column: 2; justify-self: start; }
  .rule-table tr { display: grid; grid-template-columns: 1fr auto; border-top: 1px solid var(--rule); padding: 6px 0; }
  .rule-table td { border-top: 0; padding: 2px 8px 2px 0; }
  .rule-table .rl, .rule-table .rd { grid-column: 1 / -1; width: auto; }
  .rule-table .rv { width: auto; }
  .rule-table .rv input[type="text"] { min-width: 0; }
  .rule-table tr.changed td:first-child { box-shadow: none; padding-left: 0; }
  .rule-table tr.changed { box-shadow: inset 3px 0 0 var(--ink); padding-left: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .plan.arrived .art img { animation: none; }
  #site-art .nb-lot.searching .nb-env { animation: none; }
  .viewer.loading::after, .model3d.loading::after { animation: nb-pulse 1.2s ease-in-out infinite alternate; }
  .plan .progress span, .seg i { transition: none; }
}

/* the Drawn profile's line editor (profile.js) */
.line-edit { display: block; width: calc(100% - 40px); max-height: 240px; margin: 12px 20px 6px; background: var(--paper);
  border: 1px solid var(--rule); border-radius: 2px; touch-action: none; cursor: crosshair; }
.line-edit .bld { fill: none; stroke: var(--rule-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.line-edit .plate { stroke: var(--rule-strong); stroke-width: 1; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.line-edit .rl { fill: none; stroke: var(--graphite); stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.line-edit .rp { fill: var(--paper); stroke: var(--graphite); stroke-width: 1.5; cursor: grab; vector-effect: non-scaling-stroke; }
.line-edit .rp:hover, .line-edit .rp:focus { outline: none; fill: var(--blue); }
.line-note { margin: 0 20px 12px; color: var(--lead); font-size: 13px; max-width: 46ch; }
.line-note:empty { display: none; }
.line-note.error { color: var(--red); }
.cap i { font-style: normal; }

/* parking (parking.js): the ways allowed wrap to a second row in a narrow sidebar; "no parking" greys them */
#parking-block .pk-allow + .pk-allow { margin-top: 4px; }
#parking-block .pk-sub { margin: 0; padding: 10px 12px 0; }
#parking-block .pk-off { opacity: .4; }

/* mixed use: the uses table over a section of the floors they get (top floors at the top) */
.ranges td.note { color: var(--lead); font-size: 13px; text-align: right; }
.uses-stack { display: flex; flex-direction: column; height: 132px; margin: 12px 12px 0; border: 1px solid var(--graphite);
  background: var(--paper); font-size: 12px; }
.uses-stack .band { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 0 8px;
  min-height: 20px; border-top: 1px solid var(--graphite); overflow: hidden; }
.uses-stack .band:first-child { border-top: 0; }
.uses-stack .band b { font-weight: 600; }
.uses-stack .band span { color: var(--lead); font-variant-numeric: tabular-nums; }
.uses-stack .band.office { background: var(--film); }
.uses-stack .band.ground { flex: none; background: var(--rule); }
.uses-stack .band.split { background: repeating-linear-gradient(135deg, var(--paper) 0 4px, var(--rule) 4px 5px); }
.uses-note { margin: 8px 12px 0; }
.uses-note.error { color: var(--red); }
#uses-block .cells { margin-top: 10px; }
body:not(.use-on-office) .use-office, body:not(.use-on-retail) .use-retail,
body:not(.use-on-multifamily) .use-multifamily { display: none; }
#tradeoff-block .to-off { opacity: .4; }
#to-picks { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin-top: 6px; font-size: 13px; }
#to-picks label { display: flex; align-items: center; gap: 6px; }
#to-picks input { accent-color: var(--graphite); }
.rule-stale { display: block; margin-top: 4px; color: var(--lead); font-size: 12px; white-space: normal; max-width: 36ch; }
