.mldt-network,
.mldt-network * {
    box-sizing: border-box;
}

.mldt-network {
    --mldt-blue: #20346f;
    --mldt-blue-dark: #172858;
    --mldt-cyan: #15a6b9;
    --mldt-red: #ff392d;
    --mldt-soft: #f4f6f9;
    --mldt-border: rgba(32, 52, 111, .10);
    display: grid;
    grid-template-columns: minmax(320px, 40%) minmax(0, 60%);
    width: 100%;
    aspect-ratio: 5 / 4;
    min-height: 0;
    overflow: hidden;
    border: 1px solid rgba(41, 169, 218, .72);
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 22px 60px rgba(24, 45, 83, .14);
    font-family: inherit;
}

.mldt-sidebar {
    position: relative;
    z-index: 500;
    min-width: 0;
    min-height: 0;
    height: 100%;
    padding: clamp(24px, 3vw, 42px) clamp(18px, 2.4vw, 32px) 30px;
    overflow-y: auto;
    background:
        radial-gradient(circle at 0 0, rgba(21, 166, 185, .07), transparent 28%),
        #fff;
    scrollbar-width: thin;
    scrollbar-color: rgba(32, 52, 111, .22) transparent;
}

.mldt-sidebar::-webkit-scrollbar { width: 6px; }
.mldt-sidebar::-webkit-scrollbar-thumb {
    border-radius: 99px;
    background: rgba(32, 52, 111, .22);
}

.mldt-heading-row {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 24px;
}

.mldt-heading {
    flex: 0 0 auto;
    margin: 0;
    color: var(--mldt-blue);
    font-size: clamp(22px, 2.1vw, 34px);
    line-height: 1.15;
    font-weight: 750;
    letter-spacing: -.025em;
}

.mldt-heading-line {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, rgba(32, 52, 111, .52), transparent);
}

.mldt-list {
    display: grid;
    gap: 12px;
}

.mldt-card {
    display: grid;
    grid-template-rows: auto auto;
    gap: 11px;
    width: 100%;
    padding: 17px 18px 18px;
    border: 1px solid transparent;
    border-radius: 17px;
    background: var(--mldt-soft);
    color: #5f6672;
    text-align: left;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
    transition: transform .2s ease, background .2s ease, color .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.mldt-card:hover {
    transform: translateY(-2px);
    border-color: rgba(32, 52, 111, .09);
    background: #fff;
    box-shadow: 0 10px 28px rgba(32, 52, 111, .12);
}

.mldt-card:focus-visible {
    outline: 3px solid rgba(21, 166, 185, .34);
    outline-offset: 2px;
}

.mldt-card-heading {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
}

.mldt-card-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #e1e4e8;
    color: #7b828b;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
}

.mldt-card-title {
    min-width: 0;
    color: inherit;
    font-size: clamp(15px, 1.35vw, 18px);
    line-height: 1.35;
    font-weight: 720;
}

.mldt-card-description {
    display: block;
    padding-left: 46px;
    color: #8a919b;
    font-size: 13.5px;
    line-height: 1.55;
}

.mldt-card.is-active {
    border-color: rgba(255,255,255,.10);
    background: linear-gradient(135deg, var(--mldt-blue), var(--mldt-blue-dark));
    color: #fff;
    box-shadow: 0 14px 34px rgba(32, 52, 111, .27);
}

.mldt-card.is-active .mldt-card-number {
    background: var(--mldt-red);
    color: #fff;
    box-shadow: 0 5px 14px rgba(255, 57, 45, .28);
}

.mldt-card.is-active .mldt-card-description {
    color: rgba(255, 255, 255, .80);
}

.mldt-map-column {
    position: relative;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    background: #dceef1;
}

.mldt-map {
    width: 100%;
    height: 100%;
    min-height: 0;
    background: #dceef1;
}

.mldt-legend {
    position: absolute;
    z-index: 450;
    left: 16px;
    bottom: 16px;
    display: grid;
    gap: 7px;
    min-width: 205px;
    padding: 13px 15px;
    border: 1px solid rgba(32, 52, 111, .08);
    border-radius: 12px;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 10px 28px rgba(22, 45, 70, .17);
    color: #666;
    font-size: 11px;
    backdrop-filter: blur(10px);
}

.mldt-legend strong { color: #38404b; font-size: 11px; }
.mldt-legend span { display: flex; align-items: center; gap: 8px; }
.mldt-dot { width: 10px; height: 10px; border-radius: 50%; }
.mldt-dot-primary { background: var(--mldt-red); }
.mldt-dot-secondary { background: var(--mldt-cyan); }

.mldt-leaflet-icon-wrap { background: transparent !important; border: 0 !important; }
.mldt-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 3px solid #fff;
    border-radius: 50%;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    box-shadow: 0 3px 12px rgba(0, 0, 0, .25);
    transition: transform .2s ease;
}
.mldt-marker-primary { background: var(--mldt-red); }
.mldt-marker-secondary { background: var(--mldt-cyan); }
.mldt-marker.is-active { transform: scale(1.28); }

.mldt-popup-shell .leaflet-popup-content-wrapper {
    padding: 0;
    overflow: hidden;
    border-radius: 14px;
    box-shadow: 0 14px 38px rgba(16, 38, 65, .28);
}
.mldt-popup-shell .leaflet-popup-content { width: 290px !important; margin: 0; }
.mldt-popup-shell .leaflet-popup-tip { box-shadow: none; }
.mldt-popup-card { position: relative; overflow: hidden; background: #fff; }
.mldt-popup-image { display: block; width: 100%; height: 185px; object-fit: cover; }
.mldt-popup-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 48px;
    display: grid;
    gap: 2px;
    padding: 36px 16px 12px;
    color: #fff;
    background: linear-gradient(transparent, rgba(0, 0, 0, .78));
}
.mldt-popup-overlay strong { font-size: 18px; }
.mldt-popup-subtitle { font-size: 12px; }
.mldt-popup-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    padding: 0 14px;
    color: #1193a5;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}
.mldt-popup-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #dff5f7;
    font-size: 17px;
}
.mldt-empty { padding: 16px; border-left: 4px solid #ff392d; background: #fff3f2; }

/* Tablet vẫn giữ nguyên khung tỷ lệ 5/4. */
@media (max-width: 1024px) and (min-width: 768px) {
    .mldt-network { grid-template-columns: minmax(280px, 42%) minmax(0, 58%); }
    .mldt-sidebar { padding: 24px 17px 22px; }
    .mldt-heading-row { margin-bottom: 18px; }
    .mldt-card { padding: 14px; gap: 8px; }
    .mldt-card-heading { grid-template-columns: 30px minmax(0, 1fr); gap: 9px; }
    .mldt-card-number { width: 30px; height: 30px; }
    .mldt-card-description { padding-left: 39px; font-size: 12.5px; line-height: 1.45; }
}

/* Mobile: bản đồ trên, danh sách đầy đủ ở dưới. */
@media (max-width: 767px) {
    .mldt-network {
        display: flex;
        flex-direction: column;
        aspect-ratio: auto;
        min-height: 0;
        overflow: visible;
        border-radius: 16px;
    }

    .mldt-map-column {
        order: 1;
        width: 100%;
        height: clamp(320px, 72vw, 480px);
        min-height: 320px;
        border-radius: 15px 15px 0 0;
    }

    .mldt-sidebar {
        order: 2;
        width: 100%;
        height: auto;
        max-height: none;
        overflow: visible;
        padding: 24px 15px 18px;
        border-radius: 0 0 15px 15px;
    }

    .mldt-heading-row { gap: 12px; margin-bottom: 18px; }
    .mldt-heading { font-size: 23px; }

    .mldt-list {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
        overflow: visible;
        padding: 0;
    }

    .mldt-card {
        width: 100%;
        padding: 15px;
        border-radius: 14px;
    }

    .mldt-card-title { font-size: 16px; }
    .mldt-card-description { padding-left: 46px; font-size: 13px; }

    .mldt-legend {
        left: 10px;
        bottom: 10px;
        min-width: 180px;
        padding: 10px 12px;
        transform: scale(.92);
        transform-origin: left bottom;
    }

    .mldt-popup-shell .leaflet-popup-content { width: 250px !important; }
    .mldt-popup-image { height: 150px; }
}
