/* Pre-Budgetary — the workspace.
 *
 * Dark ground, gold accent, cool blue light bleeding in from the corners, and
 * a fine grain over everything so the black reads as a surface rather than an
 * absence. This is the tool you sit in; the report it produces stays
 * monochrome, because that is the thing a client sees.
 *
 * Everything is self-contained — the grain is an inline SVG, the glows are
 * gradients. No external requests. */

:root {
  --bg: #0A0B0D;
  --panel: rgba(255, 255, 255, .022);
  --panel-2: rgba(255, 255, 255, .035);

  --gold: #C9A961;
  --gold-lit: #E8D3A0;
  --gold-dim: rgba(201, 169, 97, .55);
  --gold-faint: rgba(201, 169, 97, .18);

  --blue: #7FA5C7;
  --blue-glow: rgba(86, 132, 176, .20);
  --blue-glow-2: rgba(64, 104, 148, .13);

  --ink: #EFEEE9;
  --mut: rgba(239, 238, 233, .60);
  --faint: rgba(239, 238, 233, .34);
  --rule: rgba(255, 255, 255, .10);
  --hair: rgba(255, 255, 255, .055);
  --bad: #D98A76;

  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font: 15px/1.62 var(--sans);
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(58rem 40rem at 4% -6%, var(--blue-glow) 0%, transparent 62%),
    radial-gradient(50rem 36rem at 100% 102%, var(--blue-glow-2) 0%, transparent 60%),
    radial-gradient(34rem 26rem at 96% 2%, rgba(201, 169, 97, .05) 0%, transparent 64%),
    var(--bg);
  background-attachment: fixed;
}

/* Fine grain. Low enough to feel like paper stock, not noise. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

body > * { position: relative; z-index: 1; }

.wrap { max-width: 88rem; margin: 0 auto; padding: 0 clamp(1rem, 3.5vw, 2.5rem); }

/* ---------- header ---------- */

.top {
  border-bottom: 1px solid var(--rule);
  background: linear-gradient(180deg, rgba(255,255,255,.035), transparent);
  backdrop-filter: blur(6px);
}
.topbar { display: flex; align-items: center; gap: 14px; padding: clamp(14px, 2.5vw, 22px) 0; }

.mark {
  width: clamp(32px, 5vw, 38px); height: clamp(32px, 5vw, 38px); flex: none;
  border: 1px solid var(--gold-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(15px, 2.4vw, 18px); color: var(--gold-lit); letter-spacing: .02em;
  background: radial-gradient(120% 120% at 30% 20%, rgba(201,169,97,.14), transparent 70%);
}
.who strong { display: block; font-size: clamp(12px, 1.9vw, 13.5px); font-weight: 500; letter-spacing: .035em; color: var(--ink); }
.who span { font-size: 9px; letter-spacing: .24em; text-transform: uppercase; color: var(--gold-dim); }

.session { margin-left: auto; display: flex; align-items: center; gap: clamp(10px, 2vw, 18px); }
.user { font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }

.link {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--mut); text-decoration: none; border-bottom: 1px solid var(--gold-faint);
  transition: color .15s, border-color .15s;
}
.link:hover, .link:focus-visible { color: var(--gold-lit); border-bottom-color: var(--gold); }

.err {
  border-left: 2px solid var(--bad);
  background: rgba(217, 138, 118, .08);
  padding: 11px 15px; margin: 18px 0 0; font-size: 13.5px; color: var(--bad);
}

/* ---------- layout ---------- */

.layout {
  display: grid;
  gap: clamp(1.5rem, 3.5vw, 3rem);
  grid-template-columns: minmax(0, 23rem) minmax(0, 1fr);
  align-items: start;
  padding: clamp(1.5rem, 4vw, 2.75rem) 0 6rem;
}
@media (max-width: 64rem) { .layout { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: clamp(1.1rem, 3vw, 1.6rem);
}
@media (min-width: 64rem) { .panel { position: sticky; top: 1.25rem; max-height: calc(100vh - 2.5rem); overflow-y: auto; } }

.panel section { padding-top: 17px; margin-bottom: 20px; border-top: 1px solid var(--rule); }
.panel section:first-of-type { padding-top: 0; border-top: 0; }

h2 {
  font-size: 9.5px; letter-spacing: .24em; text-transform: uppercase;
  color: var(--gold); font-weight: 400; margin: 0 0 13px;
}

.grid2 { display: grid; gap: 11px 15px; grid-template-columns: 1fr 1fr; }
@media (max-width: 26rem) { .grid2 { grid-template-columns: 1fr; } }

.fld, .num { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fld > span, .num > span {
  font-size: 9px; letter-spacing: .15em; text-transform: uppercase; color: var(--faint);
}

input, select {
  font: inherit; font-size: 14px; color: var(--ink);
  background: transparent; border: 0; border-bottom: 1px solid var(--rule);
  padding: 7px 0; width: 100%; border-radius: 0; min-width: 0;
  transition: border-color .15s;
}
input:focus, select:focus { outline: 0; border-bottom-color: var(--gold); }
input::placeholder { color: rgba(239,238,233,.24); }
select option { background: #14161A; color: var(--ink); }
select {
  appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--gold-dim) 50%), linear-gradient(135deg, var(--gold-dim) 50%, transparent 50%);
  background-position: right 5px center, right 1px center;
  background-size: 4px 4px, 4px 4px; background-repeat: no-repeat; padding-right: 16px;
}

.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 15px; }
.preset {
  font: inherit; font-size: 10.5px; letter-spacing: .11em; text-transform: uppercase;
  background: transparent; border: 1px solid var(--rule); color: var(--mut);
  padding: 7px 12px; cursor: pointer; transition: all .15s;
}
.preset:hover { border-color: var(--gold-dim); color: var(--gold-lit); }
.preset[aria-pressed="true"] {
  background: linear-gradient(180deg, rgba(201,169,97,.18), rgba(201,169,97,.06));
  border-color: var(--gold); color: var(--gold-lit);
}

.chks { display: flex; flex-wrap: wrap; gap: 9px 18px; margin-top: 11px; }
.chk { display: flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; color: var(--mut); }
.chk:hover { color: var(--ink); }
.chk input { width: auto; accent-color: #C9A961; }

details { margin-top: 13px; }
summary {
  font-size: 9.5px; letter-spacing: .15em; text-transform: uppercase;
  color: var(--gold-dim); cursor: pointer; padding: 3px 0;
}
summary:hover { color: var(--gold); }
details > div { margin-top: 11px; }

.hint { font-size: 12px; color: var(--faint); margin: 9px 0 0; }

/* ---------- bedrooms ---------- */

.bed { border-top: 1px solid var(--hair); padding: 11px 0 9px; }
.bed:first-child { border-top: 0; padding-top: 0; }
.bedhead { display: flex; align-items: center; gap: 10px; }
.bedno {
  width: 20px; height: 20px; flex: none; border: 1px solid var(--gold-faint);
  display: flex; align-items: center; justify-content: center;
  font-size: 9.5px; color: var(--gold-dim); font-variant-numeric: tabular-nums;
}
.bedhead .role { flex: 1; }
.bedopts { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 7px; padding-left: 30px; }
.bedopts .chk { font-size: 12px; }

/* ---------- map ---------- */

#pinbox { margin-top: 14px; }
#map {
  height: 260px; margin-top: 10px;
  border: 1px solid var(--rule); background: rgba(255,255,255,.03);
}
#map .leaflet-control-attribution { background: rgba(0,0,0,.6); color: var(--faint); }
#map .leaflet-control-attribution a { color: var(--gold-dim); }
.pinout {
  margin: 9px 0 0; font-size: 12.5px; color: var(--mut);
  border-left: 2px solid var(--gold-faint); padding-left: 10px;
}
.pinout strong { color: var(--gold-lit); }

/* ---------- space summary ---------- */

.spacelist { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.spacelist.out .sp { border-style: dashed; }
.sp {
  font-size: 11.5px; color: var(--mut);
  border: 1px solid var(--rule); padding: 4px 9px;
}
.sp b { color: var(--gold); font-weight: 400; }

.actions { display: flex; align-items: center; gap: 15px; margin-top: 22px; flex-wrap: wrap; }
.primary {
  font: inherit; font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase;
  color: #14120C; border: 0; cursor: pointer;
  background: linear-gradient(180deg, var(--gold-lit), var(--gold));
  padding: 13px 26px; transition: filter .15s;
}
.primary:hover { filter: brightness(1.09); }
.spin { font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-dim); }

/* ---------- results ---------- */

.empty {
  border: 1px dashed var(--rule); padding: clamp(2rem, 6vw, 3.5rem);
  text-align: center; color: var(--mut); background: var(--panel);
}
.empty p { margin: 0 0 7px; }

/* Which sides face a road — the input that decides where the front setback goes. */
.sides { display: grid; gap: 8px; }
.side { display: grid; grid-template-columns: 22px 1fr 1fr; gap: 8px; align-items: center; }
.side .sidekey {
  font-size: 11px; letter-spacing: .16em; color: var(--gold-dim); text-align: center;
}
.setbacks { margin-top: 14px; background: #fff; border: 1px solid var(--rule); padding: 8px; }
.sub {
  font-size: 10px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--gold-dim); font-weight: 400; margin: 22px 0 8px;
}

/* What the figure covers, said before the figure. */
.scopenote {
  margin: 0 0 14px; padding: 12px 14px; font-size: 12.5px; line-height: 1.6;
  color: var(--mut); border-left: 2px solid var(--gold-dim); background: rgba(201,169,97,.045);
}
.scopenote strong { color: var(--gold-lit); font-weight: 400; letter-spacing: .04em; }

.range {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--gold-faint); border: 1px solid var(--gold-dim); margin-bottom: 8px;
}
@media (max-width: 30rem) { .range { grid-template-columns: 1fr; } }
.range > div {
  background: linear-gradient(180deg, rgba(201,169,97,.07), rgba(255,255,255,.02));
  padding: clamp(16px, 3.5vw, 24px);
}
.range .k { display: block; font-size: 9px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold-dim); margin-bottom: 7px; }
.range .v {
  font-size: clamp(1.5rem, 5.5vw, 2.3rem); font-variant-numeric: tabular-nums;
  letter-spacing: -.025em; color: var(--gold-lit);
}
.ratio { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--faint); margin: 0 0 clamp(20px, 4vw, 30px); }

.res section { padding-top: 16px; margin-bottom: clamp(20px, 4vw, 28px); border-top: 1px solid var(--rule); }
.res h3 { font-size: 9.5px; letter-spacing: .24em; text-transform: uppercase; color: var(--gold); font-weight: 400; margin: 0 0 13px; }
.res p { color: var(--mut); }

.tw { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; min-width: 22rem; }
th, td { text-align: left; padding: 8px 14px 8px 0; border-top: 1px solid var(--hair); vertical-align: top; }
thead th {
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  font-size: 9px; letter-spacing: .15em; text-transform: uppercase;
  color: var(--gold-dim); font-weight: 400; white-space: nowrap;
}
td.n, th.n { text-align: right; font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; padding-right: 0; }
tfoot td { border-top: 1px solid var(--gold-dim); color: var(--gold-lit); font-weight: 500; }
tbody tr:hover td { background: rgba(255,255,255,.022); }

.chip {
  display: inline-block; font-size: 8.5px; letter-spacing: .13em; text-transform: uppercase;
  border: 1px solid var(--gold-faint); color: var(--gold-dim); padding: 2px 6px; vertical-align: 1px;
}

.flags { border: 1px solid var(--rule); background: var(--panel-2); padding: 15px 17px; }
.flags ul { margin: 0; padding-left: 18px; }
.flags li { font-size: 12.5px; color: var(--mut); margin-bottom: 6px; }
.flags li::marker { color: var(--gold-faint); }
.flags.locked { text-align: center; color: var(--faint); font-size: 13px; }

.exports { display: flex; gap: 11px; flex-wrap: wrap; align-items: center; }
.ghost {
  font: inherit; font-size: 10.5px; letter-spacing: .17em; text-transform: uppercase;
  background: transparent; border: 1px solid var(--gold-dim); color: var(--gold-lit);
  padding: 12px 22px; cursor: pointer; text-decoration: none; display: inline-block;
  transition: all .15s;
}
.ghost:hover { background: rgba(201,169,97,.12); border-color: var(--gold); }
.ghost[disabled] { border-color: var(--rule); color: var(--faint); cursor: not-allowed; }
.ghost[disabled]:hover { background: transparent; border-color: var(--rule); }

/* ---------- dialog ---------- */

dialog {
  border: 1px solid var(--gold-dim); padding: clamp(1.4rem, 5vw, 2rem);
  max-width: 23rem; width: calc(100% - 2rem); color: var(--ink);
  background: linear-gradient(180deg, #14161A, #0D0F12);
}
dialog::backdrop { background: rgba(4, 5, 6, .7); backdrop-filter: blur(3px); }
dialog h2 { color: var(--gold-lit); font-size: 1.15rem; letter-spacing: -.02em; text-transform: none; margin: 0 0 5px; }
dialog .fld { margin-bottom: 15px; }

/* ---------- touch & motion ---------- */

@media (pointer: coarse) {
  input, select { padding: 11px 0; font-size: 16px; } /* 16px stops iOS zooming on focus */
  .preset { padding: 10px 14px; }
  .chk { padding: 3px 0; }
  .primary, .ghost { padding: 15px 26px; }
}

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

:focus-visible { outline: 1px solid var(--gold); outline-offset: 3px; }
