/* Výber lokalít na mape SR (locality-map.js) — CRM aj verejný web. Farby z premenných aplikácie, inak vlastné.
   Predpona „html body“ = vyššia priorita než všeobecné štýly tlačidiel CRM (button:not(.secondary)…). */
html body .lmap {
  --lm-accent: var(--brand, #2f7d5b);
  --lm-accent-dark: var(--brand-dark, #22604a);
  --lm-ink: var(--ink, #17211e);
  --lm-muted: var(--muted, #6d7773);
  --lm-line: var(--line, #e2e6e3);
  --lm-paper: var(--paper, #fff);
  --lm-ground: #f5f6f2;
  --lm-pick: color-mix(in srgb, var(--lm-accent) 72%, #fff);
  --lm-part: color-mix(in srgb, var(--lm-accent) 22%, #fff);
  width: min(1240px, 96vw); max-width: 96vw; height: min(860px, 94vh); max-height: 94vh;
  padding: 0; border: 0; border-radius: 16px; color: var(--lm-ink); background: var(--lm-paper);
  box-shadow: 0 24px 70px #0b1a1480; font: 14px/1.4 Inter, "DM Sans", "Segoe UI", Arial, sans-serif; overflow: hidden;
}
html body .lmap::backdrop { background: #07100dcc; backdrop-filter: blur(3px); }
html body .lmap *, html body .lmap *::before, html body .lmap *::after { box-sizing: border-box; }
html body .lmap .lmap-shell button, html body .lmap-field button { font: inherit; cursor: pointer; transform: none; box-shadow: none; text-shadow: none; letter-spacing: 0; text-transform: none; }
html body .lmap-shell { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100%; }
html body .lmap-head { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--lm-line); }
html body .lmap-head h2 { margin: 0; font-size: 19px; white-space: nowrap; }
html body .lmap-search { position: relative; flex: 1; max-width: 520px; }
html body .lmap-search input { width: 100%; margin: 0; padding: 9px 12px; border: 1px solid #c6d0cb; border-radius: 9px; color: var(--lm-ink); background: #fff; font: inherit; }
html body .lmap-results { position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; right: 0; max-height: 340px; overflow: auto; padding: 4px; border: 1px solid var(--lm-line); border-radius: 10px; background: #fff; box-shadow: 0 14px 34px #0b1a1433; }
html body .lmap .lmap-results button { display: block; width: 100%; margin: 0; padding: 7px 10px; border: 0; border-radius: 7px; color: var(--lm-ink); background: transparent; text-align: left; font-weight: 400; }
html body .lmap .lmap-results button:hover, html body .lmap .lmap-results button.is-current { background: var(--lm-part); }
html body .lmap-results small, html body .lmap-muted { color: var(--lm-muted); }
html body .lmap-results .lmap-muted { display: block; padding: 8px 10px; }
html body .lmap-actions { display: flex; gap: 8px; margin-left: auto; }
html body .lmap .lmap-btn { margin: 0; padding: 8px 14px; border: 1px solid transparent; border-radius: 9px; font-weight: 650; line-height: 1.2; }
html body .lmap .lmap-btn-primary, html body .lmap-field .lmap-btn-primary { color: #fff; background: var(--lm-accent, #2f7d5b); }
html body .lmap .lmap-btn-primary:hover { background: var(--lm-accent-dark); }
html body .lmap .lmap-btn-ghost { color: var(--lm-ink); background: #edf1ee; }
html body .lmap .lmap-btn-ghost:hover { background: #e1e8e3; }
html body .lmap-body { display: grid; grid-template-columns: 270px minmax(0, 1fr); min-height: 0; }

/* Kraje a okresy */
html body .lmap-nav { display: block; overflow: auto; padding: 10px; border-right: 1px solid var(--lm-line); background: var(--lm-ground); }
html body .lmap .lmap-nav-sk { display: block; width: 100%; margin: 0 0 8px; padding: 8px 10px; border: 1px dashed #c6d0cb; border-radius: 9px; color: var(--lm-ink); background: #fff; text-align: left; font-weight: 600; }
html body .lmap .lmap-nav-sk.is-current { border-style: solid; border-color: var(--lm-accent); }
html body .lmap-region { margin-bottom: 4px; border-radius: 10px; }
html body .lmap-region.is-open { background: #fff; box-shadow: 0 1px 0 var(--lm-line); }
html body .lmap-region-head, html body .lmap-nav-row { display: flex; align-items: center; gap: 6px; padding: 2px 6px; border-radius: 8px; }
html body .lmap-region-head input, html body .lmap-nav-row input { width: 16px; height: 16px; margin: 0; flex: none; accent-color: var(--lm-accent); }
html body .lmap .lmap-region-toggle, html body .lmap .lmap-nav-open { flex: 1; min-width: 0; margin: 0; padding: 7px 4px; border: 0; color: var(--lm-ink); background: transparent; text-align: left; font-weight: 650; }
html body .lmap .lmap-nav-open { padding: 5px 4px; font-weight: 500; }
html body .lmap .lmap-region-toggle::after { content: '▸'; float: right; color: var(--lm-muted); }
html body .lmap .lmap-region.is-open .lmap-region-toggle::after { content: '▾'; }
html body .lmap-region-body { padding: 0 4px 6px 14px; }
html body .lmap-nav-row:hover { background: #f0f3f1; }
html body .lmap-nav-row.is-current { background: var(--lm-part); }
html body .lmap-nav-row.is-whole .lmap-nav-open, html body .lmap-region-head.is-whole .lmap-region-toggle { color: var(--lm-accent-dark); font-weight: 700; }
html body .lmap-nav small { color: var(--lm-muted); font-weight: 400; }
html body .lmap-count { display: inline-grid; min-width: 20px; height: 20px; padding: 0 6px; place-items: center; border-radius: 10px; color: #fff; background: var(--lm-accent); font-size: 11px; font-weight: 700; }

/* Mapa */
html body .lmap-main { display: flex; flex-direction: column; min-height: 0; overflow: auto; }
html body .lmap-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 14px; border-bottom: 1px solid var(--lm-line); }
html body .lmap-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--lm-muted); }
html body .lmap-crumbs strong { color: var(--lm-ink); }
html body .lmap .lmap-crumb { margin: 0; padding: 2px 4px; border: 0; color: var(--lm-accent-dark); background: transparent; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
html body .lmap-toggles { display: flex; flex-wrap: wrap; gap: 6px; }
html body .lmap .lmap-view { margin-left: auto; }
html body .lmap .lmap-navtoggle { display: none; }
html body .lmap-canvas { position: relative; flex: none; height: clamp(300px, 56vh, 640px); padding: 8px 14px; }
html body .lmap-svg { display: block; width: 100%; height: 100%; }
html body .lmap-area { fill: #eef1ec; stroke: #9aa8a0; stroke-width: 1.1; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill .12s; }
html body .lmap-area:hover { fill: var(--lm-part); }
html body .lmap-area.is-partial { fill: color-mix(in srgb, var(--lm-accent) 30%, #fff); }
html body .lmap-area.is-selected { fill: var(--lm-pick); stroke: var(--lm-accent-dark); }
html body .lmap-area.is-selected:hover { fill: color-mix(in srgb, var(--lm-accent) 58%, #fff); }
html body .lmap-area.is-focus { stroke: #111; stroke-width: 2.4; }
html body .lmap-line { fill: none; stroke: #33433b; stroke-width: 2; vector-effect: non-scaling-stroke; pointer-events: none; }
html body .lmap-labels text { fill: #22302a; text-anchor: middle; dominant-baseline: middle; font-weight: 600; paint-order: stroke; stroke: #ffffffd0; stroke-width: 2.5px; stroke-linejoin: round; pointer-events: none; }
html body .lmap-svg.is-overview .lmap-labels text { font-weight: 500; }
html body .lmap-loading, html body .lmap-error { margin: 30px 0; color: var(--lm-muted); text-align: center; }
html body .lmap-error { color: var(--danger, #b04438); }
html body .lmap-list { padding: 6px 14px 10px; }
html body .lmap-list-group { margin-bottom: 8px; }
html body .lmap-list-group > strong { display: block; margin-bottom: 4px; font-size: 13px; }
html body .lmap-chips { display: flex; flex-wrap: wrap; gap: 5px; }
html body .lmap .lmap-chip { margin: 0; padding: 4px 10px; border: 1px solid #cdd6d1; border-radius: 999px; color: var(--lm-ink); background: #fff; font-size: 13px; font-weight: 500; line-height: 1.3; }
html body .lmap .lmap-chip:hover { border-color: var(--lm-accent); }
html body .lmap .lmap-chip.is-on { color: #fff; border-color: var(--lm-accent); background: var(--lm-accent); }
html body .lmap .lmap-chip.is-focus { box-shadow: 0 0 0 2px #111; }
html body .lmap .lmap-chip small { opacity: .75; font-weight: 400; }
html body .lmap .lmap-chip-small { padding: 2px 8px; font-size: 12px; }
html body .lmap .lmap-whole { font-weight: 650; }
html body .lmap-parts { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px 14px; }
html body .lmap-part { display: grid; gap: 4px; align-content: start; justify-items: start; }
html body .lmap-quarters { display: flex; flex-wrap: wrap; gap: 4px; padding-left: 10px; }
html body .lmap-attrib { margin: 0; padding: 0 14px 8px; color: var(--lm-muted); font-size: 11px; }

/* Súhrn */
html body .lmap-summary { display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-top: 1px solid var(--lm-line); background: var(--lm-ground); }
html body .lmap-summary-title { white-space: nowrap; }
html body .lmap-summary-chips { display: flex; flex: 1; flex-wrap: wrap; gap: 5px; max-height: 76px; overflow: auto; }
html body .lmap-tag { display: inline-flex; align-items: center; overflow: hidden; border: 1px solid var(--lm-accent, #2f7d5b); border-radius: 999px; background: #fff; font-size: 13px; }
html body .lmap-tag.is-custom { border-style: dashed; border-color: #9aa8a0; }
html body .lmap-tag .lmap-tag-open { margin: 0; padding: 3px 4px 3px 10px; border: 0; color: inherit; background: transparent; font-weight: 500; }
html body .lmap-tag .lmap-tag-x { margin: 0; padding: 3px 9px 3px 5px; border: 0; color: var(--lm-muted, #6d7773); background: transparent; font-size: 15px; line-height: 1; }
html body .lmap-tag .lmap-tag-x:hover { color: var(--danger, #b04438); }
html body .lmap .lmap-clear { white-space: nowrap; }

/* Zoznam namiesto mapy (prepínač „Zoznam“ a mobil) */
html body .lmap.is-list .lmap-canvas { display: none; }

/* Mobil: na celú obrazovku, okresy nad mapou, predvolene zoznam obcí */
@media (max-width: 760px) {
  html body .lmap { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  html body .lmap-head { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  html body .lmap-head h2 { font-size: 17px; }
  html body .lmap-search { order: 3; flex-basis: 100%; max-width: none; }
  html body .lmap-body { grid-template-columns: 1fr; grid-template-rows: auto auto; overflow: auto; }
  html body .lmap-nav { display: none; max-height: 50vh; border-right: 0; border-bottom: 1px solid var(--lm-line); }
  html body .lmap.is-nav-open .lmap-nav { display: block; }
  html body .lmap .lmap-navtoggle { display: inline-block; }
  html body .lmap-main { overflow: visible; }
  html body .lmap-toolbar { padding: 8px 12px; }
  html body .lmap-canvas { padding: 6px; }
  html body .lmap-canvas { height: 52vh; }
  html body .lmap-list { padding: 6px 12px 10px; }
  html body .lmap-parts { grid-template-columns: 1fr; }
  html body .lmap .lmap-chip { padding: 6px 11px; font-size: 14px; }
  html body .lmap-summary { flex-wrap: wrap; padding: 8px 12px; }
  html body .lmap-summary-chips { flex-basis: 100%; order: 3; max-height: 64px; }
}

/* Pole formulára (verejný web) */
html body .lmap-field { display: grid; gap: 8px; }
html body .lmap-field-tags { display: flex; flex-wrap: wrap; gap: 5px; min-height: 30px; align-items: center; }
html body .lmap-field-tags .lmap-tag { border-color: var(--gold, #b79a63); }
html body .lmap-field-tags .lmap-tag-open { padding: 3px 4px 3px 10px; }
html body .lmap-field-tags .lmap-muted { color: #6f7c76; font-size: 14px; }
html body .lmap-field .lmap-field-open { justify-self: start; margin: 0; padding: 10px 16px; border: 0; border-radius: 8px; color: #fff; background: var(--green, #13231d); font-weight: 700; cursor: pointer; }

/* CRM: tlačidlo mapy vedľa našepkávača lokalít dopytu (property-location.js) */
.loc-places-add { display: flex; gap: 8px; align-items: flex-start; }
.loc-places-add .loc-suggest { flex: 1; min-width: 0; }
.loc-places-add .loc-map-open { white-space: nowrap; }
@media (max-width: 760px) { .loc-places-add { flex-direction: column; align-items: stretch; } }
