:root {
  --ink: #16211b;
  --ink-2: #3c4a42;
  --muted: #6d766f;
  --paper: #f7f5ef;
  --panel: #fbfaf6;
  --line: #e4e0d4;
  --line-2: #d6d1c2;
  --brand: #1e3a2e;
  --brand-2: #2b5141;
  --brass: #b58a3c;
  --hl: #ffc84a;
  --danger: #b4392d;
  --ok: #2f7d55;
  --stage: #0d120f;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(15, 25, 20, .14), 0 2px 6px rgba(15, 25, 20, .08);
  --font: 'Manrope', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --topbar: 64px;
  --side: 340px;
  --detail: 360px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 15px/1.45 var(--font); color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
.muted { color: var(--muted); font-weight: 500; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.hint:empty { display: none; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid transparent; background: none; cursor: pointer; text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap; transition: background .15s, border-color .15s, transform .1s; }
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.ghost { border-color: var(--line-2); color: var(--ink); background: #fff; }
.btn.ghost:hover { border-color: var(--ink-2); }
.btn.ghost.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.small { height: 34px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: var(--brand-2); font-weight: 600; font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link.light { color: #fff; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: #fff; font-size: 20px; line-height: 1; cursor: pointer; }
.count { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--paper); border: 1px solid var(--line-2); font-size: 12px; display: inline-grid; place-items: center; }

/* ---------- top bar ---------- */
.topbar { height: var(--topbar); display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--line); position: relative; z-index: 5; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--brand); color: #f2e3c2; font-weight: 700; letter-spacing: .04em; font-size: 14px; flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 16px; letter-spacing: -.01em; }
.brand-text small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- layout ---------- */
.layout { position: relative; height: calc(100% - var(--topbar)); display: grid; grid-template-columns: var(--side) 1fr; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; display: flex; flex-direction: column; }
.block { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.label { display: block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.row-between .label { margin-bottom: 10px; }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); }
input[type=search], input[type=number], input[type=text], input[type=tel], input[type=email], input[type=datetime-local], input:not([type]), select { width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; }
.search input { padding-left: 38px; }
input:focus, select:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(43, 81, 65, .15); }
.range { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { border-color: var(--ink-2); }
.chip[aria-pressed=true] { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip:disabled { opacity: .5; cursor: not-allowed; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c, #999); flex: none; }

.results { padding: 16px 20px 24px; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.results-head h2 { font-size: 15px; }
.toggle { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.result-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.result-list button { width: 100%; text-align: left; padding: 10px 10px 9px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.result-list button:hover { border-color: var(--brand-2); }
.result-list button.sel { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: #f1f5f2; }
.result-list b { display: block; font-size: 15px; }
.result-list span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.result-list .flag { color: var(--brass); }
.empty { text-align: center; padding: 28px 8px; color: var(--muted); }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; }

/* ---------- stage / map ---------- */
.stage { position: relative; background: var(--stage); overflow: hidden; }
.viewer { position: absolute; inset: 0; touch-action: none; cursor: grab; }
.viewer.panning { cursor: grabbing; }
.viewer:focus-visible { outline-offset: -3px; }
.mp-svg { width: 100%; height: 100%; display: block; user-select: none; -webkit-user-select: none; }
.plot { fill: transparent; stroke: transparent; stroke-width: 1.5; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill .2s, stroke .2s; }
.show-outlines .plot { stroke: rgba(255, 255, 255, .6); stroke-width: 1.2; }
.plot.has-status { fill: color-mix(in srgb, var(--st) 42%, transparent); stroke: var(--st); stroke-width: 1.5; }
.plot:hover, .plot:focus-visible { fill: rgba(255, 255, 255, .24); stroke: #fff; stroke-width: 2; outline: none; }
.filtering .plot { fill: rgba(8, 12, 10, .58); stroke: transparent; }
.filtering .plot.match { fill: rgba(255, 200, 74, .26); stroke: var(--hl); stroke-width: 1.6; }
.filtering .plot.match.has-status { fill: color-mix(in srgb, var(--st) 50%, transparent); stroke: var(--st); }
.plot.selected, .filtering .plot.selected { fill: rgba(255, 200, 74, .42); stroke: var(--hl); stroke-width: 3.5; }
.plot.unverified-boundary.selected { stroke-dasharray: 8 5; }
.pin rect { fill: var(--brand); }
.pin text { fill: #fff; font: 700 13px var(--font); }
.pin path { fill: var(--brand); }
.loading { position: absolute; inset: 0; display: grid; place-content: center; grid-auto-flow: column; gap: 10px; color: #e9eee9; font-weight: 600; pointer-events: none; }
.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.crumb { position: absolute; top: 14px; left: 14px; display: flex; gap: 12px; align-items: center; padding: 8px 14px; border-radius: 999px; background: rgba(13, 18, 15, .72); color: #fff; font-size: 13px; font-weight: 600; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.map-controls { position: absolute; right: 14px; top: 14px; display: flex; flex-direction: column; border-radius: 12px; overflow: hidden; background: #fff; box-shadow: var(--shadow); }
.map-controls button { width: 44px; height: 44px; border: 0; border-bottom: 1px solid var(--line); background: #fff; font-size: 22px; cursor: pointer; display: grid; place-items: center; }
.map-controls button:last-child { border-bottom: 0; }
.map-controls button:hover { background: var(--paper); }
.map-controls svg { width: 18px; height: 18px; }
.legend { position: absolute; left: 14px; bottom: 14px; padding: 10px 14px; border-radius: 12px; background: rgba(251, 250, 246, .95); box-shadow: var(--shadow); font-size: 12px; display: flex; flex-wrap: wrap; gap: 6px 14px; max-width: min(560px, calc(100% - 28px)); }
.legend .item { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.legend .note { width: 100%; color: var(--muted); font-weight: 500; }
.legend .sw { width: 14px; height: 10px; border-radius: 3px; background: var(--c); border: 1px solid rgba(0,0,0,.15); }
.demo-tag { display: inline-block; padding: 1px 6px; margin-right: 4px; border-radius: 5px; background: var(--brass); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; vertical-align: 1px; }
.tooltip { position: absolute; pointer-events: none; padding: 6px 10px; border-radius: 8px; background: rgba(13,18,15,.9); color: #fff; font-size: 12px; font-weight: 600; transform: translate(-50%, calc(-100% - 12px)); white-space: nowrap; }
.fab { display: none; }

/* ---------- detail panel ---------- */
.detail { position: absolute; top: 12px; right: 72px; bottom: 12px; width: var(--detail); background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); overflow-y: auto; animation: slideIn .25s ease-out; z-index: 3; }
@keyframes slideIn { from { opacity: 0; transform: translateX(12px); } }
.detail-head { position: sticky; top: 0; background: var(--panel); padding: 18px 18px 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; z-index: 1; }
.detail-head .kicker { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.detail-head h2 { font-size: 30px; line-height: 1.1; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: color-mix(in srgb, var(--c, #999) 14%, #fff); color: color-mix(in srgb, var(--c, #999) 70%, #000); border: 1px solid color-mix(in srgb, var(--c, #999) 35%, #fff); margin-top: 6px; }
.badge.warn { --c: var(--brass); }
.detail-body { padding: 16px 18px; }
.area-big { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.area-sub { color: var(--muted); font-size: 13px; }
.notice { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: #fbf4e4; border: 1px solid #ecd9ae; font-size: 13px; color: #6b5220; }
.facts { margin: 16px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; text-align: right; }
.facts dd.na { color: var(--muted); font-weight: 500; }
.sub { margin: 18px 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.mini-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mini-chips button { height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); background: #fff; font-weight: 600; font-size: 13px; cursor: pointer; }
.mini-chips button:hover { border-color: var(--brand-2); }
.feat { font-size: 14px; margin: 0; padding-left: 18px; }
.fine { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 14px 18px 18px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--panel); }
.actions .btn { justify-content: center; }
.actions .btn.primary { grid-column: 1 / -1; }

/* ---------- compare tray ---------- */
.compare-tray { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: 999px; background: var(--brand); color: #fff; box-shadow: var(--shadow); z-index: 6; font-size: 14px; font-weight: 600; }
.compare-tray .tag { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 10px; border-radius: 999px; background: rgba(255,255,255,.14); }
.compare-tray .tag button { border: 0; background: none; color: #fff; cursor: pointer; font-size: 16px; line-height: 1; padding: 0 4px; }
.compare-tray .btn { background: #fff; color: var(--brand); height: 36px; }

/* ---------- dialogs ---------- */
.dlg { border: 0; padding: 0; border-radius: 18px; width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.dlg.wide { width: min(860px, calc(100vw - 24px)); }
.dlg::backdrop { background: rgba(10, 15, 12, .5); backdrop-filter: blur(2px); }
.dlg[open] { animation: pop .2s ease-out; display: flex; flex-direction: column; }
.dlg form { display: flex; flex-direction: column; min-height: 0; max-height: inherit; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { font-size: 20px; }
.dlg-body { padding: 18px 20px; overflow-y: auto; }
.dlg-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dlg-foot .hint { margin: 0; max-width: 60%; }
.form .field { margin-bottom: 14px; }
.form label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.form .check label { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; font-size: 14px; }
.form .check input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; accent-color: var(--brand); }
.err { color: var(--danger); font-size: 12px; margin: 4px 0 0; min-height: 0; }
.err:empty { display: none; }
.field.invalid input { border-color: var(--danger); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 12px; background: #ece9df; margin-bottom: 16px; }
.seg label { margin: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 8px 4px; border-radius: 9px; font-size: 13px; font-weight: 600; cursor: pointer; }
.seg input:checked + span { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg input:focus-visible + span { outline: 2px solid var(--brass); }
.form-status { margin: 4px 0 0; font-size: 14px; font-weight: 600; }
.form-status:empty { display: none; }
.form-status.ok { color: var(--ok); }
.form-status.bad { color: var(--danger); }
.form-status.demo { color: #6b5220; background: #fbf4e4; border: 1px solid #ecd9ae; padding: 10px 12px; border-radius: 10px; font-weight: 500; }

/* compare table */
.cmp { width: 100%; border-collapse: collapse; font-size: 14px; }
.cmp th, .cmp td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.cmp thead th { font-size: 20px; }
.cmp tbody th { color: var(--muted); font-weight: 600; width: 160px; }
.cmp td.diff { background: #f3f7f4; }
.cmp .na { color: var(--muted); }
.cmp .tagline { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: #e8f0eb; color: var(--brand); }
.sl-list { list-style: none; padding: 0; margin: 0; }
.sl-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.sl-list .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.toast { position: fixed; left: 50%; top: 76px; transform: translateX(-50%); padding: 10px 16px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 600; z-index: 20; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
.noscript { padding: 20px; }

/* ---------- tablet ---------- */
@media (max-width: 1100px) {
  :root { --side: 300px; --detail: 330px; }
  .top-actions .btn span:not(.count) { display: none; }
  .top-actions #enquireTop span, #enquireTop { display: inline-flex; }
}

/* ---------- mobile: sidebar + detail become bottom sheets ---------- */
@media (max-width: 760px) {
  :root { --topbar: 58px; }
  .topbar { padding: 0 12px; }
  .brand-text small { display: none; }
  .brand-mark { width: 34px; height: 34px; }
  .top-actions { gap: 4px; }
  .top-actions .btn.ghost { width: 40px; padding: 0; justify-content: center; }
  .top-actions .btn.ghost .count { position: absolute; transform: translate(12px, -12px); min-width: 18px; height: 18px; font-size: 11px; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: absolute; left: 0; right: 0; bottom: 0; max-height: 78%; border-radius: 18px 18px 0 0; border: 0; box-shadow: 0 -10px 30px rgba(0,0,0,.25); z-index: 7; transform: translateY(105%); transition: transform .28s ease; }
  .sidebar.open { transform: none; }
  .sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 8px auto 0; flex: none; }
  .fab { display: inline-flex; position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); box-shadow: var(--shadow); }
  .legend { bottom: 72px; left: 10px; right: 10px; max-width: none; padding: 8px 10px; }
  .crumb { top: 10px; left: 10px; max-width: calc(100% - 80px); }
  .map-controls { top: 10px; right: 10px; }
  .detail { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 72%; border-radius: 18px 18px 0 0; animation: slideUp .25s ease-out; z-index: 8; }
  @keyframes slideUp { from { transform: translateY(30px); opacity: 0; } }
  .layout:has(.detail:not([hidden])) :is(.legend, .fab) { display: none; }
  .compare-tray { bottom: 76px; max-width: calc(100vw - 20px); }
  .cmp tbody th { width: 110px; }
  .dlg-foot { flex-direction: column; align-items: stretch; }
  .dlg-foot .hint { max-width: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
