:root {
    --tpfund-primary: #009ddc;
    --tpfund-primary-strong: #007ab0;
    --tpfund-primary-soft: rgba(0, 157, 220, 0.12);
    --tpfund-text: #1f1f2b;
    --tpfund-muted: #6e6e7a;
    --tpfund-border: #e8e8ef;
    --tpfund-card: #ffffff;
    --tpfund-pill: #f2f3f8;
    --tpfund-shadow: 0 24px 60px rgba(18, 7, 60, 0.15);
    --tpfund-font: 'Poppins', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: light;
    }
}

.tpfund-em-wrapper {
    font-family: var(--tpfund-font);
    position: relative;
    padding: 24px;
    background: radial-gradient(circle at 20% 20%, rgba(228, 58, 25, 0.06), transparent 40%),
        radial-gradient(circle at 80% 10%, rgba(68, 86, 235, 0.08), transparent 45%),
        #f9f7f3;
    border-radius: 18px;
    overflow: visible; /* allow filter dropdown panels to extend beyond wrapper */
    border: 1px solid #f1ede6;
    width: 100%;
    background-color: #1c3c35;
}

/* ========================================
   MODERN TOOLBAR & FILTERS
   ======================================== */

.tpfund-em-toolbar {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
    /* Stacking context above the Leaflet map (Leaflet panes go up to 800). */
    position: relative;
    z-index: 1100;
}

/* Top row: search + view toggle + mobile filter btn */
.tpfund-em-toolbar-top {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Search box uses flexbox — icon + input + clear button always perfectly aligned,
   immune to theme overrides, native search-input UI and browser autofill. */
.tpfund-em-wrapper .tpfund-em-search {
    display: flex !important;
    align-items: center !important;
    flex: 1 1 280px;
    min-width: 0;
    height: 44px;
    padding: 0 8px 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    background: #ffffff !important;
    transition: border-color .15s ease, box-shadow .15s ease;
    box-sizing: border-box;
    overflow: hidden;
}

.tpfund-em-wrapper .tpfund-em-search:focus-within {
    border-color: var(--tpfund-primary);
    box-shadow: 0 0 0 3px rgba(0, 157, 220, 0.18);
}

.tpfund-em-wrapper .tpfund-em-search .search-icon {
    flex-shrink: 0;
    color: #8a93a3;
    pointer-events: none;
    display: block;
}

/* Reset all theme overrides + remove native search UI */
.tpfund-em-wrapper .tpfund-em-search input,
.tpfund-em-wrapper .tpfund-em-search input[type="search"] {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: auto !important;
    height: 42px !important;
    margin: 0 !important;
    padding: 0 8px !important;
    border: none !important;
    border-radius: 0 !important;
    outline: none !important;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    font-size: 14px !important;
    font-family: inherit !important;
    line-height: 1.2 !important;
    color: #1f1f2b !important;
    box-sizing: border-box !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    vertical-align: middle !important;
}

.tpfund-em-wrapper .tpfund-em-search input:focus {
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
    border: none !important;
}

.tpfund-em-wrapper .tpfund-em-search input::placeholder {
    color: #9aa1ad !important;
    opacity: 1 !important;
}

/* Hide native WebKit search clear/decoration UI (we have our own) */
.tpfund-em-wrapper .tpfund-em-search input::-webkit-search-cancel-button,
.tpfund-em-wrapper .tpfund-em-search input::-webkit-search-decoration,
.tpfund-em-wrapper .tpfund-em-search input::-webkit-search-results-button,
.tpfund-em-wrapper .tpfund-em-search input::-webkit-search-results-decoration {
    -webkit-appearance: none;
    display: none;
}

/* Override Chrome / Safari autofill yellow background */
.tpfund-em-wrapper .tpfund-em-search input:-webkit-autofill,
.tpfund-em-wrapper .tpfund-em-search input:-webkit-autofill:hover,
.tpfund-em-wrapper .tpfund-em-search input:-webkit-autofill:focus,
.tpfund-em-wrapper .tpfund-em-search input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
    -webkit-text-fill-color: #1f1f2b !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
    transition: background-color 9999s ease-in-out 0s;
}

.tpfund-em-wrapper .tpfund-em-search .search-clear {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: #eef0f4;
    color: #5b6271;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    transition: background .15s ease;
}

.tpfund-em-wrapper .tpfund-em-search .search-clear:hover {
    background: #dde1e8;
}

/* Mobile filter button */
.tpfund-em-mobile-filter-btn {
    display: none;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 16px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
    color: #1f1f2b;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, transform .1s ease;
    font-family: inherit;
    position: relative;
}

.tpfund-em-mobile-filter-btn:hover {
    background: #ffffff;
}

.tpfund-em-mobile-filter-btn:active {
    transform: scale(0.97);
}

.tpfund-em-mobile-filter-btn .filter-count {
    background: var(--tpfund-primary);
    color: #fff;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
}

/* View toggle (segmented control) */
.tpfund-em-view-toggle {
    display: inline-flex;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 4px;
    gap: 2px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.02);
}

.tpfund-em-view-toggle .tpfund-em-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: #5b6271;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
    font-family: inherit;
}

.tpfund-em-view-toggle .tpfund-em-tab:hover {
    color: var(--tpfund-primary-strong);
}

.tpfund-em-view-toggle .tpfund-em-tab.is-active {
    background: var(--tpfund-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 157, 220, 0.35);
}

/* Filter row */
.tpfund-em-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.tpfund-em-filter-group {
    flex: 1 1 180px;
    min-width: 160px;
    max-width: 240px;
    position: relative;
}

/* Project filter takes its own full row above the rest. */
.tpfund-em-filter-group[data-filter="project"] {
    flex: 0 0 100%;
    max-width: 100%;
    width: 100%;
    order: -1;
}
.tpfund-em-filter-group[data-filter="project"] .multi-panel {
    max-width: 100%;
}

.tpfund-em-filter-group .filter-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    padding: 0 4px;
}

/* === GLOBAL: HTML [hidden] attribute must always win over any display: rule. === */
.tpfund-em-wrapper [hidden],
.tpfund-em-drawer [hidden],
.tpfund-em-drawer-backdrop[hidden] {
    display: none !important;
}

/* === Multi-select filter pickers (Project / Category / Feature / City) === */
/* Hide the source <select multiple> elements regardless of theme overrides. */
.tpfund-em-source-select,
select.tpfund-em-source-select,
.tpfund-em-filters select[multiple],
.tpfund-em-drawer-body select[multiple] {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    position: absolute !important;
    left: -9999px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.tpfund-em-multi-filter {
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

/* Strong reset to beat theme button styles */
.tpfund-em-multi-filter .multi-trigger {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
    height: 40px !important;
    margin: 0 !important;
    padding: 0 14px !important;
    border: 1px solid #d8dce3 !important;
    border-radius: 10px !important;
    background: #ffffff !important;
    background-image: none !important;
    color: #1f1f2b !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    font-family: inherit !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    cursor: pointer !important;
    outline: none !important;
    box-shadow: none !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px;
    text-align: left;
    line-height: 1 !important;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.tpfund-em-multi-filter .multi-trigger:hover { border-color: rgba(0,157,220,0.5); }
.tpfund-em-multi-filter.is-open .multi-trigger,
.tpfund-em-multi-filter .multi-trigger:focus {
    border-color: var(--tpfund-primary);
    box-shadow: 0 0 0 3px rgba(0,157,220,0.18);
}
.tpfund-em-multi-filter .multi-trigger.has-selection {
    background: rgba(0,157,220,0.06);
    border-color: var(--tpfund-primary);
    color: var(--tpfund-primary-strong);
    font-weight: 600;
}
.tpfund-em-multi-filter .trigger-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tpfund-em-multi-filter .trigger-badge {
    flex-shrink: 0;
    background: var(--tpfund-primary);
    color: #fff;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    min-width: 20px;
    text-align: center;
}
.tpfund-em-multi-filter .trigger-caret {
    flex-shrink: 0;
    color: #5b6271;
    transition: transform .15s ease;
}
.tpfund-em-multi-filter.is-open .trigger-caret { transform: rotate(180deg); }

.tpfund-em-multi-filter .multi-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    min-width: 240px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 16px 50px rgba(0,0,0,0.18);
    z-index: 9999; /* must be above Leaflet map (panes go up to ~800) */
    display: flex;
    flex-direction: column;
    max-height: 360px;
    overflow: hidden;
}
/* CRITICAL: HTML hidden attribute must beat the display:flex above. */
.tpfund-em-multi-filter .multi-panel[hidden],
.tpfund-em-multi-filter .multi-panel.is-hidden {
    display: none !important;
}
.tpfund-em-multi-filter .multi-search-wrap {
    padding: 8px;
    border-bottom: 1px solid #eef0f4;
}
/* Icon and input as flex siblings — guaranteed perfectly centered. */
.tpfund-em-multi-filter .multi-search-input {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fafbfc;
    transition: border-color .15s ease, background .15s ease;
    box-sizing: border-box;
}
.tpfund-em-multi-filter .multi-search-input:focus-within {
    border-color: var(--tpfund-primary);
    background: #fff;
}
.tpfund-em-multi-filter .multi-search-icon {
    flex-shrink: 0;
    color: #9aa1ad;
    pointer-events: none;
    display: block;
}
.tpfund-em-multi-filter .multi-search {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: auto !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
    font-size: 13px !important;
    font-family: inherit !important;
    color: #1f1f2b !important;
    line-height: 1.2 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}
/* Hide native WebKit search clear/decoration UI */
.tpfund-em-multi-filter .multi-search::-webkit-search-cancel-button,
.tpfund-em-multi-filter .multi-search::-webkit-search-decoration {
    -webkit-appearance: none;
    display: none;
}
.tpfund-em-multi-filter .multi-options {
    flex: 1;
    overflow-y: auto;
    padding: 4px;
    -webkit-overflow-scrolling: touch;
}
.tpfund-em-multi-filter .multi-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    color: #1f1f2b;
    transition: background .1s ease;
}
.tpfund-em-multi-filter .multi-option:hover { background: #f3f5f9; }
.tpfund-em-multi-filter .multi-option.is-selected {
    background: rgba(0,157,220,0.08);
    font-weight: 600;
}
.tpfund-em-multi-filter .multi-option input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
    accent-color: var(--tpfund-primary);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
.tpfund-em-multi-filter .multi-option span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tpfund-em-multi-filter .multi-empty {
    padding: 18px 12px;
    text-align: center;
    color: #9aa1ad;
    font-size: 13px;
}
.tpfund-em-multi-filter .multi-actions {
    border-top: 1px solid #eef0f4;
    padding: 8px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    background: #fafbfc;
}
.tpfund-em-multi-filter .multi-actions button {
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s ease;
}
.tpfund-em-multi-filter .multi-clear {
    background: none;
    color: #5b6271;
}
.tpfund-em-multi-filter .multi-clear:hover { background: #eef0f4; }
.tpfund-em-multi-filter .multi-done {
    background: var(--tpfund-primary);
    color: #fff;
}
.tpfund-em-multi-filter .multi-done:hover { background: var(--tpfund-primary-strong); }

/* Mobile drawer adjustments — let panel grow inside drawer scroll area */
.tpfund-em-drawer-body .tpfund-em-multi-filter .multi-panel {
    max-height: 280px;
}

/* === Native single-select dropdown styles === */
.tpfund-em-filter-group select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 100%;
    box-sizing: border-box;
    height: 40px;
    padding: 0 36px 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 10px;
    background: #ffffff;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235b6271' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    color: #1f1f2b;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
    outline: none;
}

.tpfund-em-filter-group select:hover {
    border-color: rgba(0, 157, 220, 0.5);
}

.tpfund-em-filter-group select:focus {
    border-color: var(--tpfund-primary);
    box-shadow: 0 0 0 3px rgba(0, 157, 220, 0.18);
}

/* Active filter chips + counter */
.tpfund-em-active-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    min-height: 28px;
    flex-wrap: wrap;
}

.tpfund-em-active-row:has(.tpfund-em-chips:empty):not(:has(.tpfund-em-clear:not([hidden]))) {
    display: none;
}

.tpfund-em-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1 1 auto;
}

.tpfund-em-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px 5px 12px;
    background: rgba(255, 255, 255, 0.95);
    color: #1f1f2b;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    animation: tpfund-chip-in .18s ease;
}

@keyframes tpfund-chip-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.tpfund-em-chip .chip-label {
    color: #6e6e7a;
    margin-right: 2px;
    font-weight: 500;
}

.tpfund-em-chip .chip-remove {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: none;
    background: #eef0f4;
    color: #5b6271;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background .15s ease, color .15s ease;
}

.tpfund-em-chip .chip-remove:hover {
    background: #ff4d4d;
    color: #fff;
}

.tpfund-em-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.tpfund-em-count {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
}

.tpfund-em-count strong {
    color: #fff;
    font-weight: 700;
}

.tpfund-em-clear {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.95);
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s ease, border-color .15s ease;
}

.tpfund-em-clear:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.5);
}

/* ========================================
   MOBILE DRAWER
   ======================================== */

.tpfund-em-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 9998;
    opacity: 0;
    transition: opacity .25s ease;
}

.tpfund-em-drawer-backdrop.is-open {
    opacity: 1;
}

.tpfund-em-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 88vh;
    background: #fff;
    z-index: 9999;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25);
    transform: translateY(100%);
    transition: transform .3s cubic-bezier(.4, 0, .2, 1);
    display: flex;
    flex-direction: column;
    font-family: var(--tpfund-font);
}

.tpfund-em-drawer.is-open {
    transform: translateY(0);
}

.tpfund-em-drawer::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: #d8dce3;
    border-radius: 2px;
}

.tpfund-em-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 20px 12px;
    border-bottom: 1px solid #eef0f4;
}

.tpfund-em-drawer-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #1f1f2b;
}

.tpfund-em-drawer-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #f2f4f7;
    color: #5b6271;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tpfund-em-drawer-close:hover {
    background: #e6e9ee;
}

.tpfund-em-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px 20px;
    -webkit-overflow-scrolling: touch;
}

.tpfund-em-drawer-body .tpfund-em-filter-group {
    flex: none;
    max-width: none;
    margin-bottom: 16px;
}

.tpfund-em-drawer-body .tpfund-em-filter-group .filter-label {
    color: #5b6271;
    font-size: 12px;
}

.tpfund-em-drawer-body .tpfund-em-filter-group select {
    height: 46px;
    font-size: 15px;
    border-color: #e0e3ea;
}

.tpfund-em-drawer-footer {
    display: flex;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid #eef0f4;
    background: #fafbfc;
    border-radius: 0;
}

.tpfund-em-drawer-clear,
.tpfund-em-drawer-apply {
    flex: 1;
    height: 46px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all .15s ease;
}

.tpfund-em-drawer-clear {
    background: #f2f4f7;
    color: #5b6271;
    flex: 0 0 100px;
}

.tpfund-em-drawer-clear:hover {
    background: #e6e9ee;
}

.tpfund-em-drawer-apply {
    background: var(--tpfund-primary);
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 157, 220, 0.4);
}

.tpfund-em-drawer-apply:hover {
    background: var(--tpfund-primary-strong);
}

body.tpfund-em-drawer-open {
    overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
    .tpfund-em-drawer,
    .tpfund-em-drawer-backdrop,
    .tpfund-em-chip,
    .tpfund-em-progress .fill {
        transition: none !important;
        animation: none !important;
    }
}

.tpfund-em-map {
    width: 100%;
    height: 720px;
    border-radius: 12px;
    box-shadow: var(--tpfund-shadow);
    overflow: hidden;
}

.tpfund-em-empty {
    text-align: center;
    margin-top: 16px;
    color: var(--tpfund-muted);
}

/* Map markers */
.tpfund-em-marker {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: rgba(228, 58, 25, 0.12);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tpfund-em-marker .inner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(228, 58, 25, 0.28);
    position: absolute;
    top: 11px;
    left: 11px;
}

.tpfund-em-marker .dot {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #0c0c1a;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

.tpfund-em-marker .dot::after {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    border: 4px solid currentColor;
    opacity: 0.25;
}

.leaflet-popup-content-wrapper {
    border-radius: 12px !important;
    padding: 0 !important;
    overflow: visible !important;
    box-shadow: 0 22px 60px rgba(16, 9, 64, 0.25) !important;
    max-width: none !important;
}

.leaflet-popup-content {
    margin: 0 !important;
    color: var(--tpfund-text);
    min-width: 400px !important;
    max-width: none !important;
    width: auto !important;
}

.leaflet-popup {
    max-width: none !important;
}

.tpfund-em-popup-wrap .leaflet-popup-content {
    max-width: none !important;
    width: auto !important;
}

.tpfund-em-popup {
    padding: 16px 18px;
}

.tpfund-em-popup h3 {
    margin: 0 0 8px;
    font-size: 18px;
}

.tpfund-em-popup .meta-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 8px 0;
    color: var(--tpfund-muted);
    font-weight: 600;
}

.tpfund-em-popup .tag {
    background: var(--tpfund-pill);
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--tpfund-border);
}

.tpfund-em-popup .stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.tpfund-em-popup .stat {
    background: #faf9ff;
    border-radius: 12px;
    padding: 10px;
    border: 1px solid #ede7ff;
    font-weight: 600;
    color: #2a1b5a;
}

.tpfund-em-popup a {
    color: var(--tpfund-primary);
    font-weight: 600;
    text-decoration: none;
}

/* Cluster overrides */
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large {
    background: transparent;
    box-shadow: none;
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background: rgba(33, 37, 41, 0.06);
    color: #111427;
    border: 2px solid rgba(17, 20, 39, 0.2);
    border-radius: 50%;
    width: 52px;
    height: 52px;
    line-height: 48px;
    font-weight: 700;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.14);
}

/* ========================================
   RESPONSIVE BREAKPOINTS
   ======================================== */

/* Tablet & below */
@media (max-width: 1024px) {
    .tpfund-em-filter-group {
        flex: 1 1 calc(50% - 5px);
        max-width: none;
    }
}

/* Mobile: hide inline filters, show drawer trigger */
@media (max-width: 768px) {
    .tpfund-em-map {
        height: 520px;
    }

    .tpfund-em-toolbar {
        padding: 12px;
    }

    .tpfund-em-filters {
        display: none;
    }

    .tpfund-em-active-row {
        margin-top: 10px;
        padding-top: 10px;
    }

    .tpfund-em-mobile-filter-btn {
        display: inline-flex;
    }

    .tpfund-em-view-toggle .tpfund-em-tab span {
        display: none;
    }

    .tpfund-em-view-toggle .tpfund-em-tab {
        padding: 0 12px;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .tpfund-em-wrapper {
        padding: 14px;
    }

    .tpfund-em-toolbar-top {
        gap: 8px;
    }

    .tpfund-em-search {
        flex: 1 1 100%;
        order: -1;
    }

    .tpfund-em-search input {
        height: 42px;
    }

    .tpfund-em-mobile-filter-btn {
        flex: 1;
        justify-content: center;
    }

    .leaflet-popup-content {
        min-width: 260px !important;
    }

    .tpfund-em-meta {
        width: 100%;
        justify-content: space-between;
    }
}

/* Very small */
@media (max-width: 360px) {
    .tpfund-em-mobile-filter-btn span:not(.filter-count) {
        display: none;
    }
}

/* Popup styling */
.leaflet-popup-content-wrapper.tpfund-em-popup-wrap,
.leaflet-popup-content-wrapper.tpfund-em-popup-wrap .leaflet-popup-content-wrapper {
    border-radius: 18px;
    box-shadow: 0 22px 60px rgba(16, 9, 64, 0.25);
    padding: 0;
}

.leaflet-popup-content.tpfund-em-popup-wrap,
.tpfund-em-popup-wrap .leaflet-popup-content {
    margin: 0;
}

.tpfund-em-popup {
    padding: 16px 18px 14px;
    max-width: 420px;
    color: var(--tpfund-text);
}

.tpfund-em-popup h3 {
    margin: 0 0 6px;
    font-size: 18px;
}

.popup-header {
    display: flex;
    gap: 12px;
    align-items: center;
}

.popup-logo {
    flex: 0 0 70px;
    height: 70px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--tpfund-border);
    background: #f7f7fb;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.popup-titles {
    flex: 1;
}

.popup-desc {
    margin: 0;
    color: var(--tpfund-muted);
    line-height: 1.5;
    font-size: 14px;
}

.popup-tags,
.popup-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.chip {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    font-weight: 700;
    font-size: 14px;
    color: #241c3f;
}

.line-text {
    font-weight: 700;
    color: #241c3f;
    white-space: normal !important;
    word-wrap: break-word;
    overflow: visible !important;
    text-overflow: unset !important;
    max-width: none !important;
}


.popup-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.popup-gallery img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    border: none;
}

.popup-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    color: var(--tpfund-primary);
    font-weight: 700;
    text-decoration: none;
}

@media (max-width: 520px) {
    .popup-header {
        align-items: flex-start;
    }
    .popup-logo {
        flex: 0 0 56px;
        height: 56px;
    }
    .tpfund-em-popup {
        max-width: 320px;
    }
}

/* Redesigned popup card */
.tpfund-em-popup-card {
    background: #fff;
    border-radius: 12px;
    padding: 18px 20px;
    color: #1f1f2b;
    box-shadow: 0 22px 60px rgba(17, 9, 56, 0.2);
    min-width: 400px !important;
    max-width: none !important;
    width: auto !important;
    text-align: center;
}

.popup-top {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    text-align: center;
}

.popup-text {
    flex: 1;
    text-align: center;
    width: 100%;
}

.tpfund-em-popup-card h3 {
    margin: 0 0 6px;
    font-size: 20px;
    line-height: 1.3;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    word-wrap: break-word;
    max-width: none !important;
}

.popup-desc {
    margin: 0;
    color: #4b4b55;
    line-height: 1.5;
    font-size: 14px;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    word-wrap: break-word;
    max-width: none !important;
}

.popup-logo-box {
    width: 110px;
    height: 110px;
    border: 2px solid #c9b7f2;
    border-radius: 12px;
    background: #faf8ff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin: 0 auto;
}

.popup-logo-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.popup-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
    margin-top: 12px;
    text-align: center;
}

.popup-icon {
    font-size: 16px;
    line-height: 1;
}

.popup-line {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    text-align: center;
}

.popup-stats-col {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-top: 12px;
    justify-content: center;
    text-align: center;
}


.stat-line {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 6px 8px;
    font-weight: 600;
    color: #1f1f2b;
    font-size: 14px;
    white-space: normal !important;
    word-wrap: break-word;
    overflow: visible !important;
    text-overflow: unset !important;
    max-width: none !important;
    text-align: center;
}


.popup-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.popup-gallery.scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 6px;
}

.popup-gallery img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    border: none;
}

.popup-gallery.scroll img {
    flex: 0 0 110px;
}

.popup-link {
    color: var(--tpfund-primary);
    font-weight: 700;
    text-decoration: none;
}

.link-row {
    margin-top: 12px;
}



@media (max-width: 540px) {
    .tpfund-em-popup-card {
        max-width: 320px;
    }
    .popup-logo-box {
        flex: 0 0 80px;
        height: 80px;
    }
    .tpfund-em-popup-card h3 {
        font-size: 18px;
    }
}

/* List view cards (new view-toggle styles defined above) */

.tpfund-em-list {
    margin-top: 18px;
    display: none !important;
    gap: 16px;
}

.tpfund-em-list.is-active {
    display: grid !important;
}

.tpfund-em-list-card {
    display: grid;
    grid-template-columns: 1fr 180px;
    gap: 18px;
    padding: 16px 18px;
    border: 1px solid var(--tpfund-border);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(17, 9, 56, 0.06);
}

.tpfund-em-list-card h3 {
    margin: 0 0 6px;
    font-size: 18px;
}

.list-desc {
    margin: 0 0 10px;
    color: var(--tpfund-muted);
    line-height: 1.5;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    word-wrap: break-word;
    max-width: none !important;
}

.list-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-top: 10px;
}

.list-stats .stat-line {
    text-align: left;
    padding: 4px 0;
}

.list-row {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 8px;
    align-items: center;
    margin: 6px 0;
}

.list-icon {
    font-size: 16px;
}

.list-line {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-weight: 700;
    color: #1f1f2b;
}

.list-link {
    color: var(--tpfund-primary);
    font-weight: 700;
    text-decoration: none;
}

.list-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f7f7fb;
    border: 1px solid #ece9f7;
    border-radius: 12px;
    overflow: hidden;
}

.list-logo img {
    width: 100%;
    height: 120px;
    object-fit: contain;
}

@media (max-width: 820px) {
    .tpfund-em-list-card {
        grid-template-columns: 1fr;
    }
    .list-logo img {
        height: 100px;
    }
}



/* Feature items with icons */
.feature-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.feature-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    vertical-align: middle;
}

/* Turkey label on map */
.turkey-label {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Hide default Leaflet attribution prefix */
.leaflet-control-attribution {
    font-size: 11px;
    background: rgba(255, 255, 255, 0.8) !important;
    padding: 2px 8px !important;
}

/* Pagination styles */
.tpfund-em-pagination {
    display: none;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    padding: 16px 0;
}

.tpfund-em-pagination.is-visible {
    display: flex;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: 1px solid var(--tpfund-border);
    border-radius: 8px;
    background: #fff;
    color: var(--tpfund-text);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--tpfund-primary);
    color: #fff;
    border-color: var(--tpfund-primary);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-pages {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-page {
    min-width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--tpfund-border);
    border-radius: 8px;
    background: #fff;
    color: var(--tpfund-text);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination-page:hover:not(.is-active) {
    background: var(--tpfund-pill);
    border-color: var(--tpfund-primary);
}

.pagination-page.is-active {
    background: var(--tpfund-primary);
    color: #fff;
    border-color: var(--tpfund-primary);
}

.pagination-ellipsis {
    padding: 0 8px;
    color: var(--tpfund-muted);
    font-weight: 600;
}

@media (max-width: 640px) {
    .tpfund-em-pagination {
        flex-wrap: wrap;
        gap: 10px;
    }

    .pagination-btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .pagination-page {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
    }
}
