.sheet.actor.loot form {
    .price {
        &.cheap {
            color: #0d5c10;
            text-shadow: 0 0 1px #56d167;
        }

        &.expensive {
            color: #7e1a1a;
            text-shadow: 0 0 1px #c77a7a;
        }
    }

    section.sheet-sidebar {
        .better-merchant {
            > div {
                margin-bottom: 0.3em;
            }

            .form-group {
                padding-inline: 0.2em;
            }

            label {
                white-space: nowrap;
                margin-left: 0.2em;
            }

            input[type="checkbox"] {
                margin: 0;
            }

            .services-ratio {
                flex: 0 0 5ch;
                text-align: right;
            }
        }
    }

    section.content .inventory .inventory-list {
        .services {
            a.disabled {
                opacity: 0.3;
            }

            .item-controls {
                &.large {
                    flex-basis: 6rem;
                }

                &:not(.large) {
                    flex-basis: 2rem;
                    justify-content: center;
                }
            }

            &.items {
                > li {
                    min-height: 24px;

                    .toggle-enabled {
                        font-size: var(--font-size-15);
                    }
                }
            }
        }
    }
}

#compendium-browser.toolbelt-merchant {
    .window-header {
        .header-button {
            margin-right: 2em;
            line-height: 1.4;
            width: fit-content;
        }
    }
}

.application.pf2e-toolbelt-better-merchant-filters {
    min-width: 600px;
    min-height: 500px;
    max-height: 80%;

    .filters {
        flex: 1;
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        gap: 1em;

        > hr {
            width: 0;
            border: none;
            height: 100%;
            margin: 0;
            border-right: 1px solid var(--color-border);
        }

        h3 {
            display: flex;
            justify-content: space-between;
            margin-bottom: 0.5em;
            font-size: 1.6em;

            i {
                font-size: 0.9em;
            }
        }

        .filter {
            white-space: nowrap;
            display: flex;
            flex-direction: column;
            gap: 0.5em;
            margin-bottom: 1em;
            border-color: var(--color-fieldset-border);
            border-radius: 8px;
            padding: 0.4em 0.5em;

            label {
                display: flex;
                flex-wrap: nowrap;
                align-items: center;
                gap: 0.3em;
            }

            input {
                &[type="text"],
                &[type="number"] {
                    height: 1.6em;
                }

                &[type="checkbox"] {
                    margin: 0;
                }

                &[name="ratio"] {
                    text-align: right;
                }

                &[name="purse"] {
                    width: 8ch;
                    text-align: end;
                }
            }

            .group {
                display: flex;
                gap: 1em;
                justify-content: space-between;
            }

            .treasure {
                font-size: 1.2em;
            }

            .controls {
                display: flex;
                flex-wrap: nowrap;
                align-items: center;
                gap: 0.6em;

                span {
                    color: var(--color-disabled);
                }

                .carets {
                    font-size: 1.5em;
                    display: flex;
                    flex-wrap: nowrap;
                    align-items: center;
                    gap: 0.3em;
                    margin-right: 0.1em;
                }
            }
        }
    }
}

.application.pf2e-toolbelt-better-merchant-browserPull {
    max-height: 80%;

    .window-content {
        display: flex;
        flex-direction: column;
        gap: 1em;
        padding-inline: 0;
        padding-top: 0.5em;

        .header {
            display: grid;
            grid-template-columns: auto auto auto;
            align-items: center;
            justify-content: end;
            gap: 2em;
            padding-inline: 1em 2em;
            padding-bottom: 0.5em;
            border-bottom: 1px solid var(--color-border);

            > div {
                display: flex;
                align-items: center;
                gap: 0.3em;
            }
        }

        .items {
            list-style: none;
            padding: 0;
            margin: 0;
            padding-inline: 1em;
            overflow-y: auto;

            .item {
                display: grid;
                grid-template-columns: 2.4em 1fr 9em 5em 1.5em 2.4em;
                align-items: center;
                justify-items: center;
                gap: 0.25rem;
                margin: 0;
                padding-left: 0.4em;
                padding-inline: 0.2em;

                &:nth-child(odd) {
                    background-color: var(--color-dark-2);
                }

                &:hover {
                    background-color: rgba(255, 255, 255, 0.25);
                }

                img {
                    height: 2.286em;
                }

                .name {
                    justify-self: start;
                }

                .tags,
                .price,
                .level {
                    height: 100%;
                    width: 100%;
                    display: flex;
                    align-items: center;
                }

                .price {
                    justify-content: end;
                    margin-right: 0.65em;
                }

                .tags,
                .level {
                    justify-content: center;
                }

                .owned {
                    font-size: 1.3em;
                    margin-right: 0.1em;
                }
            }
        }
    }
}

.application.pf2e-toolbelt-better-merchant-service {
    .window-content {
        display: flex;
        flex-direction: column;
        gap: 1em;
    }

    .service {
        --row-height: 1.8em;

        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 1em;

        .header {
            display: flex;
            gap: 1em;

            input[type="text"],
            input[type="number"] {
                padding-block: 0;
                height: var(--row-height);
            }

            label {
                display: flex;
                align-items: center;
                gap: 0.5em;

                span {
                    display: flex;
                    align-items: center;
                    gap: 0.3em;
                    white-space: nowrap;
                }
            }

            .image {
                cursor: pointer;
                height: 6em;
                border: 1px solid var(--color-border);
            }

            .data {
                flex: 1;
                display: flex;
                flex-direction: column;
                justify-content: space-between;

                .row {
                    display: flex;
                    align-items: center;
                    gap: 2em;

                    .name,
                    .enabled {
                        flex: 1;
                    }

                    .level {
                        input {
                            width: 2em;
                            text-align: center;
                            padding-inline: 0;
                        }
                    }

                    .price {
                        input {
                            width: 8em;
                            text-align: end;
                        }
                    }

                    .quantity {
                        input {
                            text-align: end;
                            width: 3em;
                        }
                    }

                    .macro {
                        .macro-link {
                            height: var(--row-height);
                            border: 1px solid var(--color-border);
                            border-radius: 4px;

                            img {
                                border: 0;
                                border-right: 1px solid var(--color-border);
                                box-sizing: border-box;
                                display: block;
                                float: left;
                                height: 100%;
                            }

                            span {
                                height: 100%;
                                padding-inline: 0.3em 0.5em;
                            }

                            &.empty {
                                span {
                                    padding-inline: 2em;
                                    color: var(--color-text-dark-6);
                                }
                            }
                        }
                    }
                }
            }
        }

        .editor {
            flex: 1;
            border: 1px solid var(--color-border);
            border-radius: 2px;

            .editor-menu {
                padding: 0 0.2em;
                border-radius: 0;
            }

            .editor-container {
                .editor-content {
                    overflow-y: auto;
                }
            }
        }
    }

    .no-service {
        text-align: center;
        font-size: 1.5em;
    }
}

.pf2e.chat-card.item-card {
    &.pf2e-toolbelt-service {
        > header {
            border-bottom: var(--space-2) groove var(--color-text-light-0);
        }
    }

    .pf2e-toolbelt-service-error {
        color: #c11919;
        text-align: center;
        font-weight: bold;
    }
}

[id="pf2e-toolbelt.betterMerchant.service-import.dialog"] {
    textarea {
        width: 500px;
        height: 400px;
        resize: none;
        border-radius: 0;
    }
}

.application.dialog {
    .pf2e-toolbelt-services-export {
        padding-inline: 0;

        .dialog-form,
        .dialog-content {
            overflow: hidden;
        }

        .services {
            display: flex;
            flex-direction: column;
            gap: 1em;
            overflow: hidden auto;
            padding-inline: 1em;

            .service {
                .header {
                    display: flex;
                    justify-content: space-between;
                    align-items: center;
                    padding: 0.5em;

                    div {
                        flex: 1;
                    }
                }

                textarea {
                    width: 500px;
                    height: 120px;
                    resize: none;
                    border-radius: 0;
                    overflow: hidden;
                }
            }
        }

        .form-footer,
        .all-services {
            padding-inline: 1em;

            button {
                height: calc(1.25 * var(--input-height));
            }
        }
    }
}
