:root {
  --paper: #0a0a0a;
  --ink: #e6edf3;
  --muted: #7d8590;
  --line: #262626;
  --rust: #ef4444;
  --amber: #fbbf24;
  --pine: #4ade80;
  --card: #141414;
  --mark: #1e1e1e;
  --on-fill: #04110a;
  color-scheme: dark;
}
html[data-theme="light"] {
  --paper: #e7edf2;
  --ink: #101820;
  --muted: #4d5d6e;
  --line: #d5dee6;
  --rust: #c42323;
  --amber: #9a6709;
  --pine: #0f7a3a;
  --card: #ffffff;
  --mark: #f3f6f9;
  --on-fill: #ffffff;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--pine) 10%, transparent), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, color-mix(in srgb, #22d3ee 8%, transparent), transparent 50%),
    var(--paper);
  color: var(--ink);
  font-family: "IBM Plex Mono", "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 14px;
  line-height: 1.5;
}
.top {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 28px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.brand {
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}
.brand img { height: 34px; width: auto; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name {
  color: var(--pine);
  letter-spacing: 0.14em;
  font-size: 11px;
}
.brand-line {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}
.gate-brand { margin: 0 0 22px; }
.gate .brand img { height: 48px; }
.gate .brand-name { font-size: 12px; }
.gate .brand-line { font-size: 16px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.theme { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.theme button, .signout, .go {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  padding: 6px 10px;
  cursor: pointer;
  text-decoration: none;
}
.theme button[aria-pressed="true"], .go {
  background: var(--pine);
  color: var(--on-fill);
}
.top .theme button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
}
.theme svg { width: 16px; height: 16px; display: block; }
.signout { border: 1px solid var(--line); border-radius: 6px; }

.mast {
  padding: 40px 28px 8px;
  max-width: 1180px;
  margin: 0 auto;
}
.kicker {
  margin: 0 0 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--muted);
}
h1 {
  margin: 0;
  font-family: inherit;
  font-size: clamp(26px, 4vw, 34px);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.lede {
  max-width: 68ch;
  color: var(--muted);
  margin: 14px 0 0;
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px 28px 64px;
}

.hero {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 22px 0 8px;
  padding: 0;
  border-bottom: none;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.stat .value {
  font-family: inherit;
  font-size: 28px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1;
}
.stat .value.rust { color: var(--rust); }
.stat .value.pine { color: var(--pine); }
.stat .label {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.stick {
  position: sticky;
  top: var(--bar, 53px);
  z-index: 40;
  margin: 8px 0 0;
  padding: 10px 0 6px;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(10px);
}
.toolbar { margin: 0 0 10px; }
.horizon { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-top: 10px; }
.horizon-label {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters button {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.filters button[aria-selected="true"] {
  background: var(--pine);
  color: var(--on-fill);
  border-color: var(--pine);
}
.filters button .count { color: inherit; opacity: 0.7; margin-left: 4px; }
.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
  align-items: center;
  margin-top: 12px;
}
.search { flex: 1 1 240px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.search input {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--ink);
  background: transparent;
  font: inherit;
  padding: 8px 0;
  color: var(--ink);
}
.search input:focus { outline: 2px solid var(--pine); outline-offset: 3px; }
.check { font-size: 14px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.sr {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.map-block { margin: 22px 0 8px; }
#map {
  height: 480px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}
html[data-theme="dark"] .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.85) contrast(0.95);
}
.leaflet-container { font: inherit; }
.legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}
.legend .dark { margin-left: 10px; }
.swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid var(--ink);
}
.swatch.light { background: var(--pine); }
.swatch.dark { background: var(--rust); width: 18px; height: 18px; }
.map-note { color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chips button {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 999px;
  padding: 4px 10px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.chips button[aria-pressed="true"] {
  background: var(--pine);
  color: var(--on-fill);
  border-color: var(--pine);
}
.list-head[hidden] { display: none; }
.list-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: baseline;
  margin: 18px 0 0;
  font-family: inherit;
  font-size: 20px;
}
.list-head button {
  appearance: none;
  border: none;
  background: none;
  color: var(--pine);
  font: inherit;
  font-size: 16px;
  cursor: pointer;
  padding: 0;
}
.area-name { font-weight: 600; }

.table-wrap { overflow: visible; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { text-align: left; padding: 11px 8px; vertical-align: top; border-bottom: 1px solid var(--line); }
td.place { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.num { white-space: nowrap; }
th {
  position: sticky;
  top: var(--stick, 220px);
  z-index: 30;
  background: var(--paper);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.num .sub { text-align: right; }
.projects { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; }
.oc {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px 1px 5px;
  border: 1px solid color-mix(in srgb, var(--pine) 45%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--pine) 14%, transparent);
  color: var(--pine);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}
.oc svg { width: 13px; height: 13px; flex: none; }
th[aria-sort="descending"]::after { content: " ↓"; }
th[aria-sort="ascending"]::after { content: " ↑"; }
tbody tr.project { cursor: pointer; }
tbody tr.project:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
tbody tr.project.open { background: var(--card); }
.name { font-weight: 600; }
.promoter, .sub, .handover { display: block; color: var(--muted); font-size: 13px; font-weight: 400; margin-top: 2px; }
.handover.late { color: var(--rust); }
.mark {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--rust);
}
td.unsold, td.late { color: var(--rust); font-weight: 650; }
td.heat { font-weight: 650; }
td.heat.green { color: var(--pine); }
td.heat.yellow { color: var(--amber); }
td.heat.red { color: var(--rust); }
td.money, .money, .buyer-line { font-weight: 650; }
.money.green, .buyer-line.green { color: var(--pine); }
.money.yellow, .buyer-line.yellow { color: var(--amber); }
.money.red, .buyer-line.red { color: var(--rust); }
.buyer-line { display: none; }
.buyer-counts { color: var(--muted); font-weight: 600; }
td.gap { color: var(--rust); font-weight: 650; }
.buyer-label {
  margin: 12px 0 4px;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.nocs, .units, .missing { margin: 0 0 8px; padding-left: 18px; }
.nocs .yes { color: var(--pine); }
.nocs .no { color: var(--rust); }
.buyer-span { grid-column: 1 / -1; }
.read-progress { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
td.late { font-weight: 600; }
.detail td { background: var(--card); padding: 8px 10px 18px; }
.detail-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px 32px;
  font-size: 14px;
}
.detail-grid p { margin: 0 0 8px; }
.detail-grid a { color: var(--pine); }
.flag {
  background: var(--mark);
  padding: 8px 10px;
  margin: 0 0 8px;
}
.empty { color: var(--muted); }
.note {
  margin-top: 28px;
  color: var(--muted);
  font-size: 14px;
  max-width: 78ch;
}
.note a { color: var(--pine); }

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.gate-panel {
  width: min(320px, 100%);
  padding: 28px 26px 24px;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 10px;
  backdrop-filter: blur(10px);
}
.eyebrow {
  margin: 0 0 18px;
  color: var(--pine);
  letter-spacing: 0.16em;
  font-size: 11px;
}
.gate h1 { margin-bottom: 8px; }
.gate .lede { margin-bottom: 22px; }
.gate .go { display: inline-block; border-radius: 6px; font-weight: 650; }
.access-page {
  max-width: 640px;
  margin: 0 auto;
  padding: 28px 28px 64px;
}
.access-form { display: flex; gap: 8px; margin: 18px 0 8px; }
.access-form input {
  flex: 1;
  min-width: 0;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  padding: 8px 10px;
}
.access-form .go { border-radius: 6px; font-weight: 650; }
.access-msg { min-height: 1.4em; margin: 0 0 12px; color: var(--muted); }
.access-msg.bad { color: var(--rust); }
.access-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}
.access-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.access-list li:last-child { border-bottom: none; }
.access-list .who { margin-right: auto; overflow-wrap: anywhere; }
.badge { color: var(--pine); font-size: 12px; }
.remove {
  appearance: none;
  background: transparent;
  color: var(--rust);
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  font-size: 12px;
  padding: 6px 10px;
  cursor: pointer;
}

@media (max-width: 800px) {
  .top, .mast, main { padding-left: 16px; padding-right: 16px; }
  .top { flex-wrap: wrap; }
  .hero { grid-template-columns: 1fr 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .stat .value { font-size: 32px; }
  #map { height: 320px; }
  .list-head { font-size: 24px; }
  table { table-layout: fixed; }
  .wide-only { display: none; }
  th, td { padding: 8px 4px; }
  th { letter-spacing: 0; font-size: 11px; }
  th.num { text-align: left; }
  .buyer-line { display: block; font-size: 13px; font-weight: 600; margin-top: 2px; }
  th:nth-child(5), td:nth-child(5),
  th:nth-child(6), td:nth-child(6),
  th:nth-child(7), td:nth-child(7),
  th:nth-child(8), td:nth-child(8),
  th:nth-child(9), td:nth-child(9),
  th:nth-child(10), td:nth-child(10),
  th:nth-child(11), td:nth-child(11),
  th:nth-child(12), td:nth-child(12),
  th:nth-child(13), td:nth-child(13) { display: none; }
  td.num .sub, td.late .sub { display: none; }
  th:nth-child(1) { width: auto; }
  th:nth-child(2) { width: 3.4rem; }
  th:nth-child(3) { width: 4.6rem; }
  th:nth-child(4) { width: 4.4rem; }
  .name, .promoter { overflow-wrap: anywhere; }
}
