html,
body {
    height: 100%;
}

body {
    background: #eef7f8;
    overflow: hidden;
    color: #10233b;
}

.app-layout {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    flex: 0 0 auto;
    min-height: 68px;
    border-top: 3px solid #0b7faa;
    border-bottom: 1px solid #bcd5e6;
    background:
        linear-gradient(90deg, rgba(219, 246, 243, 0.96) 0%, rgba(255, 255, 255, 0.98) 34%, rgba(247, 249, 255, 0.98) 100%);
    box-shadow: 0 10px 28px rgba(14, 91, 122, 0.08);
    z-index: 30;
}

.header-inner {
    width: min(1500px, calc(100% - 32px));
    min-height: 68px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(210px, 1fr) minmax(280px, 2fr) minmax(210px, 1fr);
    align-items: center;
    gap: 1rem;
}

.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: #1e2b3a;
    text-decoration: none;
    font-weight: 800;
}

.brand-logo-wrap {
    width: 46px;
    height: 46px;
    display: inline-grid;
    place-items: center;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 10px 22px rgba(16, 92, 126, 0.13);
}

.brand-logo {
    width: 38px;
    height: 38px;
    object-fit: contain;
}

.brand-text {
    font-size: 1.05rem;
    letter-spacing: 0;
}

.brand-text span:nth-child(1) {
    color: #0c6f99;
}

.brand-text span:nth-child(2) {
    color: #f16a21;
}

.brand-text span:nth-child(3) {
    color: #202b3a;
}

.header-title {
    text-align: center;
    min-width: 0;
}

.header-title h1 {
    margin: 0;
    color: #075c82;
    font-size: 1.35rem;
    line-height: 1.15;
    font-weight: 800;
}

.header-title p {
    margin: 0.25rem 0 0;
    color: #687a91;
    font-size: 0.95rem;
}

.tools-dropdown {
    justify-self: end;
}

.tools-button {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.65rem 0.95rem;
    border: 1px solid #7ab8d8;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.86);
    color: #24364a;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(7, 92, 130, 0.08);
}

.tools-button:hover,
.tools-button:focus {
    border-color: #0b7faa;
    color: #075c82;
    background: #fff;
}

.tools-grid {
    width: 15px;
    height: 15px;
    display: inline-grid;
    grid-template-columns: repeat(3, 3px);
    grid-template-rows: repeat(3, 3px);
    gap: 3px;
}

.tools-grid::before,
.tools-grid::after {
    content: "";
}

.tools-grid,
.tools-grid::before,
.tools-grid::after {
    background:
        radial-gradient(circle, #375d7c 1.5px, transparent 1.6px) 0 0 / 6px 6px;
}

.dropdown-item.active,
.dropdown-item:active {
    background: #0b6f91;
}

.app-main {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    overflow: hidden;
}

.app-sidebar {
    width: 342px;
    max-width: 100%;
    flex: 0 0 342px;
    min-height: 0;
    height: 100%;
    background: rgba(249, 253, 253, 0.97);
    border-color: #c5dfed !important;
}

.app-sidebar-scroll {
    height: 100%;
    overflow-y: auto;
}

.app-map-panel {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    background: #d9edf2;
    overflow: hidden;
}

.card {
    border-color: #c7deed;
    border-radius: 8px;
}

.card.shadow-sm {
    box-shadow: 0 10px 24px rgba(17, 84, 112, 0.07) !important;
}

.card-body h1,
.card-body h2 {
    color: #071b31;
    font-weight: 800;
}

.form-label {
    color: #075c82;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.btn-primary {
    --bs-btn-bg: #0b6f91;
    --bs-btn-border-color: #0b6f91;
    --bs-btn-hover-bg: #075c82;
    --bs-btn-hover-border-color: #075c82;
}

.btn-success {
    --bs-btn-bg: #17a7a7;
    --bs-btn-border-color: #17a7a7;
    --bs-btn-hover-bg: #0f878a;
    --bs-btn-hover-border-color: #0f878a;
}

.map-stage {
    position: relative;
    height: 100%;
    min-height: 0;
}

.map-canvas {
    position: absolute;
    inset: 0;
}

.map-overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.55);
    z-index: 10;
}

.map-overlay.is-visible {
    display: flex;
}

.map-hover-tooltip {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 25;
    display: none;
    max-width: 240px;
    padding: 0.35rem 0.55rem;
    border-radius: 0.375rem;
    background: rgba(33, 37, 41, 0.92);
    color: #fff;
    font-size: 0.8rem;
    line-height: 1.2;
    pointer-events: none;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.map-hover-tooltip.is-visible {
    display: block;
}

.map-toast-host {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    z-index: 20;
    width: min(360px, calc(100% - 2rem));
}

.dropzone {
    border: 1px dashed #9acfe5;
    border-radius: 0.5rem;
    padding: 1.2rem;
    background: linear-gradient(180deg, #ffffff 0%, #f4fbfb 100%);
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.dropzone.is-dragover {
    border-color: #17a7a7;
    background: #eefafa;
}

.file-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.file-info-item {
    padding: 0.75rem;
    border: 1px solid #c7deed;
    border-radius: 0.5rem;
    background: #fff;
}

.file-info-label {
    display: block;
    font-size: 0.75rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.file-info-value {
    display: block;
    margin-top: 0.25rem;
    font-weight: 600;
    word-break: break-word;
}

.layer-list {
    display: grid;
    gap: 0.5rem;
}

.layer-item {
    border: 1px solid #c7deed;
    border-radius: 0.5rem;
    padding: 0.75rem;
    background: #fff;
}

.layer-item.active {
    border-color: #0b7faa;
    background: #f0fbfc;
}

.layer-item-name {
    font-weight: 600;
}

.layer-item-meta {
    color: #6c757d;
    margin-top: 0.25rem;
}

.toast {
    background: rgba(255, 255, 255, 0.96);
    color: #212529;
}

.maplibregl-ctrl-group {
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.15);
}

.maplibregl-ctrl.basemap-control {
    background: rgba(255, 255, 255, 0.96);
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.15);
    padding: 0.75rem 0.875rem;
    min-width: 140px;
}

.basemap-control-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

.basemap-control-options {
    display: grid;
    gap: 0.375rem;
}

.basemap-control-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
}

.map-popup .maplibregl-popup-content {
    padding: 0;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 0.4rem 1rem rgba(0, 0, 0, 0.18);
}

.map-popup .maplibregl-popup-close-button {
    padding: 0.35rem 0.5rem;
}

.feature-popup {
    min-width: 240px;
    max-width: 340px;
}

.feature-popup-header {
    padding: 0.75rem 0.9rem 0.55rem;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
}

.feature-popup-layer {
    font-size: 0.95rem;
    font-weight: 600;
    color: #212529;
}

.feature-popup-meta {
    margin-top: 0.2rem;
    font-size: 0.78rem;
    color: #6c757d;
}

.feature-popup-body {
    padding: 0.8rem 0.9rem;
}

.feature-popup-empty {
    color: #6c757d;
    font-size: 0.88rem;
}

.feature-popup-attrs {
    display: grid;
    gap: 0.55rem;
}

.feature-popup-row {
    display: grid;
    grid-template-columns: minmax(84px, 110px) minmax(0, 1fr);
    gap: 0.5rem;
    align-items: start;
}

.feature-popup-key {
    font-size: 0.78rem;
    font-weight: 600;
    color: #6c757d;
    word-break: break-word;
}

.feature-popup-value {
    font-size: 0.86rem;
    color: #212529;
    word-break: break-word;
}

.ts-wrapper.single .ts-control,
.ts-dropdown {
    border-radius: 0.375rem;
}

@media (max-width: 991.98px) {
    .app-main {
        flex-direction: column;
    }

    .header-inner {
        width: min(100% - 24px, 760px);
        grid-template-columns: 1fr auto;
        gap: 0.75rem;
        padding: 0.65rem 0;
    }

    .header-title {
        grid-column: 1 / -1;
        grid-row: 2;
        text-align: left;
    }

    .header-title h1 {
        font-size: 1.15rem;
    }

    .header-title p {
        font-size: 0.86rem;
    }

    .app-sidebar {
        width: 100%;
        flex-basis: auto;
        max-height: 45vh;
    }

    .file-info-grid {
        grid-template-columns: 1fr;
    }
}
