.kpm-thumb {
  --kpm-preview-width: 70px;
  position: relative;
  display: inline-flex;
  flex: 0 0 var(--kpm-preview-width);
  align-self: center;
  align-items: flex-end;
  justify-content: flex-end;
  width: var(--kpm-preview-width);
  height: 45px;
  min-width: 44px;
  min-height: 44px;
  margin-inline: 5px 2px;
  padding: 0;
  overflow: hidden;
  border: 1px solid #b5cbd0;
  border-radius: 8px;
  background: #e6f1f3;
  color: #155756;
  cursor: pointer;
}
.kpm-thumb:hover { border-color: #087872; box-shadow: 0 1px 5px #10575c29; }
.kpm-thumb:focus-visible, .kpm-dialog :focus-visible { outline: 2px solid #006f78; outline-offset: 3px; }
.kpm-thumb__picture { position: absolute; inset: 0; width: 100%; height: 100%; }
.kpm-thumb__label {
  position: relative;
  z-index: 1;
  margin: 0 2px 2px;
  padding: 1px 4px;
  border-radius: 3px;
  background: #ffffffef;
  color: #124e50;
  font: 700 10px/1.35 system-ui, sans-serif;
}
.kpm-thumb__unmapped {
  position: absolute;
  top: 3px;
  left: 3px;
  min-width: 15px;
  border-radius: 6px;
  background: #fff;
  color: #596672;
  font: 700 11px/15px system-ui, sans-serif;
  text-align: center;
}
.kpm-thumb--profile, .kpm-thumb--detail {
  --kpm-preview-width: 148px;
  display: flex;
  width: min(var(--kpm-preview-width),100%);
  height: 93px;
  margin: 10px 0 8px;
}
.kpm-thumb--profile .kpm-thumb__label, .kpm-thumb--detail .kpm-thumb__label { padding: 3px 7px; font-size: 11px; }
.kh-clinic-list.is-cards .kpm-thumb { position: absolute; bottom: 11px; right: 43px; }
.kh-clinic-list.is-cards .kh-row-select { padding-bottom: 47px; }
.kh-address-card .kpm-thumb--detail { margin-bottom: 0; }
.kpm-dialog:not([open]) { display:none; }
body:has(.kpm-dialog[open]) { overflow: hidden; }
.kpm-dialog {
  display: grid;
  grid-template-rows: auto auto minmax(0,1fr) auto;
  inset: 0;
  width: min(940px,calc(100% - 32px));
  max-width: none;
  max-height: min(94dvh,780px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid #bbcbd2;
  border-radius: 17px;
  box-shadow: 0 20px 70px #112c4350;
  background: #fff;
  color: #19333e;
  font-family: inherit;
}
.kpm-dialog::backdrop { background: #102b3ab8; }
.kpm-dialog [hidden] { display: none !important; }
.kpm-dialog a { color: #116467; text-underline-offset: 3px; }
.kpm-dialog__header {
  display:flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 20px 11px;
}
.kpm-dialog__heading { margin: 0; font-size: clamp(18px,3vw,24px); font-weight: 720; line-height: 1.24; letter-spacing: -.025em; }
.kpm-dialog__street { margin: 4px 0 0; color: #48606a; font-size: .88rem; line-height: 1.4; }
.kpm-dialog__close {
  display: grid;
  flex: 0 0 44px;
  place-items: center;
  height: 44px;
  padding: 0 0 3px;
  border: 1px solid #c9d6d9;
  border-radius: 10px;
  background: #f9fcfc;
  color: #344f58;
  font: 500 26px/1 system-ui,sans-serif;
  cursor: pointer;
}
.kpm-dialog__close:hover { background:#e9f4f3; color:#087872; }
.kpm-dialog__filters { display: grid; grid-template-columns: minmax(150px,1fr) minmax(190px,1.3fr); gap: 10px; padding: 0 20px 12px; }
.kpm-dialog__label { display: grid; gap: 3px; min-width: 0; margin: 0; color: #39525d; font-size: .75rem; font-weight: 700; }
.kpm-dialog__select {
  box-sizing: border-box;
  width: 100%;
  min-height: 38px;
  min-width: 0;
  padding: 4px 8px;
  border: 1px solid #c4d2d7;
  border-radius: 7px;
  background: #f8fbfb;
  color: #19333e;
  font: inherit;
  font-size: .89rem;
  text-overflow: ellipsis;
}
.kpm-dialog__map { position: relative; z-index: 0; box-sizing: border-box; height: clamp(235px,53dvh,510px); background: #edf3f1; }
.kpm-dialog__map--hover.leaflet-grab { cursor: pointer; }
.kpm-dialog__footer { display: grid; gap: 7px; padding: 10px 20px 13px; }
.kpm-dialog__legend, .kpm-dialog__links { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 17px; }
.kpm-dialog__links { font-size: .78rem; }
.kpm-key { display: inline-flex; align-items: center; gap: 6px; color: #314957; font-size: .75rem; }
.kpm-key::before { content:''; width: 7px; height: 7px; border-radius: 100%; background: #66717d; }
.kpm-key--selected::before { width: 11px; height: 11px; background: #087872; }
.kpm-dialog__note, .kpm-dialog__error { margin: 0; color: #48606a; font-size: .75rem; }
.kpm-dialog__attribution { margin: 0; color: #48606a; font-size: .7rem; }
.kpm-dialog__error { padding: 7px 20px; background:#fff3dd; color:#644429; }
.kpm-marker { display: grid; place-items: center; pointer-events: none; }
.kpm-marker__face {
  box-sizing: border-box;
  display: block;
  width: 8px;
  height: 8px;
  border: 1px solid #fff;
  border-radius: 50%;
  background: #66717d;
  box-shadow: 0 1px 2px #293e4864;
  transition: background-color .12s, transform .12s;
}
.kpm-marker__face--hover, .kpm-marker__face--active { background:#087872; transform: scale(1.65); }
.kpm-marker__face--selected {
  width: 20px;
  height: 20px;
  border: 2px solid #fff;
  background: #087872;
  box-shadow: 0 0 0 2px #087872a1,0 2px 4px #293e4864;
}
.kpm-marker__face--selected::after {
  content: '';
  display:block;
  width: 5px;
  height: 5px;
  margin: 5.5px auto 0;
  border-radius: 50%;
  background: #fff;
}
.kpm-marker__face--selected.kpm-marker__face--hover, .kpm-marker__face--selected.kpm-marker__face--active { transform: scale(1.12); }
.kpm-fit {
  display: block;
  min-height: 35px;
  padding: 4px 10px;
  border: 1px solid #82999f;
  border-radius: 5px;
  background: #fff;
  color: #155756;
  font: 700 12px/1.25 system-ui,sans-serif;
  cursor: pointer;
}
.kpm-tooltip.leaflet-tooltip { max-width: min(240px,65vw); padding: 7px 9px; white-space: normal; }
.kpm-map-tip, .kpm-popup__item { display: grid; gap: 3px; color: #233b42; font: 400 12px/1.38 system-ui,sans-serif; }
.kpm-popup { display: grid; gap: 7px; max-height: 125px; overflow: auto; }
.kpm-popup a { font-weight: 650; }
.kpm-popup span, .kpm-map-tip span { color: #52616d; }
@container (max-width: 450px) { .kh-clinic-row .kpm-thumb { --kpm-preview-width: 48px; margin-inline: 1px; } }
@media (max-width: 560px) {
  .kpm-dialog { width: calc(100% - 16px); max-height: 94dvh; border-radius: 12px; }
  .kpm-dialog__header { padding: 10px 12px 9px; }
  .kpm-dialog__filters { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 6px; padding: 0 12px 8px; }
  .kpm-dialog__select { min-height: 43px; font-size: 16px; }
  .kpm-dialog__map { height: clamp(200px,46dvh,450px); }
  .kpm-dialog__footer { padding: 7px 12px 9px; }
}
@media (prefers-reduced-motion: reduce) { .kpm-marker__face { transition: none; } }
