:root {
  --okp-modal-radius: 16px;
  --okp-modal-shadow: 0 24px 64px rgba(2, 12, 24, 0.32);
  --okp-modal-border: 2px solid rgba(95, 120, 137, 0.98);
  --okp-modal-ring: 0 0 0 1px rgba(61, 84, 98, 0.22);
  --okp-modal-head-bg: rgba(246, 251, 253, 0.96);
  --okp-modal-body-bg: rgba(255, 255, 255, 0.98);
  --okp-modal-overlay: rgba(2, 8, 23, 0.62);
  --okp-modal-title: #12384a;
  --okp-modal-text: #193647;
}

.okp-modal {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--okp-modal-text);
  overflow: hidden;
  box-sizing: border-box;
}

dialog.okp-modal::backdrop {
  background: var(--okp-modal-overlay);
}

dialog.okp-modal {
  position: fixed;
  inset: 0;
  margin: 0;
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  display: none;
  align-items: center;
  justify-content: center;
  padding-top: max(12px, var(--sat, 0px));
  padding-right: max(12px, var(--sar, 0px));
  padding-bottom: max(12px, var(--sab, 0px));
  padding-left: max(12px, var(--sal, 0px));
}

dialog.okp-modal[open] {
  display: flex;
}

#modalOverlay.okp-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--okp-modal-overlay);
  padding-top: max(12px, var(--sat, 0px));
  padding-right: max(12px, var(--sar, 0px));
  padding-bottom: max(12px, var(--sab, 0px));
  padding-left: max(12px, var(--sal, 0px));
}

.okp-modal__card,
.modalCard {
  width: min(920px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: contain;
  border-radius: var(--okp-modal-radius);
  border: var(--okp-modal-border);
  outline: 1px solid rgba(61, 84, 98, 0.26);
  outline-offset: -1px;
  background: var(--okp-modal-body-bg);
  box-shadow: var(--okp-modal-shadow), var(--okp-modal-ring);
}

dialog.okp-modal .okp-modal__card,
dialog.okp-modal .modalCard {
  margin: 0;
}

.okp-modal__card--sm,
.modalCard.modalCard--sm { max-width: 420px; }
.okp-modal__card--md,
.modalCard.modalCard--md { max-width: 620px; }
.okp-modal__card--lg,
.modalCard.modalCard--lg { max-width: 920px; }
.okp-modal__card--xl,
.modalCard.modalCard--xl { max-width: 1160px; }

.okp-modal__head,
.modalHead {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(197, 216, 226, 0.95);
  background: var(--okp-modal-head-bg);
}

.okp-modal__title {
  margin: 0;
  min-width: 0;
  color: var(--okp-modal-title);
  font-size: clamp(16px, 1.3vw, 20px);
  line-height: 1.25;
  font-weight: 700;
}

.okp-modal__body,
#modalBody {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 14px 14px calc(14px + var(--sab, 0px));
  scroll-padding-bottom: calc(14px + var(--sab, 0px));
}

.okp-modal__footer,
.modalFooter,
.modalFoot {
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: 10px 14px;
  border-top: 1px solid rgba(197, 216, 226, 0.95);
  background: rgba(250, 253, 255, 0.98);
}

.okp-modal__actions,
.modalActions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.okp-modal__actions > .btn:not(.danger):not(.warn):not(.success):first-child,
.modalActions > .btn:not(.danger):not(.warn):not(.success):first-child {
  order: 1;
}

.okp-modal__actions > .btn:not(.danger):not(.warn):not(.success):last-child,
.modalActions > .btn:not(.danger):not(.warn):not(.success):last-child {
  order: 2;
}

.okp-modal__state,
.okp-modal .warn,
.okp-modal .err,
.okp-modal .success {
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 9px 11px;
}

.okp-modal__state--danger,
.okp-modal .err,
.okp-modal .danger {
  color: #8e1a2f;
  background: #fff2f4;
  border-color: #f4c7d0;
}

.okp-modal .err:empty,
.okp-modal .warn:empty,
.okp-modal .success:empty {
  display: none;
  padding: 0;
  border: 0;
}

.okp-modal__state--warn,
.okp-modal .warn {
  color: #76530e;
  background: #fff8e8;
  border-color: #f2dfad;
}

.okp-modal__state--success,
.okp-modal .success,
.okp-modal .ok {
  color: #0f5f35;
  background: #ecfbf2;
  border-color: #bce7cc;
}

.poolGeoPanel {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(197, 216, 226, 0.95);
  background: rgba(247, 251, 253, 0.92);
}

.poolGeoHead {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.poolGeoGrid {
  margin-top: 10px;
}

.poolGeoPanel--shared {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 0;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(186, 208, 219, 0.95);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 249, 251, 0.96)),
    radial-gradient(circle at top right, rgba(19, 160, 171, 0.08), transparent 42%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.poolFormShell {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 2px 0 4px;
}

.poolFormHero,
.poolFormSection {
  border-radius: 24px;
  border: 1px solid rgba(189, 210, 220, 0.95);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 251, 253, 0.98)),
    radial-gradient(circle at top right, rgba(19, 160, 171, 0.06), transparent 38%);
  box-shadow: 0 14px 34px rgba(12, 34, 48, 0.08);
}

.poolFormHero {
  padding: 18px 18px 16px;
}

.poolFormEyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #1c6879;
}

.poolFormTitle {
  margin-top: 6px;
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.05;
  font-weight: 800;
  color: #113648;
}

.poolFormLead {
  margin-top: 8px;
  max-width: 64ch;
  font-size: 13px;
  line-height: 1.5;
  color: #51707d;
}

.poolFormSecurity {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(19, 160, 171, 0.18);
  background: rgba(224, 245, 247, 0.92);
  color: #104b5c;
  font-size: 12px;
  line-height: 1.35;
}

.poolFormSection {
  padding: 16px;
}

.poolFormSectionHead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.poolFormSectionTitle {
  font-size: 16px;
  font-weight: 800;
  color: #113648;
}

.poolFormSectionNote {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.45;
  color: #5b7581;
}

.poolFormBadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(19, 160, 171, 0.18);
  background: rgba(232, 248, 250, 0.96);
  color: #115466;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.poolFormGrid {
  align-items: start;
}

.poolFormField {
  min-width: 0;
}

.poolFormField--full {
  grid-column: 1 / -1;
}

.poolGeoActions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.poolGeoActions .btn {
  min-height: 42px;
}

.poolMapShell {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid rgba(190, 210, 220, 0.95);
  background:
    radial-gradient(circle at 20% 20%, rgba(19, 160, 171, 0.14), transparent 32%),
    linear-gradient(180deg, rgba(240, 248, 250, 0.95), rgba(227, 237, 242, 0.95));
}

.poolMapPlaceholder,
.poolMiniMap {
  padding: 14px;
}

.poolMapPlaceholderTitle,
.poolMiniMapTitle {
  font-size: 14px;
  font-weight: 800;
  color: #13394b;
}

.poolMapPlaceholderText,
.poolMiniMapHint {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.45;
  color: #58727e;
}

.poolAddressSuggest {
  margin-top: 8px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border-radius: 16px;
  border: 1px solid rgba(188, 209, 219, 0.98);
  background: rgba(245, 251, 253, 0.98);
}

.poolAddressSuggest[data-busy="1"] {
  opacity: 0.84;
}

.poolAddressSuggestItem {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  color: #143a4b;
  font: inherit;
  text-align: left;
  box-shadow: inset 0 0 0 1px rgba(189, 210, 220, 0.92);
}

.poolAddressSuggestItem:focus-visible,
.poolAddressSuggestItem:hover {
  background: rgba(227, 244, 247, 0.98);
  box-shadow: inset 0 0 0 1px rgba(19, 160, 171, 0.28);
}

.poolAddressSuggestMain {
  display: block;
  font-size: 13px;
  line-height: 1.35;
}

.poolMiniMapHead,
.poolMiniMapFooter {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.poolMiniMapViewportShell {
  position: relative;
  margin-top: 12px;
}

.poolMiniMapViewport {
  position: relative;
  min-height: 260px;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(188, 209, 219, 0.98);
  background:
    radial-gradient(circle at 14% 16%, rgba(255, 255, 255, 0.48), transparent 34%),
    linear-gradient(180deg, rgba(231, 243, 248, 0.96), rgba(210, 227, 235, 0.96));
  touch-action: pan-x pan-y;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.poolMiniMapViewport .leaflet-pane,
.poolMiniMapViewport .leaflet-tile-pane,
.poolMiniMapViewport .leaflet-map-pane {
  will-change: transform;
}

.poolMiniMapCross {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34px;
  height: 34px;
  margin-left: -17px;
  margin-top: -17px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.88);
  box-shadow: 0 0 0 1px rgba(17, 66, 84, 0.22);
  pointer-events: none;
}

.poolMiniMapCross::before,
.poolMiniMapCross::after {
  content: "";
  position: absolute;
  background: rgba(17, 66, 84, 0.7);
}

.poolMiniMapCross::before {
  left: 50%;
  top: 4px;
  width: 2px;
  height: calc(100% - 8px);
  margin-left: -1px;
}

.poolMiniMapCross::after {
  top: 50%;
  left: 4px;
  height: 2px;
  width: calc(100% - 8px);
  margin-top: -1px;
}

.poolMiniMapPin {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 24px;
  height: 24px;
  margin-left: -12px;
  margin-top: -28px;
  pointer-events: none;
}

.poolMiniMapPin::before,
.poolMiniMapPin::after {
  content: "";
  position: absolute;
}

.poolMiniMapPin::before {
  left: 2px;
  top: 0;
  width: 20px;
  height: 20px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: linear-gradient(180deg, #f55d77, #c92a4e);
  box-shadow: 0 12px 18px rgba(201, 42, 78, 0.28);
}

.poolMiniMapPin::after {
  left: 8px;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 0 0 1px rgba(16, 55, 70, 0.18);
}

.poolMiniMapPin.isGhost {
  opacity: 0.48;
}

.poolMiniMapViewport .leaflet-control-zoom a {
  width: 44px;
  height: 44px;
  line-height: 44px;
  font-size: 20px;
}

.poolMiniMapViewport .leaflet-bar {
  border: 0;
  box-shadow: 0 18px 30px rgba(15, 70, 89, 0.16);
}

.poolMiniMapViewport .leaflet-bar a {
  border-bottom-color: rgba(188, 209, 219, 0.92);
  background: rgba(255, 255, 255, 0.94);
  color: #0f4c5e;
}

.poolMiniMapViewport .leaflet-bar a:hover,
.poolMiniMapViewport .leaflet-bar a:focus {
  background: rgba(227, 244, 247, 0.98);
}

.poolMiniMapViewport .leaflet-top,
.poolMiniMapViewport .leaflet-bottom {
  z-index: 10;
}

.poolMiniMapViewport .leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 10px 0 0 0;
  font-size: 10px;
}

.poolGeoStatus {
  min-height: 18px;
  font-size: 12px;
  line-height: 1.45;
  color: #5b7581;
}

.poolGeoStatus[data-tone="ok"] {
  color: #0f6a42;
}

.poolGeoStatus[data-tone="warn"] {
  color: #7a540d;
}

.poolGeoStatus[data-tone="err"] {
  color: #941f36;
}

@media (max-width: 900px) {
  dialog.okp-modal {
    padding-top: max(10px, var(--sat, 0px));
    padding-right: max(10px, var(--sar, 0px));
    padding-bottom: max(10px, var(--sab, 0px));
    padding-left: max(10px, var(--sal, 0px));
  }

  .okp-modal__card,
  .modalCard {
    width: min(860px, 100%);
    max-height: 100%;
  }
}

@media (max-width: 680px) {
  .okp-modal__head,
  .modalHead {
    padding: 10px 12px;
  }

  .okp-modal__body,
  #modalBody {
    padding: 12px 12px calc(12px + var(--sab, 0px));
    scroll-padding-bottom: calc(12px + var(--sab, 0px));
  }

  .okp-modal__footer,
  .modalFooter,
  .modalFoot {
    padding: 10px 12px;
  }

  .okp-modal__actions,
  .modalActions {
    width: 100%;
    justify-content: stretch;
  }

  .okp-modal__actions > .btn,
  .modalActions > .btn {
    flex: 1 1 auto;
  }

  .poolGeoHead {
    flex-direction: column;
    align-items: stretch;
  }

  .poolFormShell {
    gap: 12px;
  }

  .poolFormHero {
    padding: 14px 14px 12px;
  }

  .poolFormEyebrow {
    font-size: 10px;
    letter-spacing: 0.08em;
  }

  .poolFormTitle {
    margin-top: 4px;
    font-size: 20px;
  }

  .poolFormLead {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.4;
  }

  .poolFormSecurity {
    margin-top: 8px;
    min-height: 0;
    padding: 8px 10px;
    border-radius: 16px;
    font-size: 11px;
    line-height: 1.35;
  }

  .poolFormSection {
    padding: 12px;
  }

  .poolFormSectionHead {
    margin-bottom: 10px;
  }

  .poolMapPlaceholder,
  .poolMiniMap {
    padding: 12px;
  }

  .poolGeoActions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .poolGeoActions .btn {
    width: 100%;
  }

  .poolMiniMapViewport {
    min-height: 220px;
  }

  .poolMiniMapHead,
  .poolMiniMapFooter {
    gap: 10px;
  }

  .poolMiniMapHead {
    align-items: stretch;
  }

  .poolAddressSuggest {
    padding: 6px;
  }
}
