body.map-page {
    overflow-x: hidden;
    background:
        radial-gradient(circle at top left, rgba(31, 119, 91, 0.12), transparent 24%),
        radial-gradient(circle at top right, rgba(240, 138, 75, 0.10), transparent 18%),
        linear-gradient(180deg, #f5f1eb 0%, #f9fbf9 48%, #edf4ef 100%);
}

.map-page__shell {
    position: relative;
    z-index: 0;
    gap: 1.1rem;
    padding-block: 1.15rem 2rem;
}

.map-hero {
    width: min(calc(100% - (var(--layout-gutter) * 2)), var(--layout-wide));
    margin-inline: auto;
    display: grid;
    gap: 1rem;
    padding: clamp(1rem, 2vw, 1.4rem);
    border-radius: 30px;
    background:
        radial-gradient(circle at top right, rgba(31, 119, 91, 0.12), transparent 24%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.93), rgba(255, 255, 255, 0.82));
    border: 1px solid rgba(255, 255, 255, 0.84);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(10px);
}

.map-hero__copy {
    display: grid;
    gap: 0.35rem;
}

.map-hero__title {
    margin: 0;
    font-family: Manrope, Inter, sans-serif;
    font-size: clamp(2rem, 3.2vw, 3.6rem);
    line-height: 1.02;
    letter-spacing: -0.05em;
    color: #18211c;
}

.map-hero__subtitle {
    margin: 0;
    color: var(--color-muted);
    max-width: 78ch;
    line-height: 1.6;
}

.map-hero__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.map-hero__pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.85rem;
    border-radius: 999px;
    background: rgba(31, 119, 91, 0.08);
    color: var(--color-primary-dark);
    font-size: 0.85rem;
    font-weight: 700;
}

.map-layout {
    width: min(calc(100% - (var(--layout-gutter) * 2)), var(--layout-wide));
    margin-inline: auto;
    display: grid;
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    gap: 1rem;
    align-items: stretch;
}

.map-filters,
.map-stage {
    min-width: 0;
}

.map-filters {
    position: relative;
    display: grid;
    gap: 1rem;
    align-content: start;
    padding: 1rem;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.84);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(10px);
    height: fit-content;
}

.map-filters__toggle {
    display: none;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 20px;
    border: 1px solid rgba(31, 119, 91, 0.14);
    background: rgba(31, 119, 91, 0.08);
    color: var(--color-primary-dark);
    font-weight: 800;
}

.map-filters__toggle i {
    transition: transform 0.2s ease;
}

.map-filters.is-open .map-filters__toggle i {
    transform: rotate(180deg);
}

.map-filters__body {
    display: grid;
    gap: 1rem;
}

.map-filters__head {
    display: grid;
    gap: 0.35rem;
}

.map-filters__head h2 {
    margin: 0;
    font-family: Manrope, Inter, sans-serif;
    font-size: 1.3rem;
    line-height: 1.15;
    letter-spacing: -0.03em;
}

.map-filters__head p {
    margin: 0;
    color: var(--color-muted);
    line-height: 1.55;
}

.map-filter-grid {
    display: grid;
    gap: 0.8rem;
}

.map-filter-grid--two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.map-filter-field {
    display: grid;
    gap: 0.45rem;
}

.map-filter-field label {
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #304039;
}

.map-filter-field select,
.map-filter-field input {
    width: 100%;
    min-height: 46px;
    border-radius: 16px;
    border: 1px solid rgba(32, 44, 36, 0.12);
    background: rgba(255, 255, 255, 0.92);
    padding: 0.75rem 0.85rem;
    color: var(--color-ink);
    box-shadow: none;
}

.map-filter-field input::placeholder {
    color: #8a949d;
}

.map-filters__actions {
    display: grid;
    gap: 0.65rem;
}

.map-filters__button {
    min-height: 48px;
    border: 0;
    border-radius: 16px;
    font-weight: 800;
    cursor: pointer;
}

.map-filters__button--primary {
    background: linear-gradient(135deg, var(--color-primary), #2ba46f);
    color: #fff;
    box-shadow: 0 16px 30px rgba(31, 119, 91, 0.22);
}

.map-filters__button--ghost {
    background: rgba(31, 119, 91, 0.08);
    color: var(--color-primary-dark);
}

.map-filters__note {
    padding: 0.85rem 0.95rem;
    border-radius: 18px;
    background: rgba(31, 119, 91, 0.08);
    color: var(--color-primary-dark);
    line-height: 1.5;
}

.map-stage {
    display: grid;
    gap: 0.9rem;
}

.map-stage__toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.85rem;
    align-items: center;
    padding: 1rem 1.1rem;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.84);
    box-shadow: var(--shadow-soft);
}

.map-stage__summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.map-stage__chip {
    display: inline-flex;
    align-items: baseline;
    gap: 0.38rem;
    padding: 0.58rem 0.8rem;
    border-radius: 999px;
    background: rgba(31, 119, 91, 0.08);
    color: var(--color-primary-dark);
}

.map-stage__chip strong {
    font-size: 1rem;
    font-weight: 900;
}

.map-stage__state {
    font-size: 0.95rem;
    color: var(--color-muted);
    text-align: right;
}

.map-stage__state[data-state="error"] {
    color: #a33148;
}

.map-stage__state[data-state="loading"] {
    color: var(--color-primary-dark);
}

.map-stage__map-wrap {
    position: relative;
    z-index: 0;
    min-height: 74vh;
    border-radius: 30px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255, 255, 255, 0.84);
    background: rgba(255, 255, 255, 0.72);
}

.map-stage__map-wrap .leaflet-bottom.leaflet-right .leaflet-control-zoom {
    margin-right: 1rem;
    margin-bottom: 5.05rem;
    box-shadow: 0 16px 32px rgba(10, 16, 13, 0.16);
    border: 1px solid rgba(31, 119, 91, 0.14);
    border-radius: 16px;
    overflow: hidden;
}

.map-stage__map-wrap .leaflet-control-zoom a {
    width: 2.7rem;
    height: 2.7rem;
    line-height: 2.7rem;
    background: rgba(255, 255, 255, 0.96);
    color: var(--color-primary-dark);
    border-color: rgba(31, 119, 91, 0.12);
}

.map-stage__map-wrap .leaflet-control-zoom a:hover,
.map-stage__map-wrap .leaflet-control-zoom a:focus-visible {
    background: #fff;
    color: var(--color-primary);
}

.map-stage__map-wrap .leaflet-control-zoom a.leaflet-disabled {
    background: rgba(255, 255, 255, 0.76);
    color: rgba(33, 48, 40, 0.45);
}

.map-stage__locate {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    z-index: 520;
    width: 3.5rem;
    height: 3.5rem;
    display: inline-grid;
    place-items: center;
    border: 1px solid rgba(31, 119, 91, 0.14);
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(244, 248, 245, 0.94));
    color: var(--color-primary-dark);
    box-shadow: 0 16px 32px rgba(10, 16, 13, 0.16);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.map-stage__locate:hover,
.map-stage__locate:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 20px 36px rgba(10, 16, 13, 0.2);
    background: linear-gradient(135deg, #ffffff, #eef4ef);
}

.map-stage__locate.is-active {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: #fff;
    border-color: rgba(31, 119, 91, 0.3);
}

.map-stage__locate i {
    font-size: 1rem;
    line-height: 1;
}

.map-stage__map {
    width: 100%;
    min-height: 74vh;
}

.map-stage__overlay {
    position: absolute;
    inset: 1rem auto auto 1rem;
    z-index: 500;
    display: grid;
    gap: 0.55rem;
    max-width: min(92vw, 360px);
    pointer-events: none;
}

.map-stage__overlay-panel {
    padding: 0.9rem 1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.85);
    box-shadow: var(--shadow-soft);
    line-height: 1.55;
    pointer-events: auto;
}

.map-stage__legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    pointer-events: auto;
}

.map-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.84);
    box-shadow: var(--shadow-soft);
    font-size: 0.84rem;
    font-weight: 800;
}

.map-legend__swatch {
    width: 0.8rem;
    height: 0.8rem;
    border-radius: 999px;
    display: inline-block;
}

.map-legend__swatch--lost {
    background: #d84d4d;
}

.map-legend__swatch--found {
    background: #1fa55b;
}

.map-legend__swatch--resolved {
    background: #6f7785;
}

.map-empty,
.map-error {
    position: absolute;
    inset: auto 1rem 1rem 1rem;
    z-index: 540;
    display: grid;
    gap: 0.35rem;
    padding: 1rem 1.05rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.84);
    box-shadow: var(--shadow-soft);
    max-width: min(92vw, 420px);
}

.map-empty[hidden],
.map-error[hidden] {
    display: none;
}

.map-error__retry {
    margin-top: 0.25rem;
    align-self: start;
}

.map-filters__clear {
    justify-self: start;
    border: 0;
    background: transparent;
    color: var(--color-primary-dark);
    font-weight: 800;
    padding: 0;
    text-decoration: underline;
    cursor: pointer;
}

.rescue-marker {
    background: transparent;
    border: 0;
}

.rescue-pin {
    --pin-color: #d84d4d;
    position: relative;
    width: 68px;
    height: 82px;
    display: grid;
    place-items: center;
    filter: drop-shadow(0 16px 18px rgba(24, 33, 28, 0.24));
}

.rescue-pin::before {
    content: '';
    position: absolute;
    inset: 10px 8px 8px 8px;
    border-radius: 20px 20px 24px 24px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.26), var(--pin-color));
    clip-path: polygon(50% 100%, 84% 75%, 84% 24%, 50% 0, 16% 24%, 16% 75%);
}

.rescue-pin::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    bottom: 2px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.18), var(--pin-color));
    transform: rotate(45deg);
    border-radius: 3px;
}

.rescue-pin__status,
.rescue-pin__type {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.24rem 0.45rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: #213028;
    font-size: 0.62rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.rescue-pin__status {
    transform: translateY(-8px);
}

.rescue-pin__type {
    transform: translateY(8px);
}

.rescue-pin__avatar {
    position: absolute;
    z-index: 1;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.98);
    display: grid;
    place-items: center;
    box-shadow: 0 10px 18px rgba(14, 18, 15, 0.2);
}

.rescue-pin__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rescue-pin__fallback {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: #1b2430;
    font-size: 0.95rem;
}

.rescue-pin.is-found {
    transform: translateY(-1px) scale(1.02);
}

.rescue-pin.is-resolved {
    opacity: 0.9;
}

.map-popup-container .leaflet-popup-content-wrapper,
.map-popup-container .leaflet-popup-tip {
    box-shadow: none;
}

.map-popup {
    width: min(92vw, 360px);
    overflow: hidden;
    border-radius: 24px;
    background: #fff;
    border: 1px solid rgba(31, 119, 91, 0.12);
}

.map-popup__media {
    position: relative;
    min-height: 140px;
    background: linear-gradient(135deg, rgba(31, 119, 91, 0.12), rgba(240, 138, 75, 0.12));
}

.map-popup__media img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
}

.map-popup__fallback {
    height: 160px;
    display: grid;
    place-items: center;
    color: #264236;
    font-size: 2rem;
}

.map-popup__badges {
    position: absolute;
    inset: auto 0 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.65rem;
}

.map-popup__badge {
    display: inline-flex;
    align-items: center;
    padding: 0.34rem 0.55rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.map-popup__badge--lost {
    color: #a53232;
}

.map-popup__badge--found {
    color: #1d8a4b;
}

.map-popup__badge--active {
    color: #2e3b31;
}

.map-popup__badge--resolved {
    color: #5f6774;
}

.map-popup__badge--approximate {
    color: #7a5d0c;
}

.map-popup__body {
    display: grid;
    gap: 0.5rem;
    padding: 0.9rem 0.95rem 1rem;
}

.map-popup__body h3 {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.2;
}

.map-popup__meta {
    color: var(--color-muted);
    font-size: 0.85rem;
    line-height: 1.45;
}

.map-popup__body p {
    margin: 0;
    color: #22312a;
    line-height: 1.55;
}

.map-popup__actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
    margin-top: 0.35rem;
}

.map-popup__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.72rem 0.7rem;
    border-radius: 14px;
    background: rgba(31, 119, 91, 0.08);
    color: var(--color-primary-dark);
    font-size: 0.8rem;
    font-weight: 800;
    line-height: 1.2;
    min-height: 42px;
}

.map-popup__button--primary {
    background: linear-gradient(135deg, var(--color-primary), #2ba46f);
    color: #fff;
}

.map-popup__button--ghost {
    background: rgba(240, 138, 75, 0.14);
    color: #9c5017;
}

.leaflet-popup-content {
    margin: 0 !important;
}

.leaflet-popup-content-wrapper {
    padding: 0 !important;
    border-radius: 24px !important;
}

.leaflet-container a {
    color: inherit;
}

@media (max-width: 1100px) {
    .map-layout {
        grid-template-columns: 1fr;
    }

    .map-filters {
        order: 0;
    }

    .map-stage {
        order: 1;
    }
}

@media (max-width: 900px) {
    .map-hero,
    .map-layout {
        width: min(calc(100% - 1rem), var(--layout-wide));
    }

    .map-filters {
        padding: 0.85rem;
        border-radius: 24px;
    }

    .map-filters__toggle {
        display: inline-flex;
    }

    .map-filters__body {
        display: grid;
        gap: 0.9rem;
    }

    .map-filters.is-collapsed .map-filters__body {
        display: none;
    }

    .map-stage__toolbar {
        padding: 0.9rem;
    }

    .map-stage__map-wrap,
    .map-stage__map {
        min-height: 70vh;
    }

    .map-stage__overlay {
        inset: 0.75rem auto auto 0.75rem;
        max-width: calc(100% - 1.5rem);
    }

    .map-stage__locate {
        right: 0.75rem;
        bottom: 0.75rem;
        width: 3.2rem;
        height: 3.2rem;
    }

    .map-stage__map-wrap .leaflet-bottom.leaflet-right .leaflet-control-zoom {
        margin-right: 0.75rem;
        margin-bottom: 4.5rem;
    }

    .map-stage__map-wrap .leaflet-control-zoom a {
        width: 2.5rem;
        height: 2.5rem;
        line-height: 2.5rem;
    }

    .map-popup__actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .map-hero__title {
        font-size: clamp(1.7rem, 9vw, 2.4rem);
    }

    .map-stage__toolbar {
        align-items: flex-start;
    }

    .map-stage__state {
        text-align: left;
    }

    .map-filter-grid--two {
        grid-template-columns: 1fr;
    }

    .map-popup {
        width: min(90vw, 340px);
    }
}

@media (max-width: 390px) {
    .map-hero,
    .map-layout {
        width: calc(100% - 1rem);
    }

    .map-stage__overlay {
        inset: 0.6rem auto auto 0.6rem;
        max-width: calc(100% - 1.2rem);
    }

    .map-stage__locate {
        right: 0.6rem;
        bottom: 0.6rem;
    }

    .map-popup {
        width: min(88vw, 320px);
    }

    .map-popup__body {
        padding: 0.8rem;
    }

    .map-popup__button {
        min-height: 44px;
        padding-inline: 0.6rem;
    }
}
