html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

.pc-container,
.pc-content,
.page-header,
.card,
.card-body {
    min-width: 0;
}

.pc-content {
    max-width: 100%;
}

.loader-bg,
body.siget-page-ready .loader-bg {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

.pc-sidebar .m-header .b-brand {
    display: inline-flex;
    align-items: center;
    max-width: 210px;
}

.pc-sidebar .m-header .logo.logo-lg,
.pc-sidebar .m-header .b-brand img,
.navbar-brand.landing-logo img,
.auth-main .logo img,
.brand-logo {
    width: auto;
    max-width: 190px;
    max-height: 58px;
    object-fit: contain;
}

.pc-sidebar .m-header .logo.logo-sm {
    width: auto;
    max-width: 42px;
    max-height: 42px;
    object-fit: contain;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table-responsive table {
    min-width: 720px;
}

.form-control,
.form-select,
.select2-container,
textarea {
    max-width: 100%;
}

.page-header .row,
.card-header .row,
.modal-header,
.modal-footer {
    min-width: 0;
}

.leaflet-container {
    max-width: 100%;
}

.real-estate-map-wrap,
.rei-map-wrap,
.rei-preview-map,
.car-map-wrap,
.division-canvas,
.subdivision-canvas,
.field-gps-map,
#map,
#rei_map,
#rei_coordinate_map,
#car_map,
#division_map,
#subdivision_map,
#field_gps_map,
#field_gps_operator_map {
    min-width: 0;
}

.division-body,
.subdivision-workspace,
.car-map-layout,
.field-gps-layout,
.rural-flow,
.urban-flow,
.terrain-page {
    min-width: 0;
}

.division-side,
.division-side-card,
.subdivision-side,
.subdivision-panel,
.car-side,
.field-gps-panel,
.rural-stage,
.urban-stage {
    min-width: 0;
}

@media (max-width: 991.98px) {
    .pc-container {
        width: 100%;
        max-width: 100%;
    }

    .pc-content {
        padding-left: 14px;
        padding-right: 14px;
    }

    .page-header .row,
    .card-header .row {
        row-gap: 10px;
    }

    .card-header .col-auto {
        width: 100%;
    }

    .card-header .col-auto .btn {
        width: 100%;
    }

    .division-body,
    .subdivision-workspace,
    .car-map-layout,
    .field-gps-layout {
        grid-template-columns: 1fr !important;
    }

    .division-topbar,
    .subdivision-topbar,
    .car-topbar,
    .car-toolstrip {
        flex-wrap: wrap;
        height: auto !important;
        min-height: 56px;
        overflow-x: visible;
    }

    .division-title,
    .subdivision-name,
    .car-brand {
        min-width: 0 !important;
        width: 100%;
    }

    .division-toolbar,
    .division-segment,
    .division-export-grid,
    .subdivision-tools,
    .subdivision-actions,
    .car-actions,
    .car-tool-left,
    .car-tool-right,
    .car-drawing-actions,
    .car-point-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        width: 100%;
    }

    .division-btn,
    .division-tab,
    .subdivision-btn,
    .subdivision-tool,
    .subdivision-file,
    .subdivision-map-button,
    .car-tool,
    .car-actions .btn,
    .car-drawing-actions .btn {
        width: 100%;
        min-width: 0;
        justify-content: center;
        white-space: normal;
    }

    .car-workspace,
    .terrain-page {
        height: auto !important;
        min-height: 100vh;
    }

    .division-canvas,
    .subdivision-canvas,
    .car-map-wrap {
        min-height: 58vh !important;
    }

    #division_map,
    #subdivision_map,
    #car_map {
        min-height: 58vh !important;
    }

    .car-floating-status {
        position: static !important;
        width: auto !important;
        margin: 10px;
    }

    .terrain-content {
        max-width: none !important;
        padding-left: 12px;
        padding-right: 12px;
    }

    .terrain-tabs,
    .terrain-subtabs,
    .rural-stepbar,
    .urban-stepbar,
    .rural-choice-grid,
    .urban-choice-grid {
        grid-template-columns: 1fr !important;
    }

    .rural-stepbar,
    .urban-stepbar {
        display: grid !important;
        gap: 8px;
    }

    .rural-step-divider,
    .urban-step-divider {
        display: none !important;
    }
}

@media (max-width: 767.98px) {
    .pc-content {
        padding-left: 10px;
        padding-right: 10px;
    }

    .pc-sidebar .m-header .logo.logo-lg,
    .pc-sidebar .m-header .b-brand img,
    .navbar-brand.landing-logo img,
    .auth-main .logo img,
    .brand-logo {
        max-width: 165px;
        max-height: 50px;
    }

    .page-header {
        margin-bottom: 12px;
    }

    .page-header-title h5,
    .terrain-topbar h4,
    .urban-stage h3 {
        font-size: 22px !important;
        line-height: 1.25;
    }

    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }

    .modal-body {
        overflow-x: auto;
    }

    .division-shell,
    .subdivision-shell {
        font-size: 13px;
    }

    .division-body,
    .subdivision-body {
        padding: 10px !important;
    }

    .division-canvas,
    .subdivision-canvas,
    .car-map-wrap,
    .rei-preview-map,
    #division_map,
    #subdivision_map,
    #car_map,
    #rei_coordinate_map,
    #field_gps_operator_map {
        min-height: 62vh !important;
    }

    .rural-flow-top,
    .rural-flow-alert,
    .rural-stage,
    .urban-flow-top,
    .urban-flow-alert,
    .urban-stage,
    .terrain-card {
        padding-left: 14px !important;
        padding-right: 14px !important;
    }
}

@media (max-width: 767.98px) {
    body.real-estate-map-active .pc-content {
        padding: 0 !important;
    }

    body.real-estate-map-active .pc-container {
        min-height: 100svh;
    }

    .rei-map-shell {
        height: calc(100svh - 66px) !important;
        min-height: 620px;
        border-radius: 0 !important;
    }

    .rei-toolbar {
        left: 8px !important;
        right: 8px !important;
        top: 8px !important;
        display: grid !important;
        grid-template-columns: none !important;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
        align-items: end !important;
        gap: 8px !important;
        max-width: calc(100vw - 16px);
        padding: 8px !important;
        overflow: visible;
    }

    .rei-toolbar > * {
        min-width: 0;
        width: 100%;
    }

    .rei-toolbar .rei-brand {
        grid-column: 1 / -1;
        min-width: 0;
        width: 100%;
    }

    .rei-toolbar .rei-brand img {
        width: 58px !important;
        max-height: 24px !important;
    }

    .rei-search-wrap {
        grid-column: 1 / -1;
        min-width: 0 !important;
        width: 100% !important;
    }

    .rei-tool-group {
        grid-column: 1 / -1;
        min-width: 0 !important;
        width: 100%;
        display: grid !important;
        grid-template-columns: repeat(4, 38px);
        justify-content: center;
    }

    .rei-toolbar .form-label {
        font-size: 11px;
        margin-bottom: 3px !important;
        white-space: nowrap;
    }

    .rei-toolbar .form-control {
        height: 38px;
        font-size: 13px;
        min-width: 0;
        width: 100%;
    }

    .rei-search-wrap .form-control {
        padding-right: 46px !important;
        text-overflow: ellipsis;
    }

    .rei-left-tools {
        top: 224px !important;
        left: 8px !important;
        grid-auto-flow: column;
        grid-template-columns: none;
        max-width: calc(100vw - 16px);
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .rei-left-tools .rei-icon-btn,
    .rei-icon-btn {
        flex: 0 0 38px;
    }

    .rei-tool-label {
        display: none !important;
    }

    .rei-mode-chip {
        left: 8px !important;
        right: 8px;
        top: 272px !important;
        width: auto;
        max-width: calc(100vw - 16px);
        justify-content: center;
        white-space: normal;
        text-align: center;
    }

    .rei-panel,
    .rei-panel.compact {
        top: auto !important;
        left: 8px !important;
        right: 8px !important;
        bottom: 8px !important;
        width: auto !important;
        max-height: min(54svh, 520px) !important;
        border-radius: 8px !important;
    }

    .rei-panel-header {
        padding: 10px 12px !important;
    }

    .rei-panel-body {
        padding: 12px 12px 18px !important;
    }

    .rei-panel-actions {
        margin-left: -12px !important;
        margin-right: -12px !important;
        padding: 10px 12px 12px !important;
    }

    .rei-panel .row {
        margin-left: -6px;
        margin-right: -6px;
    }

    .rei-panel [class*="col-"] {
        padding-left: 6px;
        padding-right: 6px;
    }

    .rei-panel textarea.form-control {
        min-height: 72px;
    }

    .rei-results {
        left: 8px !important;
        right: 8px !important;
        bottom: 8px !important;
        width: auto !important;
        max-height: 42svh !important;
    }

    .rei-status {
        right: 8px !important;
        bottom: 8px !important;
        padding: 5px 8px !important;
        font-size: 11px;
    }

    .real-estate-map-active .leaflet-control-zoom {
        margin-top: 272px !important;
    }
}

@media (max-width: 480px) {
    .rei-map-shell {
        height: calc(100svh - 56px) !important;
    }

    .rei-toolbar {
        grid-template-columns: 1fr !important;
    }

    .rei-search-wrap {
        min-width: 0 !important;
    }

    .rei-panel,
    .rei-panel.compact {
        max-height: 50svh !important;
    }
}

.rei-mobile-filter-toggle {
    display: none;
}

@media (min-width: 768px) {
    .rei-map-shell .gm-style-mtc {
        margin-top: 104px !important;
    }

    .rei-left-tools {
        top: 156px !important;
    }

    .rei-mode-chip {
        top: 156px !important;
        left: 72px !important;
    }
}

@media (max-width: 767.98px) {
    .rei-mobile-filter-toggle {
        position: absolute;
        left: 8px;
        top: auto;
        bottom: 74px;
        z-index: 570;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        height: 38px;
        padding: 0 12px;
        border: 0;
        border-radius: 8px;
        background: #ffffff;
        color: #10284d;
        font-size: 13px;
        font-weight: 700;
        box-shadow: 0 8px 24px rgba(30, 41, 59, .18);
    }

    .rei-mobile-filter-toggle[aria-expanded="true"] {
        background: #20a88a;
        color: #ffffff;
    }

    .rei-map-shell .rei-toolbar {
        display: none !important;
    }

    .rei-map-shell.rei-toolbar-open .rei-toolbar {
        display: grid !important;
        top: auto !important;
        bottom: 122px !important;
        max-height: 48svh;
        overflow-y: auto;
    }

    .rei-map-shell:not(.rei-toolbar-open) .rei-left-tools {
        top: 56px !important;
    }

    .rei-map-shell:not(.rei-toolbar-open) .rei-mode-chip {
        top: 104px !important;
    }

    .rei-map-shell:not(.rei-toolbar-open) .leaflet-control-zoom {
        margin-top: 104px !important;
    }

    .rei-map-shell.rei-toolbar-open .rei-left-tools {
        top: 56px !important;
    }

    .rei-map-shell.rei-toolbar-open .rei-mode-chip {
        top: 104px !important;
    }

    .rei-map-shell.rei-toolbar-open .leaflet-control-zoom {
        margin-top: 104px !important;
    }
}
