:root {
  --text: #0a0a0a;
  --text-2: #52525b;
  --muted: #8b8b93;
  --line: rgba(10, 10, 10, 0.08);
  --line-2: rgba(10, 10, 10, 0.05);
  --fill: #f4f4f5;
  --fill-2: #ececee;
  --surface: #ffffff;
  --glass: rgba(255, 255, 255, 0.86);
  --accent: #f0522b;
  --accent-ink: #c73a15;
  --ok: #15803d;
  --ok-bg: rgba(21, 128, 61, 0.1);
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", monospace;
  --r: 16px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.1);
  --shadow-2: 0 -1px 0 rgba(0, 0, 0, 0.04), 0 -10px 40px rgba(0, 0, 0, 0.12);
  --top: calc(env(safe-area-inset-top) + 10px);
  --sheet-h: 148px; /* updated live by the sheet */
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* The page itself never scrolls. iOS Safari still scrolls a page to show a
   focused field above the keyboard; pinning html and body stops that. */
html, body { margin: 0; height: 100%; overflow: hidden; }
html { position: fixed; inset: 0; background: #e8e8e6; }
body {
  font: 15px/1.45 var(--sans);
  color: var(--text);
  background: #e8e8e6;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 0.92em; letter-spacing: -0.01em; }

#map { position: fixed; inset: 0; background: #e8e8e6; }

/* ------------------------------------------------- search (in the sheet) */
.sheet-head { flex: none; padding: 0 16px 12px; touch-action: none; }
.home-title { display: none; margin: 0 2px 12px; }
.home-title .title { font-size: clamp(19px, 5.4vw, 22px); }
.home-title .sub { margin-top: 2px; }
.sheet.home:not(.searching) .home-title { display: block; }
.search-row { display: flex; align-items: center; gap: 10px; }

/* Property card header: address on the left, round buttons on the right.
   On a phone it replaces the search box while a card is open. */
.card-head { display: none; align-items: flex-start; gap: 12px; padding: 0 2px 2px; }
.sheet.card:not(.searching) .card-head { display: flex; }
.card-title { flex: 1; min-width: 0; padding-top: 1px; }
.card-head .addr { font-size: 22px; }
.card-head .place { font-size: 14px; margin-top: 2px; }
.head-btns { flex: none; display: flex; gap: 8px; }
.round {
  display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 99px;
  background: var(--fill); color: var(--text-2); position: relative;
  transition: background 0.15s, transform 0.1s, opacity 0.2s;
}
.round::after { content: ""; position: absolute; inset: -6px; } /* 46px tap target */
.round svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.round:active { transform: scale(0.92); background: var(--fill-2); }
@media (hover: hover) { .round:hover { background: var(--fill-2); color: var(--text); } }
#expand { background: var(--text); color: #fff; }
[data-sheet="full"] #expand { display: none; }
.head-x { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.search {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 2px;
  height: 48px; padding: 0 4px 0 12px;
  background: var(--fill); border-radius: 14px;
  transition: background 0.15s, box-shadow 0.15s;
}
.search:focus-within { background: var(--fill-2); }
.glass { width: 19px; height: 19px; flex: none; margin-right: 6px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent;
  font-size: 16px; letter-spacing: -0.01em; touch-action: manipulation;
}
.search input::placeholder { color: var(--muted); }
.icon-btn {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: 11px; background: transparent; color: var(--text-2);
  transition: background 0.15s, transform 0.1s;
}
.icon-btn[hidden] { display: none; }
@media (hover: hover) { .icon-btn:hover { background: rgba(10, 10, 10, 0.05); } }
.icon-btn:active { transform: scale(0.94); background: rgba(10, 10, 10, 0.08); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
/* clear: a small filled circle, with a bigger tap area around it */
.icon-btn.small { position: relative; width: 20px; height: 20px; margin: 0 8px; border-radius: 99px; background: #c4c4ca; color: #fff; }
.icon-btn.small::after { content: ""; position: absolute; inset: -12px; }
.icon-btn.small svg { width: 12px; height: 12px; stroke-width: 2.6; }
.icon-btn[aria-pressed="true"] { background: var(--text); color: #fff; }
.divider { width: 1px; height: 22px; background: rgba(10, 10, 10, 0.1); margin: 0 2px; }
.cancel {
  display: none; flex: none; border: 0; background: none; padding: 8px 2px;
  font-size: 15.5px; font-weight: 550; color: var(--accent-ink);
}
.sheet.searching .cancel { display: block; }
.sheet.card:not(.searching) .search-row { display: none; }
.sheet.searching #owner-btn, .sheet.searching .divider { display: none; }

.suggest {
  display: none; flex: 1; min-height: 0; margin: 0; padding: 0 10px calc(20px + env(safe-area-inset-bottom));
  list-style: none; overflow-y: auto; overscroll-behavior: contain;
}
.sheet.searching .suggest { display: block; }
.sheet.searching .sheet-body { display: none; }
.suggest li {
  display: flex; align-items: center; gap: 12px; min-height: 56px;
  padding: 8px 8px; border-radius: 14px; cursor: pointer;
}
.suggest li[aria-selected="true"] { background: var(--fill); }
@media (hover: hover) { .suggest li:hover { background: var(--fill); } }
.suggest li:active { background: var(--fill-2); }
.s-ico {
  flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px;
  background: var(--fill); color: var(--text-2);
}
.suggest li[aria-selected="true"] .s-ico { background: var(--surface); }
.s-ico svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.s-text { min-width: 0; display: grid; }
.s-main { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -0.01em; }
.s-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest .s-label { min-height: 0; padding: 12px 8px 4px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: default; }
.suggest .s-label:hover, .suggest .s-label:active { background: none; }
.suggest .s-empty { min-height: 0; padding: 10px 8px; color: var(--text-2); font-size: 14px; cursor: default; display: block; }
.suggest .s-empty:hover, .suggest .s-empty:active { background: none; }
.suggest .s-empty code { font-family: var(--mono); font-size: 13px; background: var(--fill); padding: 1px 6px; border-radius: 6px; color: var(--text); }

/* ------------------------------------------------------- map controls */
.fabs {
  position: fixed; z-index: 1100; right: 12px;
  top: var(--top);
  display: grid; gap: 8px;
}
.fab {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.6); color: var(--text);
  background: var(--glass); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  box-shadow: var(--shadow-1); transition: transform 0.1s, background 0.15s;
}
.fab:active { transform: scale(0.93); }
.fab svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.fab .dot { fill: currentColor; stroke: none; }
.fab[aria-pressed="true"] { background: var(--text); color: #fff; border-color: var(--text); }

.toast {
  position: fixed; z-index: 1150; left: 50%; margin: 0;
  bottom: calc(var(--sheet-h) + 14px);
  transform: translate(-50%, 8px); opacity: 0; pointer-events: none;
  padding: 9px 14px; border-radius: 999px; white-space: nowrap;
  background: rgba(10, 10, 10, 0.82); color: #fff; font-size: 13.5px; font-weight: 500;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.busy::before {
  content: ""; display: inline-block; width: 11px; height: 11px; margin: 0 8px -1px 0;
  border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.leaflet-container { font-family: var(--sans); }
.leaflet-control-attribution {
  font-size: 10px; background: rgba(255, 255, 255, 0.7) !important; color: var(--muted);
  border-radius: 6px 0 0 0; padding: 0 6px;
}
.leaflet-control-attribution a { color: var(--text-2); }
.leaflet-bottom { bottom: var(--sheet-h); }
[data-sheet="full"] .leaflet-bottom { visibility: hidden; }
.fabs { transition: opacity 0.2s; }
[data-sheet="full"] .fabs { opacity: 0; pointer-events: none; }
.leaflet-tooltip.pin-tip {
  font: 550 12.5px var(--sans); padding: 5px 9px; border: 0; border-radius: 9px;
  background: var(--text); color: #fff; box-shadow: var(--shadow-1);
}
.leaflet-tooltip-top.pin-tip::before { border-top-color: var(--text); }
.leaflet-control-zoom { border: 0 !important; box-shadow: var(--shadow-1) !important; border-radius: 12px !important; overflow: hidden; }
.leaflet-control-zoom a { width: 36px !important; height: 36px !important; line-height: 36px !important; color: var(--text) !important; border-color: var(--line) !important; }
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: #2563eb; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.2), var(--shadow-1); }

/* --------------------------------------------------------------- sheet */
.sheet {
  position: fixed; z-index: 1200; left: 0; right: 0; bottom: 0;
  height: var(--sheet-h);
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  box-shadow: var(--shadow-2);
  contain: layout paint;
}
.grab {
  flex: none; height: 26px; display: grid; place-items: center;
  touch-action: none; cursor: grab; outline: none;
}
.grab span { width: 38px; height: 5px; border-radius: 99px; background: #d4d4d8; transition: background 0.15s, width 0.15s; }
.grab:hover span, .grab:focus-visible span { background: #a1a1aa; }
.sheet.dragging .grab { cursor: grabbing; }
.sheet.dragging .grab span { width: 46px; background: #a1a1aa; }
.sheet-body {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  padding: 0 18px calc(24px + env(safe-area-inset-bottom));
}
#view > * { animation: in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both; animation-delay: calc(var(--i, 0) * 35ms); }

/* Static, crawlable explainer under the home view */
.about { margin-top: 26px; padding-top: 4px; border-top: 1px solid var(--line); color: var(--text-2); font-size: 14.5px; }
.sheet:not(.home) .about { display: none; }
.about h2 { font-size: 16px; font-weight: 650; letter-spacing: -0.015em; color: var(--text); margin: 22px 0 6px; }
.about h3 { font-size: 14.5px; font-weight: 600; color: var(--text); margin: 14px 0 2px; }
.about p { margin: 0 0 8px; }
.about ul { margin: 0; padding-left: 18px; }
.about li { margin: 3px 0; }
.about a { color: var(--accent-ink); font-weight: 550; text-underline-offset: 2px; }
.about .credit-line a { color: var(--text-2); }
@keyframes in { from { opacity: 0; transform: translateY(6px); } }

/* --------------------------------------------------------- sheet content */
.head { padding: 2px 0 12px; }
.title { margin: 0; font-size: 21px; line-height: 1.2; font-weight: 650; letter-spacing: -0.025em; }
.sub { margin: 3px 0 0; color: var(--text-2); font-size: 14px; }
.h { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; margin: 22px 0 8px; }

.group { margin: 0; padding: 0; list-style: none; border-radius: var(--r); background: var(--fill); overflow: hidden; }
.group > * + * { box-shadow: 0 -1px 0 var(--line); }
.row {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 52px; padding: 10px 14px; border: 0; background: transparent; text-align: left;
}
button.row:active, button.row.hot { background: var(--fill-2); }
@media (hover: hover) { button.row:hover { background: var(--fill-2); } }
.row .r-main { font-weight: 550; letter-spacing: -0.01em; }
.row .r-sub { display: block; font-size: 13px; color: var(--muted); }
.row .r-end { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }

.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; margin-left: 6px; vertical-align: 1px; }
.badge.now { background: var(--ok-bg); color: var(--ok); }
.badge.past { background: var(--fill-2); color: var(--text-2); }
.badge.late { background: rgba(217, 119, 6, 0.12); color: #b45309; }
.badge.due { background: rgba(220, 38, 38, 0.1); color: #b91c1c; }

.back {
  display: inline-flex; align-items: center; gap: 4px; margin: 0 0 8px -6px; padding: 6px 8px;
  border: 0; border-radius: 10px; background: transparent; color: var(--text-2); font-size: 14px; font-weight: 550;
}
.back:active { background: var(--fill); }
.back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.note { color: var(--text-2); font-size: 14px; margin: 10px 0 0; }
.note a { color: var(--accent-ink); font-weight: 550; text-underline-offset: 2px; }
.callout { margin: 14px 0 0; padding: 12px 14px; border-radius: var(--r); background: var(--fill); color: var(--text-2); font-size: 14px; }
.callout strong { color: var(--text); font-weight: 600; }
.callout.good { background: var(--ok-bg); color: #14532d; }
.callout.good strong { color: var(--ok); }
.loading { color: var(--muted); padding: 10px 0; }
.foot { margin: 26px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.credit-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.credit-line a { color: var(--text-2); font-weight: 550; text-decoration: none; }
.credit-line a:hover { color: var(--text); }
.credit-line span { color: #c4c4ca; }

/* property card */
.photo { position: relative; aspect-ratio: 16 / 10; border-radius: var(--r); overflow: hidden; background: var(--fill); }
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.3s; }
.photo img.ok { opacity: 1; }
.photo.none { display: none; }
.addr-block { padding: 0; }
.photo.none + .addr-block .pills { margin-top: 0; }
.addr { margin: 0; font-size: 24px; line-height: 1.15; font-weight: 650; letter-spacing: -0.03em; }
.place { margin: 4px 0 0; color: var(--text-2); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 99px; border: 0;
  background: var(--fill); font-size: 12.5px; font-weight: 550; color: var(--text-2);
}
.pill.id { font-family: var(--mono); font-weight: 500; }
.pill svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
button.pill:active { background: var(--fill-2); }

.owner { display: flex; gap: 12px; align-items: flex-start; margin: 16px 0 0; padding: 14px; border-radius: var(--r); background: var(--fill); }
.avatar { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--text); color: #fff; font-size: 14px; font-weight: 650; letter-spacing: 0.02em; }
.avatar svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.owner > div:last-child { min-width: 0; flex: 1; }
.owner .o-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.owner .o-name { font-size: 16px; font-weight: 650; letter-spacing: -0.015em; margin-top: 1px; line-height: 1.25; overflow-wrap: anywhere; }
.owner .o-mail { font-size: 13px; color: var(--text-2); margin-top: 3px; overflow-wrap: anywhere; }
.skeleton { display: block; height: 14px; width: 60%; margin-top: 6px; border-radius: 6px; background: linear-gradient(90deg, var(--fill-2), #f8f8f9, var(--fill-2)); background-size: 200% 100%; animation: shimmer 1.1s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 0; }
.stat { padding: 12px 14px; border-radius: var(--r); background: var(--fill); min-width: 0; }
.stat dt { font-size: 12px; font-weight: 600; color: var(--muted); }
.stat dd { margin: 3px 0 0; font-size: 19px; font-weight: 650; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat dd small { display: block; font-size: 12.5px; font-weight: 450; letter-spacing: 0; color: var(--text-2); white-space: normal; margin-top: 1px; }

.facts { margin: 0; }
.facts > div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 14px; }
.facts dt { color: var(--text-2); }
.facts dd { margin: 0; text-align: right; font-weight: 550; min-width: 0; overflow-wrap: anywhere; }

.sale { display: grid; grid-template-columns: 1fr auto; gap: 1px 12px; padding: 12px 14px; }
.sale .when { font-weight: 550; }
.sale .amt { font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.sale .how { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
.sale .how a { color: var(--accent-ink); text-decoration: none; font-family: var(--mono); font-size: 12px; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 22px 0 0; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 48px; padding: 0 14px;
  border: 0; border-radius: 14px; background: var(--fill); color: var(--text);
  font-size: 14.5px; font-weight: 600; text-decoration: none; letter-spacing: -0.01em;
  transition: transform 0.1s, background 0.15s;
}
.btn:active { transform: scale(0.98); background: var(--fill-2); }
.btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: 0.7; }
.btn.primary { grid-column: 1 / -1; background: var(--text); color: #fff; }
.btn.primary:active { background: #27272a; }

.group.pad { padding: 14px; }
.skeleton.short { width: 35%; }
.mini { margin: 8px 2px 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.h-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.link-btn { border: 0; background: none; padding: 4px 0; font-size: 13.5px; font-weight: 600; color: var(--accent-ink); }
.sale .when { overflow-wrap: anywhere; }
.sale .how a { margin-left: 0; }
.taxes { margin-top: 8px; }
.tax-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 2px 10px; padding: 11px 14px; }
.tax-row .yr { font-weight: 650; font-variant-numeric: tabular-nums; }
.tax-row .badge { margin-left: 0; justify-self: start; }
.tax-row .amt { font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; }
.tax-row .how { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); }
.tax-row .how a { color: var(--accent-ink); font-weight: 550; text-decoration: none; }
#d-tax .stats { margin-top: 0; }

/* owner name form */
.form { display: grid; gap: 14px; margin-top: 6px; }
.field > label, .field > .label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin: 0 0 6px; }
.field input[type="text"] {
  width: 100%; height: 48px; padding: 0 14px; border-radius: 14px; border: 1px solid transparent;
  background: var(--fill); font-size: 16px; outline: 0; transition: border-color 0.15s, background 0.15s;
}
.field input[type="text"]:focus { background: var(--surface); border-color: var(--text); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; border-radius: 12px; background: var(--fill); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { display: grid; place-items: center; height: 38px; border-radius: 9px; font-size: 14px; font-weight: 550; color: var(--text-2); cursor: pointer; transition: background 0.15s, color 0.15s; margin: 0; }
.seg input:checked + label { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.seg input:focus-visible + label { outline: 2px solid var(--text); outline-offset: -2px; }

/* ------------------------------------------------- tablet and desktop */
@media (min-width: 900px) {
  :root { --panel: 400px; --sheet-h: 0px; }
  .sheet {
    top: 16px; left: 16px; bottom: 16px; right: auto;
    width: var(--panel); height: auto; border-radius: 22px; box-shadow: var(--shadow-1);
  }
  .grab { display: none; }
  .sheet-head { padding: 20px 18px 12px; touch-action: auto; display: flex; flex-direction: column; }
  .sheet-head .search-row { order: -1; }
  .sheet.card:not(.searching) .search-row { display: flex; margin-bottom: 16px; }
  #expand { display: none; }
  .sheet-body { padding-top: 4px; }
  .fabs { top: 16px; right: 16px; }
  .toast { bottom: 28px; left: calc(50% + (var(--panel) + 16px) / 2); }
  [data-sheet="full"] .leaflet-bottom { visibility: visible; }
  [data-sheet="full"] .fabs { opacity: 1; pointer-events: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .fab { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
