*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', system-ui, -apple-system, Arial, sans-serif;
    color: #1e293b;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.brand-strip {
    height: 4px;
    background: linear-gradient(90deg, #1e40af, #2563eb);
    flex-shrink: 0;
}

.header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0 20px;
    height: 52px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.header-icon {
    width: 32px;
    height: 32px;
    background: #2563eb;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.header-icon svg {
    width: 17px;
    height: 17px;
    fill: #fff;
}

.header-title {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.01em;
}

.header-ref {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ref-label {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
}

.ref-value {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    background: #f1f5f9;
    padding: 3px 10px;
    border-radius: 20px;
}

.body-layout {
    flex: 1;
    display: flex;
    min-height: 0;
}

.sidebar {
    width: 320px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 14px 20px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.sidebar-header-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2563eb;
}

.sidebar-header-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #64748b;
}

.sidebar-header-count {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 10px;
}

.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.sidebar-scroll::-webkit-scrollbar {
    width: 4px;
}

.sidebar-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 2px;
}

.tl-empty {
    padding: 32px 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
}

.tl-item {
    display: flex;
    gap: 12px;
    padding: 12px 20px;
    position: relative;
    transition: background .12s;
}

.tl-item:hover {
    background: #fafbfc;
}

.tl-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 28px;
    top: 30px;
    bottom: 0;
    width: 2px;
    background: #f1f5f9;
}

.tl-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    padding-top: 2px;
}

.tl-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #2563eb;
    border: 2px solid #fff;
    outline: 2px solid #bfdbfe;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.tl-content {
    flex: 1;
    min-width: 0;
}

.tl-time {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
    margin-bottom: 3px;
}

.tl-title {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tl-type {
    font-size: 11.5px;
    color: #64748b;
    margin-top: 2px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.map-area {
    flex: 1;
    position: relative;
    min-width: 0;
}

.ol-attribution, .ol-attribution button { background: rgba(255,255,255,.88) !important; border: 1px solid #e2e8f0 !important; border-radius: 6px !important; box-shadow: 0 1px 4px rgba(0,0,0,.10) !important; font-family: 'Inter', system-ui, Arial, sans-serif !important; font-size: 11px !important; color: #475569 !important; padding: 4px 10px !important; }
.ol-attribution ul { margin: 0 !important; padding: 0 !important; }
.ol-attribution ul li { font-size: 11px !important; color: #475569 !important; }
.ol-attribution ul li a { color: #2563eb !important; }

.map-credit { position: absolute; bottom: 30px; right: 8px; z-index: 100; background: rgba(255,255,255,.88); border: 1px solid #e2e8f0; border-radius: 6px; padding: 4px 10px; display: flex; align-items: center; font-family: 'Inter', system-ui, Arial, sans-serif; font-size: 11px; font-weight: 600; color: #2563eb; text-decoration: none; box-shadow: 0 1px 4px rgba(0,0,0,.10); white-space: nowrap; transition: background .15s, box-shadow .15s; }
.map-credit:hover { background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.15); }

#map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.ol-popup {
    background: #fff;
    border-radius: 12px;
    min-width: 240px;
    max-width: 280px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .18), 0 2px 8px rgba(0, 0, 0, .08);
    font-size: 13px;
    font-family: 'Inter', system-ui, Arial, sans-serif;
    border: 1px solid #e2e8f0;
}

.ol-popup::after {
    content: "";
    position: absolute;
    bottom: -10px;
    left: 50%;
    margin-left: -10px;
    border-width: 10px 10px 0;
    border-style: solid;
    border-color: #fff transparent transparent;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .08));
}

.popup-header {
    background: linear-gradient(135deg, #1e40af, #2563eb);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 11px 11px 0 0;
}

.popup-header-icon {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, .15);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.popup-header-icon svg {
    width: 14px;
    height: 14px;
    fill: #fff;
}

.popup-header-title {
    font-weight: 700;
    font-size: 12.5px;
    color: #fff;
    letter-spacing: -0.01em;
}

.popup-body {
    padding: 12px 14px 14px;
}

.popup-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 5px;
}

.popup-row-label {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
}

.popup-row-value {
    font-size: 12px;
    color: #1e293b;
    font-weight: 500;
}

.popup-coords {
    font-size: 10.5px;
    color: #94a3b8;
    margin-top: 4px;
    margin-bottom: 2px;
    font-variant-numeric: tabular-nums;
}

.popup-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
    padding: 8px 14px;
    background: #f8fafc;
    color: #2563eb;
    text-decoration: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #e2e8f0;
    transition: background .15s, border-color .15s;
}

.popup-btn:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.bottom-filter {
    background: #fff;
    border-top: 1px solid #e2e8f0;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, .05);
}

.bf-section {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #94a3b8;
    padding-right: 4px;
    border-right: 1px solid #e2e8f0;
    margin-right: 4px;
}

.bf-label {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
}

.bf-input {
    font-family: 'Inter', system-ui, Arial, sans-serif;
    font-size: 12px;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 6px 10px;
    background: #fff;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    cursor: pointer;
    width: 192px;
}

.bf-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

.bf-sep {
    width: 1px;
    height: 20px;
    background: #e2e8f0;
}

.bf-apply {
    margin-left: 4px;
    padding: 7px 18px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    font-family: 'Inter', system-ui, Arial, sans-serif;
    cursor: pointer;
    transition: background .15s;
    white-space: nowrap;
}

.bf-apply:hover {
    background: #1d4ed8;
}

.filter-fab {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 20;
    width: 42px;
    height: 42px;
    background: #2563eb;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(37, 99, 235, .45);
    transition: background .15s;
}

.filter-fab:hover {
    background: #1d4ed8;
}

.filter-fab svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}

.filter-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .35);
    z-index: 40;
}

.filter-backdrop.open {
    display: block;
}

@media (max-width: 640px) {
    .map-credit { display: none; }

    .body-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: 180px;
        flex-shrink: 0;
        border-right: none;
        border-top: 1px solid #e2e8f0;
    }

    .map-area {
        flex: 1;
        min-height: 0;
    }

    .filter-fab {
        display: flex;
    }

    .bottom-filter {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 50;
        flex-wrap: wrap;
        row-gap: 10px;
        column-gap: 8px;
        padding: 20px 20px 32px;
        border-top: none;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, .15);
        transform: translateY(110%);
        transition: transform .28s cubic-bezier(.4, 0, .2, 1);
    }

    .bottom-filter.open {
        transform: translateY(0);
    }

    .bf-section {
        flex: 0 0 100%;
        font-size: 14px;
        font-weight: 700;
        color: #1e293b;
        border-right: none;
        padding: 0;
        margin: 0;
        text-transform: none;
        letter-spacing: 0;
    }

    .bf-sep {
        display: none;
    }

    .bf-input {
        flex: 1;
        width: auto;
        min-width: 110px;
    }

    .bf-apply {
        flex: 1 0 100%;
        margin-left: 0;
        padding: 12px;
        text-align: center;
    }

    .header {
        padding: 0 12px;
    }

    .ref-label {
        display: none;
    }
}
