html,
body {
    overflow: hidden !important;
}

.map-shell {
    position: fixed !important;
    top: 72px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    margin: 0 !important;
    padding: 0 !important;
}

.editor-map-card {
    position: absolute;
    inset: 0;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .12);
    box-shadow: 0 8px 32px rgba(0, 0, 0, .3);
}

#map {
    width: 100%;
    height: 100%;
}

/* Badge */
.map-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 5000;
    background: rgba(11, 18, 32, .85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: rgba(255, 255, 255, .92);
    border-radius: 12px;
    padding: 10px 30px 10px 13px;
    border: 1px solid rgba(255, 255, 255, .13);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .3);
    font-size: 12px;
    font-weight: 800;
    max-width: calc(100vw - 80px);
    min-width: 170px;
}

.map-badge .sub {
    display: block;
    font-size: 10px;
    color: rgba(255, 255, 255, .55);
    margin-top: 2px;
    font-weight: 600;
    line-height: 1.4;
}

.map-badge .sub.loading-pulse {
    animation: badgePulse 1.2s ease-in-out infinite alternate;
}

@keyframes badgePulse {
    from {
        opacity: 1;
    }

    to {
        opacity: .4;
    }
}

.map-badge .sub.loaded {
    color: #29d67d;
}

.map-badge .line {
    display: block;
    margin-top: 5px;
    font-size: 10px;
    color: rgba(255, 255, 255, .75);
    font-weight: 700;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    font-size: 10px;
    font-weight: 700;
    margin-bottom: 2px;
}

.stat-lbl {
    color: rgba(255, 255, 255, .50);
}

.stat-val {
    color: rgba(255, 255, 255, .90);
    font-weight: 800;
}

.stat-val.up {
    color: #29d67d;
}

.stat-val.down {
    color: #ff4d4d;
}

/* Popup */
.leaflet-popup-content-wrapper {
    border-radius: 18px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .35);
}

.leaflet-popup-content {
    margin: 0;
    width: auto !important;
}

.leaflet-popup-tip {
    background: #1e40af;
}

.popcard {
    width: min(290px, calc(100vw - 44px));
    font-family: 'Quicksand', sans-serif;
    color: #0f172a;
    overflow: hidden;
}

.pop-header {
    background: linear-gradient(135deg, #1e3a8a, #2563eb);
    padding: 12px 14px 10px;
    color: #fff;
}

.pop-header-name {
    font-size: 14px;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 5px;
}

.pop-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, .15);
    border-radius: 6px;
    padding: 2px 7px;
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, .90);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pop-body {
    padding: 11px 13px 6px;
    background: #fff;
}

.pop-ky-title {
    font-size: 10px;
    font-weight: 800;
    color: #1e40af;
    margin: 0 0 5px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.pop-ky-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    margin-bottom: 9px;
    table-layout: fixed;
}

.pop-ky-table thead tr {
    background: #eff6ff;
    color: #1e40af;
}

.pop-ky-table thead th {
    padding: 5px 3px;
    font-weight: 800;
    text-align: center;
    font-size: 10px;
    border-bottom: 2px solid #bfdbfe;
}

.pop-ky-table thead th:first-child {
    width: 30%;
    text-align: left;
    padding-left: 6px;
}

.pop-ky-table thead th:nth-child(2),
.pop-ky-table thead th:nth-child(3) {
    width: 17%;
}

.pop-ky-table thead th:nth-child(4) {
    width: 20%;
}

.pop-ky-table thead th:last-child {
    width: 16%;
}

.pop-ky-table tbody tr:nth-child(odd) {
    background: #f8fafc;
}

.pop-ky-table tbody tr:nth-child(even) {
    background: #fff;
}

.pop-ky-table td {
    padding: 5px 3px;
    text-align: center;
    color: #475569;
    font-weight: 700;
    border-bottom: 1px solid #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pop-ky-table td.ky-label {
    font-weight: 800;
    color: #1e293b;
    text-align: left;
    padding-left: 6px;
}

.pop-ky-table td.tt-val {
    color: #15803d;
    font-weight: 800;
}

.pop-ky-table td.tt-zero {
    color: #cbd5e1;
}

.pct-up {
    color: #15803d;
    font-weight: 800;
}

.pct-down {
    color: #dc2626;
    font-weight: 800;
}

.pop-tt-none {
    font-size: 11px;
    color: #94a3b8;
    font-style: italic;
    padding: 2px 0 8px;
}

.pop-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px 8px;
    padding: 7px 0 6px;
    border-top: 1px solid #f1f5f9;
}

.pop-info-item {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.pop-info-item.full {
    grid-column: 1 / -1;
}

.pop-info-lbl {
    font-size: 9px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.pop-info-val {
    font-size: 11px;
    font-weight: 800;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Zone panel */
.zone-panel {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: rgba(11, 18, 32, .90);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #fff;
    border-radius: 14px;
    padding: 12px 18px;
    border: 1px solid rgba(255, 255, 255, .15);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
    font-family: 'Quicksand', sans-serif;
    font-size: 12px;
    font-weight: 700;
    min-width: 260px;
    max-width: calc(100vw - 40px);
    display: none;
}

.zone-panel.active {
    display: block;
}

.zone-panel-title {
    font-size: 11px;
    font-weight: 800;
    color: rgba(255, 255, 255, .55);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 8px;
}

.zone-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 12px;
    margin-bottom: 8px;
}

.zone-stat {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.zone-stat-lbl {
    font-size: 9px;
    color: rgba(255, 255, 255, .45);
    text-transform: uppercase;
    letter-spacing: .4px;
}

.zone-stat-val {
    font-size: 16px;
    font-weight: 800;
    color: #fff;
}

.zone-stat-val.green {
    color: #29d67d;
}

.zone-stat-val.yellow {
    color: #fde047;
}

.zone-stat-val.red {
    color: #ff4d4d;
}

.zone-ky-rows {
    border-top: 1px solid rgba(255, 255, 255, .12);
    padding-top: 8px;
}

.zone-ky-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 11px;
}

.zone-ky-lbl {
    color: rgba(255, 255, 255, .6);
}

.zone-ky-val {
    font-weight: 800;
    color: rgba(255, 255, 255, .9);
}

.zone-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, .5);
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    line-height: 1;
}

.zone-close:hover {
    background: rgba(255, 255, 255, .1);
    color: #fff;
}

/* Search */
.search-btn {
    position: absolute;
    top: 12px;
    left: 10px;
    z-index: 1000;
    width: 55px;
    height: 55px;
    border-radius: 10px;
    background: rgba(22, 19, 19, 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, .14);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .22);
    color: #1e40af;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
}

.search-btn:hover {
    background-color: rgba(255, 255, 255, 0.98);
    border-color: rgba(37, 99, 235, .35);
    transform: translateY(-1px);
}

.search-btn.active {
    background-color: rgba(37, 99, 235, 0.95);
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
}

.search-panel {
    position: absolute;
    top: 8px;
    left: 72px;
    z-index: 1001;
    width: min(340px, calc(100vw - 70px));
    background: rgba(11, 18, 32, .95);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, .15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, .45);
    font-family: 'Quicksand', sans-serif;
    overflow: hidden;
    display: none;
}

.search-panel.open {
    display: block;
}

.search-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.search-input {
    flex: 1;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 8px;
    color: #fff;
    font-family: 'Quicksand', sans-serif;
    font-size: 13px;
    font-weight: 700;
    padding: 7px 11px;
    outline: none;
    transition: border-color .15s;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, .35);
    font-weight: 600;
}

.search-input:focus {
    border-color: rgba(37, 99, 235, .7);
}

.search-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, .45);
    font-size: 18px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 6px;
    line-height: 1;
}

.search-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, .1);
}

.search-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 12px 0;
}

.search-tab {
    flex: 1;
    padding: 5px 4px;
    background: none;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 8px;
    color: rgba(255, 255, 255, .5);
    font-family: 'Quicksand', sans-serif;
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
    text-align: center;
    transition: .15s;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.search-tab.active {
    background: rgba(37, 99, 235, .35);
    border-color: rgba(37, 99, 235, .6);
    color: #fff;
}

.search-results {
    max-height: 320px;
    overflow-y: auto;
    padding: 6px 0;
}

.search-results::-webkit-scrollbar {
    width: 4px;
}

.search-results::-webkit-scrollbar-track {
    background: transparent;
}

.search-results::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .15);
    border-radius: 4px;
}

.search-empty {
    padding: 20px;
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, .35);
    font-weight: 600;
}

.search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, .05);
    transition: background .12s;
}

.search-item:hover {
    background: rgba(37, 99, 235, .2);
}

.search-item:last-child {
    border-bottom: none;
}

.search-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1.5px solid rgba(255, 255, 255, .3);
}

.search-info {
    flex: 1;
    min-width: 0;
}

.search-name {
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-meta {
    font-size: 10px;
    color: rgba(255, 255, 255, .45);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.search-tt {
    font-size: 11px;
    font-weight: 800;
    color: #29d67d;
    flex-shrink: 0;
    text-align: right;
}

.search-tt.warn {
    color: #ff4d4d;
}

.search-tt.neutral {
    color: rgba(255, 255, 255, .4);
}

.search-count {
    padding: 6px 14px 8px;
    font-size: 10px;
    color: rgba(255, 255, 255, .35);
    font-weight: 700;
    border-top: 1px solid rgba(255, 255, 255, .07);
    text-align: right;
}

/* Locate button */
.locate-btn {
    position: absolute;
    bottom: 24px;
    right: 12px;
    z-index: 1000;
    width: 50px;
    height: 50px;
    border-radius: 10px;
    background: rgba(11, 18, 32, .88);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, .15);
    color: rgba(255, 255, 255, .9);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
    transition: background .15s, border-color .15s;
}

.locate-btn:hover {
    background: rgba(37, 99, 235, .7);
}

.locate-btn.active {
    background: rgba(37, 99, 235, .8);
    border-color: rgba(37, 99, 235, .9);
}

.locate-btn.loading {
    animation: locatePulse .8s ease-in-out infinite alternate;
}

@keyframes locatePulse {
    from {
        opacity: 1;
    }

    to {
        opacity: .45;
    }
}

.user-location-marker {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #2563eb;
    border: 3px solid #fff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .3), 0 2px 8px rgba(0, 0, 0, .4);
    animation: userPulse 2s ease-out infinite;
}

@keyframes userPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, .5), 0 2px 8px rgba(0, 0, 0, .4);
    }

    70% {
        box-shadow: 0 0 0 12px rgba(37, 99, 235, 0), 0 2px 8px rgba(0, 0, 0, .4);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0), 0 2px 8px rgba(0, 0, 0, .4);
    }
}

/* =========================
DRAW TOOLBAR - FIX FULL
========================= */
.leaflet-control-container .leaflet-top,
.leaflet-control-container .leaflet-bottom {
    z-index: 9000;
}

.leaflet-draw.leaflet-control {
    z-index: 15000 !important;
}

.leaflet-bar.leaflet-draw-toolbar,
.leaflet-draw-toolbar {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

.leaflet-draw-toolbar a {
    position: relative;
    background-image: none !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 36px !important;
    height: 36px !important;
    margin: 0 0 8px 0 !important;
    border-radius: 10px !important;
    border: 1px solid rgba(255, 255, 255, .14) !important;
    background: rgba(255, 255, 255, 0.88) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .22) !important;
    color: #0f172a !important;
    transition: transform .15s ease, background-color .15s ease, border-color .15s ease !important;
}

.leaflet-draw-toolbar a:last-child {
    margin-bottom: 0 !important;
}

.leaflet-draw-toolbar a:hover {
    background: rgba(255, 255, 255, 0.98) !important;
    border-color: rgba(37, 99, 235, .35) !important;
    transform: translateY(-1px);
}

.leaflet-draw-toolbar a.leaflet-disabled {
    opacity: .45 !important;
    cursor: not-allowed !important;
}

.leaflet-draw-toolbar a::before {
    display: block;
    line-height: 1;
}

.leaflet-draw-draw-polygon::before {
    content: "⬢";
    font-size: 24px;
    color: #06b6d4;
}

.leaflet-draw-draw-rectangle::before {
    content: "■";
    font-size: 18px;
    color: #111827;
}

.leaflet-draw-edit-edit::before {
    content: "✏️";
    font-size: 14px;
}

.leaflet-draw-edit-remove::before {
    content: "🗑️";
    font-size: 14px;
}

.leaflet-draw-actions {
    z-index: 16000 !important;
    margin-left: 8px !important;
}

.leaflet-draw-actions ul {
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.leaflet-draw-actions li {
    list-style: none !important;
}

.leaflet-draw-actions a {
    display: block !important;
    height: auto !important;
    line-height: 1.2 !important;
    padding: 9px 14px !important;
    background: rgba(15, 23, 42, 0.96) !important;
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, .14) !important;
    border-right: none !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4) !important;
    font-family: 'Quicksand', sans-serif !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    white-space: nowrap !important;
}

.leaflet-draw-actions li:first-child a {
    border-radius: 10px 0 0 10px !important;
}

.leaflet-draw-actions li:last-child a {
    border-right: 1px solid rgba(255, 255, 255, .14) !important;
    border-radius: 0 10px 10px 0 !important;
}

.leaflet-draw-actions a:hover {
    background: #2563eb !important;
    color: #fff !important;
}

.leaflet-draw-tooltip {
    background: rgba(15, 23, 42, .95) !important;
    border: 1px solid rgba(255, 255, 255, .12) !important;
    border-radius: 10px !important;
    color: #fff !important;
    box-shadow: 0 8px 18px rgba(0, 0, 0, .35) !important;
    font-family: 'Quicksand', sans-serif !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    padding: 8px 10px !important;
}

.leaflet-draw-tooltip:before {
    border-right-color: rgba(15, 23, 42, .95) !important;
}

.leaflet-edit-marker-selected {
    border: 2px solid #2563eb !important;
}

/* Cluster */
.customer-dot {
    border-radius: 50%;
}

.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background: rgba(37, 99, 235, .15);
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    font-weight: 800;
    font-size: 12px;
}

.leaflet-control-attribution {
    font-size: 10px;
}



@media (max-width: 400px) {
    .map-badge {
        display: none;
    }

    .leaflet-draw-actions a {
        padding: 9px 10px !important;
        font-size: 10px !important;
    }
}

#closeBadge {
    transition: all 0.2s ease;
    border-radius: 4px;
}

#closeBadge:hover {
    background: rgba(255, 255, 255, 0.1);
}
/* ── TOPBAR ───────────────────────────────── */
#mainTopbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 10px 22px;
    background: linear-gradient(180deg, #0f1a33 0%, #0a1428 100%);
    border-bottom: 1px solid rgba(77, 160, 255, .18);
    box-shadow: 0 4px 20px rgba(0, 0, 0, .4);
    font-family: Quicksand, sans-serif;
}

/* Brand bên trái */
.tb-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}
.tb-logo {
    height: 44px;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(77, 160, 255, .3));
}
.tb-title-wrap { min-width: 0; }
.tb-title {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: .5px;
    color: #fff;
    white-space: nowrap;
    text-shadow: 0 0 14px rgba(77, 160, 255, .4);
}
.tb-subtitle {
    font-size: 12px;
    color: rgba(180, 200, 230, .6);
    margin-top: 2px;
    font-weight: 500;
}

/* Nav */
.tb-nav {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Button */
.tb-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 74px;
    padding: 8px 10px 7px;
    border-radius: 14px;
    text-decoration: none;
    background: rgba(20, 32, 58, .55);
    border: 1px solid rgba(77, 160, 255, .12);
    color: rgba(180, 200, 230, .75);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .2px;
    transition: all .2s ease;
    cursor: pointer;
}
.tb-btn:hover {
    background: rgba(40, 70, 120, .5);
    border-color: rgba(77, 160, 255, .35);
    color: #e6f0ff;
    transform: translateY(-1px);
}

/* Icon bubble bên trong */
.tb-btn-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(77, 160, 255, .08);
    color: #6aa4ff;
    transition: all .2s ease;
}
.tb-btn-icon svg {
    width: 20px;
    height: 20px;
}
.tb-btn:hover .tb-btn-icon {
    background: rgba(77, 160, 255, .18);
    color: #9ac4ff;
}

.tb-btn-lbl {
    line-height: 1;
    margin-top: 1px;
}

/* Active */
.tb-btn.active {
    background: linear-gradient(180deg, #2b5fd9 0%, #1e47b8 100%);
    border-color: rgba(120, 180, 255, .6);
    color: #fff;
    box-shadow:
        0 0 0 1px rgba(120, 180, 255, .25) inset,
        0 4px 16px rgba(43, 95, 217, .45),
        0 0 20px rgba(77, 160, 255, .35);
}
.tb-btn.active .tb-btn-icon {
    background: rgba(255, 255, 255, .18);
    color: #fff;
}

/* Responsive: màn hẹp → icon nhỏ lại, giấu label phụ */
@media (max-width: 900px) {
    .tb-subtitle { display: none; }
    .tb-title { font-size: 15px; }
    .tb-btn { min-width: 62px; padding: 6px 8px; }
    .tb-btn-icon { width: 28px; height: 28px; }
    .tb-btn-icon svg { width: 17px; height: 17px; }
    .tb-btn-lbl { font-size: 10px; }
}
@media (max-width: 600px) {
    #mainTopbar { padding: 8px 12px; gap: 10px; }
    .tb-logo { height: 34px; }
    .tb-title { font-size: 13px; }
    .tb-nav { gap: 6px; }
    .tb-btn-lbl { display: none; }
    .tb-btn { min-width: 42px; padding: 6px; }
}
/* ── FIX: map fill đúng phần dưới topbar, không có overlay ─── */

/* Loại bỏ padding body/container đẩy map vào khung */
body.has-map,
html.has-map,
html.has-map body {
  overflow: hidden;
}

/* Nếu header.php có <main class="container"> — trên trang map nó không cần */
.page-maptt .container,
body .container:has(.map-shell) {
  padding: 0 !important;
  margin: 0 !important;
}



.editor-map-card {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  border-radius: 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: hidden;
}

/* Map phải phủ đầy + không bị lớp overlay xanh */
#map {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: #e8edf2 !important; /* màu tile Leaflet mặc định */
}

/* Leaflet pane phải sạch, không bị gradient body thấm qua */
.leaflet-container {
  background: #e8edf2 !important;
}

/* Badge / nút trong map — đưa vào trong khung */
.map-badge    { top: 14px !important; right: 14px !important; z-index: 400; }
.search-btn   { top: 14px !important; left: 14px !important;  z-index: 400; }
.search-panel { top: 14px !important; z-index: 500; }
.locate-btn   { z-index: 400; }

@media (max-width: 760px) {
  .map-shell {
    top: var(--headerH, 64px);
    bottom: 0;
  }
  .map-badge    { top: 6px !important; right: 14px !important; z-index: 400; }

}

.home-btn {
    position: absolute;
    bottom: 16px;
    left: 12px;
    z-index: 1000;
    width: 55px;
    height: 55px;
    border-radius: 10px;
    background: rgba(11, 18, 32, .88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, .15);
    color: rgba(255, 255, 255, .95);
    font-size: 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
    transition: background .15s, border-color .15s, transform .15s;
}

.home-btn:hover {
    background: rgba(37, 99, 235, .7);
    border-color: rgba(37, 99, 235, .9);
    transform: translateY(-1px);
}
@media (min-width: 760px) {
  .home-btn {
    display: none;
  }
}
@media (max-width: 760px) {
  .topbar {
    display: none !important;
  }

  .map-shell {
    top: 0 !important;
  }
}
/* Mobile */
@media (max-width: 760px) {
    .map-shell {
        top: 0 !important;
        bottom: 0 !important;
    }

    .search-btn {
        top: 8px !important;
        left: 8px !important;
        width: 44px;
        height: 44px;
        font-size: 18px;
        border-radius: 12px;
    }

    .search-panel {
        top: 8px;
        left: 8px;
        width: calc(100vw - 16px);
        z-index: 20000;
    }

    .leaflet-top.leaflet-left {
        top: 60px !important;
        left: 8px !important;
    }

    .leaflet-top.leaflet-left .leaflet-control {
        margin: 0 !important;
    }

    .leaflet-draw-toolbar a {
        width: 44px !important;
        height: 44px !important;
        border-radius: 12px !important;
        margin-bottom: 10px !important;
    }

    .leaflet-draw-draw-polygon::before {
        font-size: 26px;
    }

    .leaflet-draw-draw-rectangle::before {
        font-size: 19px;
    }

    .leaflet-draw-actions {
        margin-left: 8px !important;
        margin-top: 0 !important;
    }

    .leaflet-draw-actions a {
        padding: 10px 12px !important;
        font-size: 11px !important;
    }

    .locate-btn {
        bottom: calc(20px + env(safe-area-inset-bottom, 0px));
        right: 10px;
        width: 55px;
        height: 55px;
        font-size: 18px;
    }
}