/* Asunción Property Finder — map styles (WP2).
   Sections: tokens, base, panel, search, layers, legend, popup, responsive. */

:root {
  --bg: #ffffff;
  --fg: #1d2330;
  --muted: #5d6676;
  --line: #d9dde5;
  --accent: #1f6fb4;
  --accent-soft: #e6f0fa;
  --warn-bg: #fff4d6;
  --warn-fg: #6b4e00;
  --shadow: 0 2px 10px rgba(20, 30, 50, .22);
  --radius: 10px;
  --tap: 44px;
  --panel-w: 340px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c212b;
    --fg: #e8ebf1;
    --muted: #9aa3b4;
    --line: #333b4a;
    --accent: #6fb1ee;
    --accent-soft: #263446;
    --warn-bg: #4a3d12;
    --warn-fg: #ffe9a8;
    --shadow: 0 2px 10px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  color: var(--fg);
  -webkit-text-size-adjust: 100%;
}

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

/* ---------- panel ---------- */
.panel {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 5;
  width: var(--panel-w);
  max-width: calc(100vw - 20px);
  max-height: calc(100dvh - 20px);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 8px 8px 14px;
  border-bottom: 1px solid var(--line);
}
.panel.collapsed .panel-head { border-bottom: 0; }

.panel-title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.lang-select {
  flex: none;
  height: 32px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.panel-title strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.counter { font-size: 13px; color: var(--muted); }

.icon-btn {
  flex: none;
  width: var(--tap);
  height: var(--tap);
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.icon-btn:hover { background: var(--accent-soft); }
.chevron {
  width: 10px; height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-135deg) translate(-2px, -2px); /* points up = "collapse" */
  transition: transform .15s;
}
.panel.collapsed .chevron { transform: rotate(45deg) translate(-2px, -2px); }

.panel-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 14px 12px;
}
.panel.collapsed .panel-body { display: none; }

.block { margin-top: 12px; position: relative; }
.block-title {
  display: block;
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}

.notice {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--warn-bg);
  color: var(--warn-fg);
  font-size: 14px;
}
.notice small { display: block; margin-top: 4px; opacity: .85; }

.panel-foot { margin-top: 14px; font-size: 12px; color: var(--muted); }

/* ---------- search ---------- */
.search {
  width: 100%;
  height: var(--tap);
  padding: 0 12px;
  font: inherit;
  font-size: 16px; /* prevents iOS zoom on focus */
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.search:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.results {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.results[hidden] { display: none; }
.results li { border-top: 1px solid var(--line); }
.results li:first-child { border-top: 0; }
.result-btn {
  width: 100%;
  min-height: var(--tap);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.result-btn:hover, .result-btn.active { background: var(--accent-soft); }
.result-text { display: flex; flex-direction: column; min-width: 0; }
.result-name { font-weight: 600; }
.result-sub { font-size: 12px; color: var(--muted); }
.result-empty { padding: 10px 12px; color: var(--muted); font-size: 14px; }

.swatch {
  flex: none;
  width: 14px; height: 14px;
  border-radius: 3px;
  border: 2px solid var(--c, #888);
  background: color-mix(in srgb, var(--c, #888) 22%, transparent);
}
.swatch.excluded {
  border-color: #8a8f99;
  background: repeating-linear-gradient(45deg, #8a8f99 0 2px, transparent 2px 5px);
}
.swatch.aoi { border: 2px dashed #111; background: transparent; }
@media (prefers-color-scheme: dark) { .swatch.aoi { border-color: #fff; } }

/* ---------- layers ---------- */
.layer-list { display: flex; flex-direction: column; }
.layer-group-title {
  margin: 8px 0 2px;
  font-size: 12px;
  color: var(--muted);
}
.layer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  cursor: pointer;
}
.layer-row input { width: 20px; height: 20px; flex: none; accent-color: var(--accent); }
.layer-row.disabled { opacity: .5; cursor: default; }
.layer-label { flex: 1; min-width: 0; }
.layer-note { display: block; font-size: 12px; color: var(--muted); }

/* ---------- legend ---------- */
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; font-size: 13px; }
.legend-item { display: flex; align-items: center; gap: 8px; min-width: 0; }
.legend-item span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-wide { grid-column: 1 / -1; }

/* ---------- popup ---------- */
.maplibregl-popup-content {
  padding: 12px 14px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  color: var(--fg);
  background: var(--bg);
  max-width: 280px;
}
.maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: var(--bg); }
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: var(--bg); }
.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--bg); }
.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--bg); }
.maplibregl-popup-close-button { width: 32px; height: 32px; font-size: 20px; color: var(--fg); }

.popup-title { margin: 0 24px 2px 0; font-size: 16px; font-weight: 700; }
.popup-muni { margin: 0 0 8px; color: var(--muted); }
.popup-table { width: 100%; border-collapse: collapse; }
.popup-table th { padding: 2px 10px 2px 0; text-align: left; font-weight: 400; color: var(--muted); vertical-align: top; white-space: nowrap; }
.popup-table td { padding: 2px 0; }
/* 2026-10-21: river +1..+6 m as one switcher row with a slider */
.river-row { display: block; }
.river-head { display: flex; align-items: center; gap: 10px; min-height: var(--tap); cursor: pointer; }
.river-control { display: flex; flex-direction: column; gap: 2px; margin: 0 0 6px 30px; }
.layer-row .river-slider { width: 100%; height: auto; accent-color: #1d4ed8; }
.river-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
/* 2026-10-21: barrio, risk-layer and Street View popups: labels wrap in a fixed column, values break anywhere */
.popup-table.wrap { table-layout: fixed; font-size: 13px; }
.popup-table.wrap th { width: 38%; white-space: normal; line-height: 1.25; padding-right: 8px; }
.popup-table.wrap td { overflow-wrap: anywhere; line-height: 1.25; }
/* 2026-10-21 compact parcel card (trial): short labels wrap, values break anywhere, never wider than the popup */
.parcel-card dl { display: grid; grid-template-columns: minmax(84px, 36%) 1fr; column-gap: 10px; row-gap: 3px; margin: 0; font-size: 13px; }
.parcel-card dt { color: var(--muted); line-height: 1.25; }
.parcel-card dd { margin: 0; line-height: 1.25; overflow-wrap: anywhere; }
.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
}
.badge.excluded { background: #e3e5e9; color: #4b5260; }
@media (prefers-color-scheme: dark) { .badge.excluded { background: #343b48; color: #c3c9d4; } }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  :root { --panel-w: 100vw; }
  .panel {
    top: 0; left: 0; right: 0;
    width: 100%;
    max-width: none;
    max-height: 70dvh;
    border-radius: 0 0 var(--radius) var(--radius);
    padding-top: env(safe-area-inset-top);
  }
  .legend { grid-template-columns: 1fr 1fr; }
  .maplibregl-popup-content { max-width: 78vw; }
  /* keep map controls clear of the collapsed panel */
  .maplibregl-ctrl-top-right { top: calc(60px + env(safe-area-inset-top)); }
}

/* WP4 risk popups: several features under the cursor are stacked as cards */
.risk-popup { max-height: 55dvh; overflow-y: auto; }
.risk-card + .risk-card { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(0, 0, 0, 0.15); }
.risk-card .popup-table td { overflow-wrap: anywhere; }

.noscript { position: fixed; top: 10px; left: 10px; padding: 8px 12px; background: var(--warn-bg); color: var(--warn-fg); border-radius: 8px; z-index: 10; }

/* ======================================================================
   WP10: listing counters, filters, property sheet
   ====================================================================== */

:root {
  --ok: #2b8a3e;
  --bad: #c92a2a;
  --warn: #e8590c;
  --sheet-w: 380px;
}

.listing-counter { font-weight: 600; color: var(--fg); }
.muted { color: var(--muted); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

.btn-sec, .btn-pri {
  min-height: 40px;
  padding: 0 14px;
  font: inherit;
  font-size: 14px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--fg);
}
.btn-sec:hover:not(:disabled) { background: var(--accent-soft); }
.btn-sec:disabled { opacity: .5; cursor: default; }
.btn-pri { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
@media (prefers-color-scheme: dark) { .btn-pri { color: #10151d; } }

/* ---------- filters ---------- */
.filters-count { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.export-row { display: flex; gap: 8px; margin-bottom: 8px; }
.export-row .btn-sec { flex: 1; }
.filters { display: flex; flex-direction: column; gap: 6px; }
.filters > .btn-sec { width: 100%; }
.fgroup { border: 1px solid var(--line); border-radius: 8px; }
.fgroup > summary {
  list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: var(--tap);
  padding: 0 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}
.fgroup > summary::-webkit-details-marker { display: none; }
.fgroup > summary::after { content: '▾'; color: var(--muted); }
.fgroup[open] > summary::after { content: '▴'; }
.fbadge {
  margin-left: auto; margin-right: 6px;
  min-width: 22px; padding: 1px 7px;
  border-radius: 999px; text-align: center;
  background: var(--accent); color: #fff; font-size: 12px;
}
.fbadge[hidden] { display: none; }
.fbody { padding: 4px 12px 10px; }
.flist { display: flex; flex-direction: column; }
.flist.tall { max-height: 220px; overflow-y: auto; border-top: 1px solid var(--line); margin-top: 6px; }
.fopt {
  display: flex; align-items: center; gap: 8px;
  min-height: 36px; font-size: 14px; cursor: pointer;
}
.fopt[hidden] { display: none; }
.fopt input { width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
.fopt.zero { color: var(--muted); }
.fopt-label { flex: 1; min-width: 0; }
.fopt-sub { font-size: 12px; color: var(--muted); }
.fopt-count { font-size: 12px; color: var(--muted); min-width: 20px; text-align: right; }
.fdot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.fsearch {
  width: 100%; height: 40px; padding: 0 10px; font: inherit; font-size: 16px;
  color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
}
.fchips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.fchip {
  min-height: 28px; padding: 0 10px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--accent-soft); color: var(--accent); font: inherit; font-size: 13px;
}
.frange { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.fnum, .fdate {
  flex: 1; min-width: 0; height: 40px; padding: 0 8px;
  font: inherit; font-size: 16px; color: var(--fg); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px;
}
.funit { font-size: 13px; color: var(--muted); white-space: nowrap; }
.fhint { margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.filters-empty { margin: 0; color: var(--muted); font-size: 14px; }
.filters-empty[hidden], .filters-body[hidden] { display: none; }

/* listing legend */
.listing-legend { margin-top: 12px; }
.score-legend { display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.score-bar { height: 10px; border-radius: 5px; border: 1px solid rgba(0, 0, 0, .25); }
.score-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.legend-icon { width: 22px; height: 22px; flex: none; }
.ring-icon { width: 16px; height: 16px; border-radius: 50%; border: 3px solid #f59f00; flex: none; }
.fade-icon { width: 16px; height: 16px; border-radius: 50%; background: #9aa0a6; opacity: .5; flex: none; }

/* chooser popup (several listings on one spot) */
.chooser { list-style: none; margin: 6px 0 0; padding: 0; max-height: 40dvh; overflow-y: auto; }
.chooser-btn {
  width: 100%; min-height: var(--tap); padding: 4px 8px; display: flex; flex-direction: column; align-items: flex-start;
  font: inherit; color: inherit; text-align: left; background: transparent; border: 0; border-top: 1px solid var(--line); cursor: pointer;
}
.chooser-btn:hover { background: var(--accent-soft); }
.chooser-main { font-weight: 600; }
.chooser-sub { font-size: 12px; color: var(--muted); }

/* ---------- property sheet ---------- */
.sheet {
  position: fixed; z-index: 6;
  top: 10px; right: 10px; bottom: 10px;
  width: var(--sheet-w); max-width: calc(100vw - 20px);
  display: flex; flex-direction: column;
  background: var(--bg); color: var(--fg);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.sheet[hidden] { display: none; }
.sheet-grip { display: none; }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--line);
}
.sheet-heading { display: flex; flex-direction: column; min-width: 0; }
.sheet-heading strong { font-size: 16px; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 4px 14px 18px; }
.sec { margin-top: 14px; }
.sec-title { margin: 0 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.sec p { margin: 6px 0 0; font-size: 13px; }
.sec .muted { font-size: 12.5px; }
.kv { width: 100%; border-collapse: collapse; font-size: 14px; }
.kv th { padding: 3px 10px 3px 0; text-align: left; font-weight: 400; color: var(--muted); vertical-align: top; width: 38%; }
.kv td { padding: 3px 0; overflow-wrap: anywhere; }

.photo { aspect-ratio: 16 / 10; border-radius: 8px; overflow: hidden; background: var(--accent-soft); margin-top: 10px; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-ph { height: 100%; display: grid; place-items: center; padding: 12px; text-align: center; font-size: 13px; color: var(--muted); }

.badge.warn { background: #ffe8cc; color: #a64500; }
.badge.ok { background: #d3f9d8; color: #1b6b2a; }
@media (prefers-color-scheme: dark) {
  .badge.warn { background: #4a3315; color: #ffc078; }
  .badge.ok { background: #1c3a24; color: #8ce99a; }
}

.score-row { display: flex; align-items: center; gap: 12px; }
.score-badge {
  flex: none; width: 56px; height: 56px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #111; line-height: 1; border: 3px solid rgba(255, 255, 255, .85); box-shadow: 0 0 0 1px rgba(0, 0, 0, .3);
}
.score-badge strong { font-size: 20px; }
.score-badge small { font-size: 10px; }
.score-badge.na { background: #9aa0a6; color: #fff; }
.score-title { font-weight: 600; }
.eval { font-size: 13.5px; font-weight: 600; }
.banner { margin-top: 8px; padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.banner.bad { background: #ffe3e3; color: #a51111; }
.banner.info { background: var(--accent-soft); color: var(--accent); border: 1px dashed var(--accent); }
@media (prefers-color-scheme: dark) { .banner.bad { background: #4a1b1b; color: #ffa8a8; } }
.reasons { margin: 8px 0 0; padding-left: 18px; font-size: 13.5px; }
.reasons li { margin: 2px 0; }
.reasons li.bad { color: var(--bad); font-weight: 600; }

.flags { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.flag { border-left: 5px solid var(--sev, #868e96); background: color-mix(in srgb, var(--sev, #868e96) 10%, transparent); border-radius: 6px; }
.flag summary { list-style: none; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; padding: 8px 10px; cursor: pointer; min-height: 40px; }
.flag summary::-webkit-details-marker { display: none; }
.flag-name { font-weight: 600; font-size: 14px; }
.flag-sev { flex: none; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--sev); }
.flag-hint { margin: 0; padding: 0 10px 10px; }

.links { margin: 0; padding-left: 18px; font-size: 14px; }
.links li { margin: 4px 0; }
.links a { color: var(--accent); }

.wp11 { border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px 10px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.field select, .field textarea {
  font: inherit; font-size: 15px; color: var(--fg); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px; width: 100%;
}
.field :disabled { opacity: .55; }

.cmd { margin-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cmd[hidden] { display: none; }
.cmd code { flex: 1 1 100%; padding: 8px 10px; background: var(--accent-soft); border-radius: 6px; user-select: all; overflow-wrap: anywhere; }

/* map controls make room for the side sheet */
body.sheet-open .maplibregl-ctrl-top-right,
body.sheet-open .maplibregl-ctrl-bottom-right { right: calc(var(--sheet-w) + 14px); }

@media (max-width: 640px) {
  .sheet {
    top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-width: none;
    height: 46dvh; border-radius: var(--radius) var(--radius) 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    transition: height .18s ease;
  }
  .sheet.expanded { height: 90dvh; }
  .sheet-grip { display: block; border: 0; background: transparent; padding: 8px 0 2px; cursor: pointer; width: 100%; }
  .sheet-grip span { display: block; width: 40px; height: 4px; margin: 0 auto; border-radius: 2px; background: var(--line); }
  body.sheet-open .maplibregl-ctrl-top-right, body.sheet-open .maplibregl-ctrl-bottom-right { right: 0; }
  body.sheet-open .maplibregl-ctrl-bottom-left { bottom: 46dvh; }
  .fgroup > summary { min-height: 48px; }
}

/* ======================================================================
   WP11: workflow (status, notes, journal, checklist), pin mode, parcel chooser, review queue.
   Everything here is shown only when the local API answered (see workflow.js).
   ====================================================================== */

.wf-local-badge { margin-left: 8px; padding: 0 7px; border-radius: 999px; font-size: 10.5px; font-weight: 600; letter-spacing: 0; text-transform: none; background: var(--accent-soft); color: var(--accent); }
.wf { border-top: 1px solid var(--line); padding-top: 10px; }
.wf .field select, .wf .field textarea, .wf-next input, .wf-add select, .wf-add textarea, .wf-cnote-in {
  font: inherit; font-size: 15px; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px; width: 100%;
}
.wf-next { display: flex; gap: 6px; }
.wf-next input[type="text"] { flex: 1 1 auto; min-width: 0; }
.wf-next input[type="date"] { flex: 0 0 150px; }
.wf-small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.wf-sub { margin: 14px 0 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.wf-ind { display: block; min-height: 18px; margin-top: 6px; font-size: 12.5px; }
.wf-ind.ok { color: var(--ok); }
.wf-ind.bad { color: var(--bad); }
.wf-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; font-size: 13px; }
.wf-confirm:empty { display: none; }
.wf-contact { margin-top: 8px; font-size: 14px; }
.wf-contact a { color: var(--accent); }
.wf-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.wf-add { display: grid; grid-template-columns: 120px 1fr auto; gap: 6px; align-items: start; }
.wf-add textarea { grid-column: 2; }
.wf-journal { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.wf-ev { padding: 6px 8px; border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); border-radius: 4px; font-size: 13.5px; }
.wf-ev.sys { border-left-color: var(--line); background: transparent; color: var(--muted); }
.wf-ev-head { display: flex; align-items: baseline; gap: 8px; }
.wf-ev-kind { font-weight: 600; }
.wf-ev-text { display: block; margin-top: 2px; white-space: pre-wrap; overflow-wrap: anywhere; }
.wf-x { margin-left: auto; border: 0; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; min-width: 32px; min-height: 28px; }
.wf-x:hover { color: var(--bad); }

.wf-check { margin-top: 14px; border: 1px solid var(--line); border-radius: 8px; }
.wf-check > summary, .wf-cgroup > summary { cursor: pointer; padding: 10px 12px; font-weight: 600; font-size: 14px; min-height: 40px; }
.wf-cl { padding: 0 8px 8px; }
.wf-cgroup { border-top: 1px solid var(--line); }
.wf-cgroup > summary { font-size: 13px; padding: 8px 4px; }
.wf-crow { padding: 4px 0; }
.wf-crow-main { display: flex; align-items: flex-start; gap: 8px; }
.wf-cstate { flex: none; width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--line); background: var(--bg); color: var(--fg); font-size: 15px; font-weight: 700; cursor: pointer; }
.wf-cstate[data-state="ok"] { background: #d3f9d8; border-color: var(--ok); color: #1b6b2a; }
.wf-cstate[data-state="problem"] { background: #ffe3e3; border-color: var(--bad); color: #a51111; }
.wf-cstate[data-state="na"] { color: var(--muted); border-style: dashed; }
.wf-ctext { flex: 1; font-size: 13.5px; line-height: 1.35; padding-top: 5px; }
.wf-crow.s-na .wf-ctext { color: var(--muted); text-decoration: line-through; }
.wf-cnote-btn { flex: none; border: 0; background: transparent; color: var(--muted); cursor: pointer; min-width: 30px; min-height: 32px; }
.wf-cnote-in { margin: 4px 0 0 40px; width: calc(100% - 40px); font-size: 13.5px; padding: 6px; }
.wf-cnote-in[hidden] { display: none; }

.wf-desc { margin-top: 10px; }
.wf-desc > summary { cursor: pointer; font-size: 13.5px; color: var(--accent); }
.wf-desc-text { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 240px; overflow-y: auto; }
.wf-cands { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.wf-cands li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 13.5px; }
.wf-cands li.cur { border-color: var(--ok); }
.wf-cands li:hover { background: var(--accent-soft); }
.banner.warn { background: var(--warn-bg); color: var(--warn-fg); }

/* modes and messages over the map */
body.wf-mode .maplibregl-canvas { cursor: crosshair !important; }
.wf-banner {
  position: fixed; z-index: 8; top: 12px; left: 50%; transform: translateX(-50%); max-width: min(560px, calc(100vw - 24px));
  display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; border-radius: 10px;
  background: #1c2230; color: #fff; box-shadow: var(--shadow); font-size: 14px;
}
.wf-banner[hidden], .wf-toast[hidden] { display: none; }
/* read-only build: plain-text values instead of controls, and the one-off quota notice */
.wf-ro-value { font-size: 14px; line-height: 1.4; }
.wf-ro-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.wf-cnote-ro { margin: 2px 0 2px 40px; font-size: 13px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
body.wf-readonly .wf-cstate { cursor: default; }
body.wf-local .photo-private { display: none; }
body.wf-readonly .export-row { display: none; } /* no CSV / XLSX in the read-only share build */ /* the sign photos are in the card's "Фото и вырезки" section */
.quota-banner {
  position: fixed; z-index: 9; top: 12px; left: 50%; transform: translateX(-50%); max-width: min(520px, calc(100vw - 24px));
  display: flex; align-items: center; gap: 8px; padding: 8px 6px 8px 14px; border-radius: 10px;
  background: var(--warn-bg); color: var(--warn-fg); box-shadow: var(--shadow); font-size: 14px;
}
.quota-banner[hidden] { display: none; }
.quota-banner-x { border: 0; background: transparent; color: inherit; font-size: 20px; line-height: 1; cursor: pointer; min-width: 32px; min-height: 32px; }
.wf-banner .btn-sec { color: var(--fg); }
.wf-toast {
  position: fixed; z-index: 8; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(460px, calc(100vw - 24px));
  display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 10px; background: var(--bg); color: var(--fg);
  border-left: 5px solid var(--ok); box-shadow: var(--shadow); font-size: 13.5px;
}
.wf-toast.warn { border-left-color: var(--warn); }
.wf-toast-lines { display: flex; flex-direction: column; gap: 2px; }
.wf-toast-actions, .wf-popup-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.wf-popup { display: flex; flex-direction: column; gap: 6px; }
body.sheet-open .wf-toast { left: calc((100vw - var(--sheet-w)) / 2); }

/* review queue (left panel) */
.q-count { margin-left: auto; margin-right: 6px; background: var(--warn); }
.q-count:empty { display: none; }
.q-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.q-tab { min-height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--fg); font: inherit; font-size: 13px; cursor: pointer; }
.q-tab.on { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .q-tab.on { color: #10151d; } }
.q-note { margin: 0 0 6px; font-size: 12.5px; }
.q-list { list-style: none; margin: 0; padding: 0; max-height: 340px; overflow-y: auto; border-top: 1px solid var(--line); }
.q-row { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); }
.q-item { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 6px; text-align: left; background: transparent; border: 0; color: inherit; font: inherit; cursor: pointer; }
.q-item:hover, .q-item.on { background: var(--accent-soft); }
.q-main { font-weight: 600; font-size: 13.5px; }
.q-addr { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.q-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.q-tag { padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--accent-soft); color: var(--accent); }
.q-tag.k-pin { background: #ffe3e3; color: #a51111; }
.q-tag.k-ambiguous { background: #fff0d1; color: #8a5a00; }
.q-tag.warn { background: #ffe8cc; color: #a64500; }
.q-link { align-self: center; padding: 0 8px; font-size: 12px; color: var(--accent); white-space: nowrap; }
.q-empty { padding: 10px 6px; list-style: none; }

@media (max-width: 640px) {
  /* phones: the collapsed panel is on top and the card is a bottom sheet, so notices go just under the panel */
  .quota-banner { left: 10px; right: 10px; max-width: none; transform: none; top: calc(66px + env(safe-area-inset-top)); }
  .wf-banner, .wf-toast { left: 10px; right: 10px; width: auto; max-width: none; transform: none; top: calc(66px + env(safe-area-inset-top)); bottom: auto; }
  body.sheet-open .wf-toast { left: 10px; }
  .wf-add { grid-template-columns: 1fr; }
  .wf-add textarea { grid-column: 1; }
  .q-list { max-height: 260px; }
}

/* private media of a listing (local API only): thumbnails under the main photo, click to enlarge */
.wf-media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-top: 6px; }
.wf-media-item { margin: 0; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.wf-media-thumb { padding: 0; border: 1px solid var(--accent-soft); border-radius: 6px; overflow: hidden; background: var(--accent-soft); cursor: zoom-in; aspect-ratio: 3 / 2; }
.wf-media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wf-media-cap { font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
.wf-media-cap a { color: var(--accent); }
.wf-docs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.wf-doc { padding: 4px 0; font-size: 13.5px; min-width: 0; }
.wf-doc-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.wf-doc-head a { color: var(--accent); overflow-wrap: anywhere; }
.wf-doc-meta { font-size: 11.5px; color: var(--muted); }
.wf-doc-facts { display: grid; grid-template-columns: max-content 1fr; gap: 1px 10px; margin: 4px 0 2px; font-size: 12.5px; }
.wf-doc-facts dt { color: var(--muted); }
.wf-doc-facts dd { margin: 0; overflow-wrap: anywhere; }
.wf-doc-tools { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 4px; }
.wf-doc-tools input[type="url"], .wf-doc-tools input[type="text"] { font: inherit; font-size: 14px; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; flex: 1 1 140px; min-width: 0; }
.wf-doc-file { font-size: 13px; max-width: 100%; }
.wf-doc-hint { font-size: 11.5px; margin: 6px 0 0; }
.wf-lightbox { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 16px; background: rgba(0, 0, 0, 0.82); }
.wf-lightbox img { max-width: min(96vw, 1400px); max-height: 80vh; object-fit: contain; border-radius: 6px; background: #000; }
.wf-lightbox-cap { max-width: 96vw; color: #e8ecf3; font-size: 13px; text-align: center; overflow-wrap: anywhere; }
.wf-lightbox-cap a { color: #9ccaf5; }
.wf-lightbox button { position: absolute; top: 12px; right: 12px; }

/* WP6: Street View coverage layer: legend, per-barrio progress, popup link */
.sv-info { margin-top: 6px; padding-top: 4px; border-top: 1px solid var(--line); }
.sv-info[hidden] { display: none; }
.sv-legend { margin: 4px 0 6px; }
.sv-dot {
  flex: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--c, #888); border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25);
}
.sv-dot.ring { box-shadow: 0 0 0 2px var(--c, #888); margin: 1px; }
.sv-dot.bold { box-shadow: 0 0 0 3px var(--c, #888); margin: 2px; }
.sv-dot.hollow { background: transparent; border-color: var(--c, #888); box-shadow: none; }
.sv-progress { margin: 0; padding: 0; list-style: none; font-size: 13px; display: flex; flex-direction: column; gap: 3px; }
.sv-progress .sv-total { margin-top: 3px; padding-top: 3px; border-top: 1px dashed var(--line); font-weight: 600; }
.sv-stamp { margin: 6px 0 0; font-size: 12px; }
.sv-popup-link { margin: 8px 0 0; }
.sv-popup-link a { color: var(--accent); font-weight: 600; }

/* Live map: round selector, drivers right now (pulsing markers), toast + highlight for a new listing */
.sv-round { display: flex; align-items: center; gap: 6px; margin: 4px 0 6px; font-size: 13px; }
.sv-round-select { font: inherit; padding: 2px 4px; }
.sv-zoomhint { margin: 4px 0; font-size: 12px; }
/* The marker element is the dot alone (fixed size, anchored at its centre), so the dot sits exactly on the
   driver's position at every zoom; the label hangs above it, out of the flow, and cannot shift the anchor.
   2026-10-20: NO `position` here - MapLibre gives the marker element `.maplibregl-marker { position: absolute }`; a
   `position: relative` on the same element (this file loads later) put every driver dot back into the page flow, so each
   dot sat a constant number of pixels off its point (hundreds of metres when zoomed out). Absolute is also the containing
   block for the dot and the label. */
.sv-driver { width: 18px; height: 18px; pointer-events: none; }
.sv-pulse { position: absolute; inset: 0; box-sizing: border-box; border-radius: 50%; background: #1c7ed6; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .3); }
.sv-pulse::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 2px solid #1c7ed6; animation: apf-pulse 1.6s ease-out infinite; }
.sv-driver-label { position: absolute; left: 50%; bottom: calc(100% + 10px); transform: translateX(-50%); padding: 1px 6px; border-radius: 10px; background: rgba(255, 255, 255, .92); color: #0b3d6b; font-size: 12px; font-weight: 600; white-space: nowrap; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.live-new-pulse { width: 26px; height: 26px; border-radius: 50%; border: 3px solid #d6001c; animation: apf-pulse 1.2s ease-out infinite; pointer-events: none; }
@keyframes apf-pulse { 0% { transform: scale(.6); opacity: .95; } 100% { transform: scale(1.9); opacity: 0; } }
.live-toasts { position: fixed; right: 12px; bottom: 12px; z-index: 70; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; pointer-events: none; }
.live-toast { padding: 8px 12px; border-radius: 8px; background: #1f2937; color: #fff; font-size: 13px; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); animation: apf-toast-in .25s ease-out; }
@keyframes apf-toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sv-pulse::after, .live-new-pulse { animation: none; } }

/* example property cards (examples.js) and the about-page link of the public build */
.about-link { display: inline-block; align-self: flex-start; margin: 4px 0 2px; padding: 5px 12px; border-radius: 999px; background: #7c3aed; color: #fff; text-decoration: none; font-size: 12.5px; font-weight: 700; box-shadow: 0 1px 4px rgba(124, 58, 237, .35); }
.about-link:hover { background: #6d28d9; }
.maplibregl-popup-content .ex-card { max-height: 55vh; overflow-y: auto; padding-right: 4px; overscroll-behavior: contain; }
.ex-card dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 8px 0; font-size: 13px; }
.ex-card dt { color: var(--muted); }
.ex-card dd { margin: 0; }
.ex-badge { display: inline-block; margin-bottom: 4px; padding: 1px 8px; border-radius: 999px; background: #7c3aed; color: #fff; font-size: 11px; font-weight: 600; }
.ex-mask { color: transparent; background: linear-gradient(90deg, var(--line), color-mix(in srgb, var(--line) 50%, transparent)); border-radius: 4px; filter: blur(1.5px); user-select: none; letter-spacing: -1px; }
.ex-flags-title { margin: 10px 0 4px; font-weight: 600; font-size: 13px; }
.ex-flags { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ex-flag { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; border-left: 3px solid #9ca3af; border-radius: 4px; background: color-mix(in srgb, var(--line) 30%, transparent); font-size: 12.5px; }
.ex-flag.sev-high { border-left-color: #dc2626; }
.ex-flag.sev-medium { border-left-color: #f59e0b; }
.ex-flag span { color: var(--muted); }
.ex-note { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.ex-cta { margin-top: 10px; width: 100%; }

/* about.html (public build) */
body.about-page { overflow: auto; background: var(--bg); color: var(--fg); }
.about-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--line); z-index: 2; }
.about-back { color: var(--accent); text-decoration: none; font-weight: 600; }
.about-main { max-width: 760px; margin: 0 auto; padding: 20px 16px 48px; line-height: 1.55; }
.about-main h1 { font-size: 26px; line-height: 1.25; margin: 8px 0 10px; }
.about-main h2 { font-size: 19px; margin: 28px 0 8px; }
.about-lead { font-size: 16.5px; color: var(--muted); margin: 0; }
.about-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.about-example { max-width: 360px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.about-cta { padding: 16px; border-radius: var(--radius); background: var(--accent-soft); }
.about-cta h2 { margin-top: 0; }
.about-cta .req-open { max-width: 320px; }
.about-disclaimer { margin-top: 28px; font-size: 13px; color: var(--muted); }
.about-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); font-size: 13.5px; }
.ap-title { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.ap-sub { font-size: 12px; color: var(--muted); margin: 8px 0 4px; }
.ap-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.ap-check { width: 16px; height: 16px; flex: none; border-radius: 4px; background: var(--accent); color: #fff; font-size: 11px; line-height: 16px; text-align: center; }
.ap-filter { display: flex; justify-content: space-between; padding: 8px 10px; margin-bottom: 6px; border: 1px solid var(--line); border-radius: 8px; }
.ap-caret { color: var(--muted); }
.about-map { margin: 0; }
.about-map img { width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--line); }
.about-map-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 12.5px; }
.aml-item { display: inline-flex; align-items: center; gap: 6px; }
.aml-sw { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.aml-obj { background: #7c3aed; border-radius: 50%; }
.aml-parcel { background: #fff; border: 1px solid #0f766e; }
.aml-flood { width: 28px; background: linear-gradient(90deg, #86efac, #fde047, #f97316, #dc2626); }
.aml-banado { background: rgba(220, 38, 38, .4); }
.aml-amen { background: #15803d; border-radius: 50%; }
.aml-barrio { border: 2px dashed #1f6fb4; }
.sc-card { max-width: 520px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); font-size: 13.5px; }
.sc-head { display: flex; flex-direction: column; gap: 2px; font-size: 15px; }
.sc-block h3 { margin: 14px 0 6px; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.sc-block dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; }
.sc-block dt { color: var(--muted); }
.sc-block dd { margin: 0; }
.sc-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sc-photos img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 8px; }
.sc-env { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.sc-env li { display: flex; gap: 8px; align-items: baseline; }
.sc-sign { width: 18px; text-align: center; font-weight: 700; }
.sc-minus .sc-sign { color: #dc2626; }
.sc-plus .sc-sign { color: #15803d; }
.sc-tax { margin: 0; font-size: 16px; font-weight: 700; }
.sc-block ol { margin: 0; padding-left: 20px; }
.sc-dd { margin-top: 14px; width: 100%; }

/* request form of the public build (request.js) */
.req-open { width: 100%; min-height: var(--tap); }
.req-parcel { margin-top: 10px; width: 100%; }
.req-dialog { width: min(480px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--fg); box-shadow: var(--shadow); }
.req-dialog::backdrop { background: rgba(10, 15, 25, .45); }
.req-form { display: flex; flex-direction: column; gap: 10px; padding: 18px 16px 16px; }
.req-title { margin: 0; font-size: 18px; }
.req-intro { margin: 0; color: var(--muted); font-size: 13.5px; }
.req-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.req-field input, .req-field textarea { font: inherit; font-size: 15px; color: var(--fg); background: var(--bg); padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; }
.req-field textarea { resize: vertical; min-height: 96px; }
.req-field input:focus, .req-field textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.req-consent { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.req-consent input { width: 18px; height: 18px; flex: none; margin-top: 1px; accent-color: var(--accent); }
.req-trap { position: absolute; left: -10000px; width: 1px; height: 1px; opacity: 0; }
.req-status { margin: 0; min-height: 1.2em; font-size: 13.5px; }
.req-actions { display: flex; justify-content: flex-end; gap: 8px; }
