/* The memo's regions. Shared by the app (loaded before styles.css) and the saved one-file memo,
   which has only this stylesheet and no web font (its CSP allows inline style only).
   Tokens are named in DESIGN.md. */

:root {
  --fog: #f4f5f7;
  --paper: #ffffff;
  --ink: #1b1d21;
  --slate: #5d6470;
  --rule: #e3e5e9;
  --rule-strong: #cfd3d9;
  --moss: #2f5247;
  --moss-soft: rgb(47 82 71 / 11%);
  --brick: #9c3b2e;
  --brick-soft: rgb(156 59 46 / 10%);
  --amber: #8a6016;
  --amber-soft: rgb(138 96 22 / 12%);
  --hover: rgb(27 29 33 / 5%);
  --focus: #3b6fe8;
  --sans: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r-control: 8px;
  --r-card: 12px;
  --r-float: 16px;
  --shadow-float: 0 1px 2px rgb(27 29 33 / 6%), 0 8px 24px -8px rgb(27 29 33 / 18%);
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font: 400 16px/1.5 var(--sans);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Saved file only: one document column. The app lays out its own surface. */
body > main {
  max-width: 820px;
  margin: 0 auto;
  padding: 40px 24px 56px;
}

body > main > h1 {
  font: 600 15px/20px var(--sans);
  color: var(--slate);
  margin: 0 0 20px;
}

body > main #sections {
  display: flex;
  flex-direction: column;
}

.memo-block {
  border-top: 1px solid var(--rule);
  padding: 24px 0 8px;
}

.memo-block:first-child {
  border-top: 0;
  padding-top: 0;
}

[data-block="summary"] { order: 0; }
[data-block="questions"] { order: 1; }
[data-block="parcel"] { order: 2; }
[data-block="zoning"] { order: 3; }
[data-block="permits"] { order: 4; }
[data-block="flood"] { order: 5; }
[data-block="goal"] { order: 6; }
[data-block="rules"] { order: 7; }
[data-block="photos"] { order: 8; }
[data-block="repairs"] { order: 9; }
[data-block="money"] { order: 10; }

/* ---------- Regions ---------- */

section[data-section] {
  min-width: 0;
  overflow-wrap: anywhere;
}

:where(section[data-section]) h2 {
  font: 600 18px/26px var(--sans);
  letter-spacing: -0.01em;
  margin: 0;
}

:where(section[data-section]) h3 {
  font: 600 14px/20px var(--sans);
  margin: 0 0 8px;
}

:where(section[data-section]) p {
  margin: 0 0 8px;
  max-width: 72ch;
}

:where(section[data-section]) ul,
:where(section[data-section]) ol {
  margin: 0 0 8px;
  padding-left: 20px;
}

:where(section[data-section]) li {
  margin: 0 0 4px;
}

.region-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 16px;
}

.region-title {
  min-width: 0;
}

.region-sub,
.region-lede {
  color: var(--slate);
  font-size: 15px;
  line-height: 22px;
}

.region-sub {
  margin: 2px 0 0;
}

/* Status chip: one per region header. The dot carries the tone; the words carry the meaning. */
.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font: 600 12px/16px var(--sans);
  white-space: nowrap;
  color: var(--slate);
  background: var(--fog);
}

.chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  box-sizing: border-box;
  border: 1.5px solid currentColor;
}

.chip[data-tone="ok"] { color: var(--moss); background: var(--moss-soft); }
.chip[data-tone="warn"] { color: var(--amber); background: var(--amber-soft); }
.chip[data-tone="bad"] { color: var(--brick); background: var(--brick-soft); }
.chip[data-tone="busy"] { color: var(--amber); background: var(--amber-soft); }
.chip:is([data-tone="ok"], [data-tone="warn"], [data-tone="bad"])::before { background: currentColor; }

p.empty,
.empty {
  color: var(--slate);
  font-size: 15px;
  line-height: 22px;
}

/* Facts: label beside value. */
dl.facts {
  display: grid;
  grid-template-columns: minmax(104px, max-content) minmax(0, 1fr);
  gap: 0 20px;
  margin: 0 0 8px;
}

dl.facts > div {
  display: contents;
}

dl.facts dt,
dl.facts dd {
  padding: 7px 0;
  border-top: 1px solid var(--rule);
}

dl.facts > div:first-child dt,
dl.facts > div:first-child dd {
  border-top: 0;
}

dl.facts dt {
  color: var(--slate);
  font-size: 14px;
  line-height: 22px;
}

dl.facts dd {
  margin: 0;
  min-width: 0;
  font-size: 15px;
  line-height: 22px;
  font-weight: 500;
}

.fact-meta {
  font-size: 12px;
  line-height: 16px;
  color: var(--slate);
  margin: 4px 0 0;
}

.sources {
  margin-top: 16px;
}

p.source,
.source-line,
section[data-section] small {
  font-size: 13px;
  line-height: 18px;
  color: var(--slate);
}

p.source {
  margin: 0 0 4px;
}

ul.source-line {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}

.city-note {
  font-size: 13px;
  line-height: 18px;
  color: var(--slate);
  margin: 12px 0 4px;
}

:where(section[data-section]) a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgb(27 29 33 / 30%);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

:where(section[data-section]) a:hover {
  text-decoration-color: currentColor;
}

a.tap-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: -11px 0;
}

q[data-src="city"] {
  quotes: none;
}

span[data-src] {
  font-variant-numeric: tabular-nums;
}

/* Tinted message: stop, error, unknown. */
.notice {
  border-radius: var(--r-card);
  padding: 12px 16px;
  margin: 0 0 16px;
  background: var(--fog);
  font-size: 15px;
  line-height: 22px;
}

.notice[data-tone="bad"] { background: var(--brick-soft); }
.notice[data-tone="warn"] { background: var(--amber-soft); }
.notice[data-tone="ok"] { background: var(--moss-soft); }

.notice > :last-child,
.notice p:last-child,
.notice ul:last-child {
  margin-bottom: 0;
}

.notice p[data-stop] {
  color: var(--brick);
  font-weight: 600;
  font-size: 17px;
  line-height: 24px;
  margin-bottom: 4px;
}

.notice-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.notice[data-tone="warn"] .notice-title { color: var(--amber); }

/* ---------- Lot ---------- */

.lot {
  display: grid;
  gap: 24px;
}

.lot.has-plat {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  align-items: start;
}

.lot-title {
  font: 600 28px/34px var(--sans);
  letter-spacing: -0.015em;
  margin: 0 0 2px;
}

section[data-section] .lot-sub {
  color: var(--slate);
  font-size: 14px;
  line-height: 20px;
  margin: 0 0 20px;
}

.fact-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 20px 28px;
}

.fact-group h3 {
  color: var(--slate);
  font-weight: 600;
  font-size: 13px;
  line-height: 18px;
}

/* The plat card: the lot to scale, north up, on survey paper. */
figure.plat {
  margin: 0;
  padding: 14px 14px 12px;
  border-radius: var(--r-float);
  background: var(--paper);
  box-shadow: var(--shadow-float);
}

.plat-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  margin-bottom: 10px;
}

.plat-north {
  color: var(--slate);
  font-weight: 500;
}

figure.plat svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 300px;
  border-radius: 10px;
  color: var(--ink);
  background-color: #fafbfc;
  background-image:
    linear-gradient(to right, rgb(27 29 33 / 5%) 1px, transparent 1px),
    linear-gradient(to bottom, rgb(27 29 33 / 5%) 1px, transparent 1px);
  background-size: 16px 16px;
  box-shadow: inset 0 0 0 1px var(--rule);
}

figure.plat svg path {
  fill: var(--moss-soft);
  stroke: var(--moss);
  stroke-linejoin: round;
}

figure.plat svg circle {
  fill: var(--ink);
  stroke: var(--paper);
  stroke-width: 2px;
  paint-order: stroke;
}

figure.plat svg text {
  font-family: var(--sans);
  font-weight: 600;
  fill: var(--slate);
}

figure.plat svg line {
  stroke: var(--slate);
}

figure.plat figcaption {
  font-size: 12px;
  line-height: 16px;
  color: var(--slate);
  margin-top: 10px;
}

/* ---------- Zoning ---------- */

.zone {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 16px;
}

.zone-tile {
  flex: none;
  display: grid;
  place-items: center;
  min-width: 64px;
  height: 64px;
  padding: 0 14px;
  box-sizing: border-box;
  border-radius: var(--r-card);
  background: var(--moss);
  color: var(--paper);
}

.zone-code {
  font: 700 22px/28px var(--sans);
  letter-spacing: -0.01em;
}

section[data-section] .zone-desc {
  font: 600 20px/26px var(--sans);
  letter-spacing: -0.01em;
  margin: 0;
}

section[data-section] .zone-public {
  color: var(--slate);
  font-size: 14px;
  line-height: 20px;
  margin: 4px 0 0;
}

section[data-section] ul.codes {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 8px;
}

ul.codes li.code {
  margin: 0;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--rule);
  display: grid;
  gap: 2px;
}

ul.codes li.code.is-on {
  border-color: transparent;
  background: var(--amber-soft);
}

.code-label {
  font-size: 12px;
  line-height: 16px;
  color: var(--slate);
}

.code-value {
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
}

li.code:not(.is-on) .code-value {
  color: var(--slate);
  font-weight: 500;
}

li.code.is-on .code-value {
  color: var(--amber);
}

/* ---------- Tables ---------- */

.table-wrap {
  overflow: auto;
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  margin: 0 0 12px;
  max-height: 440px;
}

section[data-section] table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  line-height: 20px;
}

section[data-section] th {
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  line-height: 16px;
  color: var(--slate);
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky;
  top: 0;
  white-space: nowrap;
}

section[data-section] td {
  padding: 12px 14px;
  border-top: 1px solid var(--rule);
  vertical-align: top;
}

section[data-section] tbody tr:first-child td {
  border-top: 0;
}

section[data-section] :is(th, td).num {
  text-align: right;
  white-space: nowrap;
}

section[data-section] tbody tr:hover {
  background: var(--fog);
}

/* ---------- Status rows (rules) ---------- */

ol.status-rows,
ul.status-rows {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
}

section[data-section] .status-rows > li {
  margin: 0;
  padding: 14px 16px;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 16px;
}

section[data-section] .status-rows > li:first-child {
  border-top: 0;
}

.row-text {
  font-weight: 600;
  font-size: 15px;
  line-height: 22px;
}

section[data-section] .row-why {
  grid-column: 1 / -1;
  color: var(--slate);
  font-size: 14px;
  line-height: 20px;
  margin: 0;
}

.row-cite {
  grid-column: 1 / -1;
  font-size: 12px;
  line-height: 16px;
  color: var(--slate);
}

.counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

/* ---------- Controls ---------- */

:where(section[data-section]) button {
  font: 600 14px/20px var(--sans);
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--rule-strong);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease);
}

:where(section[data-section]) button:hover {
  background: var(--fog);
}

:where(section[data-section]) button[type="submit"],
:where(section[data-section]) button.button-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

:where(section[data-section]) button[type="submit"]:hover,
:where(section[data-section]) button.button-primary:hover {
  background: #33363c;
}

:where(section[data-section]) button[aria-pressed] {
  border-radius: 999px;
  font-weight: 500;
}

:where(section[data-section]) button[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

:where(section[data-section]) button:disabled {
  opacity: 0.5;
  cursor: default;
}

:where(section[data-section] input:not([type="checkbox"], [type="radio"], [type="file"], [type="hidden"])),
:where(section[data-section] select, section[data-section] textarea) {
  font: 500 15px/20px var(--sans);
  color: inherit;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  background: var(--paper);
  width: 100%;
  box-sizing: border-box;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}

:where(section[data-section] input:not([type="checkbox"]):hover, section[data-section] select:hover) {
  border-color: #b4b9c1;
}

section[data-section] input[aria-invalid="true"] {
  border-color: var(--brick);
  box-shadow: 0 0 0 3px var(--brick-soft);
}

:where(section[data-section]) input[type="checkbox"] {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--ink);
}

:where(section[data-section]) fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 16px;
  min-width: 0;
}

:where(section[data-section]) legend {
  font: 600 14px/20px var(--sans);
  padding: 0;
  margin: 0 0 8px;
}

:where(section[data-section]) label {
  display: block;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  margin: 0 0 6px;
}

:where(section[data-section]) label:has(> input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 0;
  font-weight: 500;
}

section[data-section] .choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.field-error,
section[data-section] [data-error-for],
section[data-section] [data-field="tag-error"],
section[data-section] [role="alert"]:not(:empty) {
  color: var(--brick);
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
  margin: 6px 0 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin: 0 0 16px;
}

.form-grid > div {
  min-width: 0;
}

/* ---------- Shared bits ---------- */

section[data-section] .hint {
  color: var(--slate);
  font-size: 13px;
  line-height: 18px;
  margin: 8px 0 12px;
}

section[data-section] .sub-head {
  font-size: 14px;
  margin: 20px 0 10px;
}

.counts-meta {
  align-self: center;
  font-size: 12px;
  line-height: 16px;
  color: var(--slate);
}

.link-row {
  margin: 4px 0 8px;
}

.missing {
  color: var(--slate);
  font-weight: 400;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--fog);
  color: var(--slate);
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
}

.tag-quiet {
  color: var(--slate);
  font-size: 12px;
}

section[data-section] button.button-small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 8px;
}

.field {
  min-width: 0;
}

section[data-section] .field > label,
section[data-section] .field > legend {
  margin-bottom: 6px;
}

ul.plain-note {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}

section[data-section] ul.plain-note li {
  margin: 0;
}

section[data-section] ul.plain-note .city-note {
  margin: 0 0 2px;
}

.info-rows .row-text {
  font-weight: 500;
}

/* Unit beside a number field, drawn here so the markup carries no unlabeled dollar sign. */
.affix {
  position: relative;
  display: block;
}

.affix::before,
.affix::after {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--slate);
  font-size: 15px;
  pointer-events: none;
}

.affix[data-unit="usd"]::before {
  content: "\0024";
  left: 12px;
}

section[data-section] .affix[data-unit="usd"] input {
  padding-left: 26px;
}

.affix[data-unit="pct"]::after {
  content: "%";
  right: 12px;
}

.affix[data-unit="months"]::after {
  content: "months";
  right: 12px;
  font-size: 13px;
}

section[data-section] .affix[data-unit="pct"] input {
  padding-right: 32px;
}

section[data-section] .affix[data-unit="months"] input {
  padding-right: 64px;
}

/* ---------- Goal ---------- */

section[data-section] .goal-picked:empty {
  display: none;
}

section[data-section] .goal-picked {
  display: none;
}

.goal-kinds {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

section[data-section] button.goal-kind {
  display: inline-block;
  min-height: 44px;
  padding: 0 18px;
  font-weight: 500;
}

section[data-section] button.goal-kind::first-letter {
  text-transform: uppercase;
}

.segmented-choice {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

section[data-section] .segmented-choice button {
  min-width: 72px;
}

/* ---------- Permits ---------- */

table.permits td {
  overflow-wrap: normal;
  word-break: normal;
}

table.permits td.desc {
  min-width: 220px;
  color: var(--ink);
}

.permit-number {
  font-weight: 600;
  white-space: nowrap;
}

.permit-class {
  display: block;
  font-size: 12px;
  line-height: 16px;
  color: var(--slate);
  margin-top: 2px;
}

td[data-field="issued"] {
  white-space: nowrap;
}

section[data-section] .table-note {
  font-size: 12px;
  line-height: 16px;
  color: var(--slate);
}

/* ---------- Flood ---------- */

.flood-tile {
  background: var(--fog);
  color: var(--ink);
}

.flood-tile[data-hazard="yes"] {
  background: var(--amber);
  color: var(--paper);
}

/* ---------- Repairs ---------- */

section[data-section] fieldset.scope {
  margin-bottom: 12px;
}

.scope-ticks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

section[data-section] label.tick {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px 0 12px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease);
}

section[data-section] label.tick:hover {
  background: var(--fog);
}

section[data-section] label.tick:has(input:checked) {
  border-color: var(--ink);
  background: var(--fog);
}

section[data-section] label.tick.is-check {
  border-style: dashed;
  border-color: var(--rule-strong);
  background: transparent;
  cursor: default;
}

.tick-note {
  font-size: 12px;
  color: var(--slate);
  font-weight: 400;
}

section[data-section] ul.repair-lines {
  list-style: none;
  padding: 0;
  margin: 8px 0 12px;
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
}

section[data-section] ul.repair-lines > li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 300px);
  gap: 12px 20px;
  align-items: start;
  margin: 0;
  padding: 14px 16px;
  border-top: 1px solid var(--rule);
}

section[data-section] ul.repair-lines > li:first-child {
  border-top: 0;
}

.line-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  min-width: 0;
}

section[data-section] .line-item {
  font-weight: 600;
  font-size: 15px;
  line-height: 22px;
  margin: 0;
}

section[data-section] .line-note {
  flex-basis: 100%;
  font-size: 13px;
  line-height: 18px;
  color: var(--slate);
  margin: 0;
}

.line-range {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

section[data-section] label.money-field {
  margin: 0;
  display: grid;
  gap: 4px;
}

.money-label {
  font-size: 12px;
  line-height: 16px;
  color: var(--slate);
}

.money-echo {
  font-size: 12px;
  line-height: 16px;
  color: var(--slate);
  min-height: 16px;
}

section[data-section] .line-check {
  justify-self: end;
  margin: 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
}

section[data-section] p.totals {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 20px;
  margin: 0;
  padding: 14px 16px;
  border-radius: var(--r-card);
  background: var(--fog);
  max-width: none;
  font-size: 14px;
  line-height: 20px;
}

.total {
  font-size: 18px;
  line-height: 24px;
  font-weight: 600;
}

.total-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--slate);
  margin-right: 4px;
}

.total-note {
  color: var(--slate);
  font-size: 13px;
}

/* ---------- Deal screen ---------- */

.deal {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

section[data-section] .deal-form button[type="submit"] {
  width: 100%;
}

.result {
  position: relative;
  padding: 16px 16px 14px 36px;
  border-radius: var(--r-card);
  background: var(--fog);
  margin: 0 0 12px;
}

.result::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 21px;
  width: 10px;
  height: 10px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 2px solid var(--rule-strong);
}

.result[data-tone="bad"] { background: var(--brick-soft); }
.result[data-tone="warn"] { background: var(--amber-soft); }
.result[data-tone="ok"] { background: var(--moss-soft); }
.result[data-tone="bad"]::before { background: var(--brick); border-color: var(--brick); }
.result[data-tone="warn"]::before { background: var(--amber); border-color: var(--amber); }
.result[data-tone="ok"]::before { background: var(--moss); border-color: var(--moss); }

section[data-section] .result [data-field="money"] {
  font: 600 19px/26px var(--sans);
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}

section[data-section] .result-extra {
  font-size: 14px;
  line-height: 20px;
  margin: 0;
  color: var(--slate);
}

.figure-before {
  display: grid;
  gap: 2px;
}

.figure-big {
  font: 600 22px/28px var(--sans);
  letter-spacing: -0.01em;
}

table.figures th[scope="row"] {
  position: static;
  font-size: 13px;
  font-weight: 500;
  color: var(--slate);
  border-bottom: 0;
  border-top: 1px solid var(--rule);
  padding: 12px 14px;
  white-space: normal;
}

table.figures tbody tr:first-child th {
  border-top: 0;
}

table.figures td {
  font-size: 15px;
  font-weight: 600;
}

/* ---------- Photos ---------- */

.photo-intake {
  display: grid;
  gap: 0;
  margin: 0 0 16px;
}

section[data-section] .photo-intake .hint {
  margin: 0 0 12px;
}

.coverage {
  margin: 0 0 16px;
}

section[data-section] .coverage .sub-head {
  margin-top: 0;
}

section[data-section] ul.places {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}

section[data-section] ul.places li {
  margin: 0;
  padding: 10px 12px 10px 36px;
  position: relative;
  border-radius: 10px;
  border: 1px solid var(--rule);
  display: grid;
  gap: 2px;
}

ul.places li::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 13px;
  width: 14px;
  height: 14px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 1.5px dashed var(--rule-strong);
}

ul.places li[data-value="shown"] {
  border-color: transparent;
  background: var(--moss-soft);
}

ul.places li[data-value="shown"]::before {
  border: 0;
  background: var(--moss);
}

.place {
  font-weight: 600;
  font-size: 14px;
  line-height: 20px;
}

.place-state {
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  color: var(--slate);
}

li[data-value="shown"] .place-state {
  color: var(--moss);
}

ul.places [data-field="coverage-source"] {
  font-size: 12px;
  line-height: 16px;
  color: var(--slate);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

article.photo-card {
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  overflow: hidden;
  min-width: 0;
}

article.photo-card .frame {
  background: var(--fog);
  color: #ffd24a;
}

article.photo-card .frame img {
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.photo-box rect {
  filter: drop-shadow(0 0 1px rgb(0 0 0 / 60%));
}

.photo-flag {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
  font-weight: 600;
}

.photo-body {
  padding: 14px 16px 16px;
}

section[data-section] .photo-body h3 {
  font-size: 15px;
  margin-bottom: 10px;
}

.photo-selects {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
}

section[data-section] .photo-selects label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--slate);
  margin: 0;
}

.photo-skeleton {
  aspect-ratio: 4 / 3;
  background: var(--fog);
}

section[data-section] .tag-warn {
  font-size: 13px;
  line-height: 18px;
  color: var(--amber);
  font-weight: 500;
}

section[data-section] ul.tags {
  list-style: none;
  padding: 0;
  margin: 8px 0;
}

section[data-section] ul.tags li {
  margin: 0 0 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--fog);
}

section[data-section] .tag-issue {
  font-weight: 600;
  margin: 0 0 2px;
}

section[data-section] .tag-meta {
  font-size: 12px;
  line-height: 16px;
  color: var(--slate);
  margin: 0 0 2px;
}

section[data-section] .tag-actions {
  display: flex;
  gap: 6px;
  margin: 8px 0 0;
}

details.tag-details {
  border-top: 1px solid var(--rule);
  margin-top: 8px;
}

details.tag-details summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  list-style: none;
}

details.tag-details summary::-webkit-details-marker {
  display: none;
}

details.tag-details summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-right: 8px;
  border-radius: 6px;
  background: var(--fog);
  font-weight: 600;
}

details.tag-details[open] summary::before {
  content: "\2212";
}

.tag-form {
  display: grid;
  gap: 10px;
  padding-bottom: 4px;
}

section[data-section] .tag-form label {
  display: grid;
  gap: 4px;
  margin: 0;
}

section[data-section] .box-fieldset {
  margin: 0;
}

.box-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

section[data-section] .box-fields label {
  font-size: 12px;
  color: var(--slate);
}

section[data-section] label.rights {
  font-weight: 600;
}

/* ---------- Your call ---------- */

.call-head {
  margin: 0 0 14px;
}

section[data-section="summary"] h2 {
  font: 600 13px/18px var(--sans);
  letter-spacing: 0;
  color: var(--slate);
}

section[data-section="summary"] .call-goal {
  font: 600 22px/28px var(--sans);
  letter-spacing: -0.01em;
  margin: 2px 0 0;
}

section[data-section="summary"] ul.call-lines {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}

section[data-section="summary"] li.call-line {
  position: relative;
  margin: 0;
  padding: 10px 0 10px 22px;
  border-top: 1px solid var(--rule);
}

li.call-line::before {
  content: "";
  position: absolute;
  left: 0;
  top: 15px;
  width: 10px;
  height: 10px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 2px solid var(--rule-strong);
}

li.call-line[data-tone="ok"]::before { background: var(--moss); border-color: var(--moss); }
li.call-line[data-tone="warn"]::before { background: var(--amber); border-color: var(--amber); }
li.call-line[data-tone="bad"]::before { background: var(--brick); border-color: var(--brick); }

.call-kind {
  display: block;
  font-size: 12px;
  line-height: 16px;
  color: var(--slate);
  margin-bottom: 2px;
}

section[data-section="summary"] [data-field="goal-line"],
section[data-section="summary"] [data-field="money-line"] {
  margin: 0;
  font: 600 17px/24px var(--sans);
  letter-spacing: -0.005em;
}

section[data-section="summary"] [data-field] a {
  text-decoration: none;
}

section[data-section="summary"] [data-field] a:hover {
  text-decoration: underline;
}

li.call-line[data-tone="idle"] [data-field] {
  color: var(--slate);
  font-weight: 500;
}

section[data-section="summary"] .call-stop {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--brick-soft);
  color: var(--brick);
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
}

section[data-section="summary"] .call-count {
  font-size: 14px;
  line-height: 20px;
  margin: 0 0 16px;
}

section[data-section="summary"] .screen-only:has(button) {
  display: flex;
  gap: 8px;
  margin: 0;
}

section[data-section="summary"] .screen-only button {
  flex: 1 1 auto;
  padding: 0 14px;
  white-space: nowrap;
}

section[data-section="summary"] [data-field="save-note"]:not(:empty) {
  color: var(--brick);
  font-size: 13px;
  margin: 8px 0 0;
}

/* ---------- Question sheet ---------- */

.ask-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin: 0 0 16px;
}

.ask-group {
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  padding: 14px 16px;
}

.ask-group h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ask-group .count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  box-sizing: border-box;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
  line-height: 1;
}

ul.asks {
  list-style: none;
  padding: 0;
}

section[data-section] ul.asks li {
  position: relative;
  padding: 8px 0 8px 26px;
  border-top: 1px solid var(--rule);
  margin: 0;
  font-size: 14px;
  line-height: 20px;
}

section[data-section] ul.asks li:first-child {
  border-top: 0;
  padding-top: 2px;
}

ul.asks li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  width: 14px;
  height: 14px;
  box-sizing: border-box;
  border: 1.5px solid var(--rule-strong);
  border-radius: 4px;
}

ul.asks li:first-child::before {
  top: 4px;
}

.ask-group .empty {
  font-size: 14px;
  margin: 0;
}

[data-memo-footer] {
  margin: 8px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  font-size: 12px;
  line-height: 18px;
  color: var(--slate);
}

section[data-section] [data-memo-footer] p {
  margin: 0 0 4px;
}

/* ---------- Photos in the saved file ---------- */

.print-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.print-photos figure {
  margin: 0;
}

.print-photos img {
  max-width: 100%;
  height: auto;
  border-radius: var(--r-control);
}

.print-photos figcaption {
  font-size: 12px;
  color: var(--slate);
}

/* ---------- Regions adapt to their own width ---------- */

section[data-section] {
  container-type: inline-size;
}

@container (max-width: 820px) {
  .deal {
    grid-template-columns: minmax(0, 1fr);
  }
}

@container (max-width: 600px) {
  .lot.has-plat {
    grid-template-columns: minmax(0, 1fr);
  }

  figure.plat {
    max-width: 340px;
  }

  section[data-section] ul.repair-lines > li {
    grid-template-columns: minmax(0, 1fr);
  }

  section[data-section] .line-check {
    justify-self: start;
  }

  .box-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .zone-desc {
    font-size: 18px;
  }

  /* Permit rows become cards: one label and value per line. */
  table.permits thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  table.permits,
  table.permits tbody,
  table.permits tr,
  table.permits td {
    display: block;
  }

  table.permits tr {
    padding: 12px 14px;
    border-top: 1px solid var(--rule);
  }

  table.permits tbody tr:first-child {
    border-top: 0;
  }

  section[data-section] table.permits td {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 12px;
    padding: 3px 0;
    border: 0;
    text-align: left;
  }

  section[data-section] table.permits td::before {
    content: attr(data-label);
    color: var(--slate);
    font-size: 12px;
    line-height: 20px;
  }

  table.permits td.desc {
    min-width: 0;
  }

  table.permits td > * {
    grid-column: 2;
  }

  table.permits .permit-class {
    margin-top: -2px;
  }

  .table-wrap:has(table.permits) {
    max-height: none;
  }
}

@container (max-width: 420px) {
  .form-grid.two,
  .photo-selects {
    grid-template-columns: minmax(0, 1fr);
  }

  .line-range {
    grid-template-columns: 1fr 1fr;
  }
}

/* Saved file and print: no controls in the way of the facts. */
body > main .screen-only {
  display: none;
}

@page {
  size: letter;
  margin: 0.5in;
}

@media print {
  body {
    font-size: 12px;
    line-height: 1.4;
  }

  body > main {
    max-width: none;
    padding: 0;
  }

  #legal,
  .screen-only,
  .holding,
  [data-photo-control] {
    display: none !important;
  }

  .memo-block {
    padding-top: 14px;
  }

  section[data-section] h2 {
    font-size: 15px;
    line-height: 20px;
  }

  .region-head {
    margin-bottom: 10px;
  }

  .lot-title {
    font-size: 20px;
    line-height: 26px;
  }

  section[data-section="summary"] .call-goal {
    font-size: 18px;
  }

  section[data-section="summary"] [data-field="goal-line"],
  section[data-section="summary"] [data-field="money-line"] {
    font-size: 15px;
  }

  dl.facts dt,
  dl.facts dd {
    padding: 3px 0;
    font-size: 12px;
  }

  [data-memo-footer] {
    font-size: 10px;
    break-inside: avoid;
  }

  [data-block="parcel"],
  [data-section="parcel"] {
    break-before: page;
  }

  section[data-section] th {
    position: static;
  }

  section[data-section] {
    container-type: normal;
  }

  .table-wrap {
    max-height: none;
    overflow: visible;
  }

  figure.plat {
    box-shadow: none;
    border: 1px solid var(--rule);
    max-width: 240px;
  }

  section[data-section] input:not([type="checkbox"]),
  section[data-section] select {
    border-color: transparent;
    padding: 0;
    min-height: 0;
    background: transparent;
    appearance: none;
  }

  section[data-section] button[aria-pressed="false"],
  section[data-section] button[type="submit"],
  section[data-section] [data-action],
  details.tag-details,
  .photo-intake,
  section[data-section] label.tick:has(input:not(:checked)) {
    display: none;
  }
}
