.sheet.actor.character {
    .char-header .char-level {
        position: relative;

        .character-importer {
            position: absolute;
            z-index: 100;
            bottom: 0;
            left: 0;
            font-size: 1.1em;
            transform: translateX(-50%);
        }
    }

    .pf2e-toolbelt-character-importer-loader {
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 10em;
    }

    form.importing-character {
        .char-header .char-level .character-importer {
            .import {
                display: none;
            }
        }

        .sheet-navigation,
        .sheet-content {
            display: none;
        }

        .sheet-body {
            overflow: hidden;
        }
    }

    form:not(.importing-character) {
        .char-header .char-level .character-importer {
            .cancel {
                display: none;
            }
        }
    }
}

.sheet.actor.character .pf2e-toolbelt-character-importer {
    --outer-padding: 0.4rem;
    --color-boost: #316549;
    --color-boost-dark: #1b3c2a;
    --color-boost-flaw: #5e0000;

    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;

    .importer-header {
        --header-border: 1px solid #ffffff40;

        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        align-items: center;
        white-space: nowrap;
        background:
            url(/systems/pf2e/assets/sheet/border-pattern.webp) repeat-x top,
            url(/systems/pf2e/assets/sheet/border-pattern.webp) repeat-x bottom,
            var(--color-pf-secondary);
        color: var(--text-light);
        border-bottom: 1px solid hsla(0, 0%, 100%, 0.5);
        border-top: var(--header-border);

        .title {
            text-transform: uppercase;
            padding-left: 0.5rem;
        }

        a {
            padding-block: 0.2rem;
            text-align: center;

            i {
                font-size: 0.95em;
            }

            &:not(:last-child) {
                border-right: var(--header-border);
            }
        }

        .import {
            display: grid;
            grid-template-columns: 1fr 1fr auto;

            a {
                padding-inline: 0.5rem;

                &:first-child {
                    border-left: var(--header-border);
                }
            }
        }

        .menu {
            grid-column: 1 / -1;
            grid-row: 2;
            display: grid;
            grid-template-columns: repeat(6, 1fr);
            align-items: center;
            border-top: var(--header-border);

            a {
                &.selected {
                    background: #ff00ba52;
                }
            }
        }
    }

    .data {
        --entry-border: 1px solid #0000008f;
        --row-spacing: 0.5rem;

        overflow-y: auto;
        padding: 0.5rem var(--outer-padding) 2rem;
        flex: 1;
        display: flex;
        flex-direction: column;

        h3 {
            margin-block: 0.5rem;

            &:first-child {
                margin-top: 0;
            }
        }

        .warning {
            color: var(--primary);
            border: 1px solid var(--primary);
            padding: 0.3rem 0.5rem;
            border-radius: 4px;
            box-shadow: inset 0 0 3px var(--primary);
            margin-bottom: var(--row-spacing);
            text-align: center;

            &:not(:first-child) {
                margin-top: var(--row-spacing);
            }
        }

        .entry,
        .attributes {
            border: var(--entry-border);
            border-radius: 4px;
            box-shadow: 0 0 4px #0000009e;
        }

        .attributes {
            display: grid;
            grid-template-columns: minmax(7em, auto) repeat(6, 1fr);
            grid-auto-rows: 1fr;
            align-items: center;
            margin-bottom: 0.5em;

            .title {
                font-weight: bold;
                border-bottom: var(--entry-border);

                &.controls {
                    display: flex;

                    a {
                        display: flex;
                        align-items: center;
                        justify-content: center;
                        border-right: var(--entry-border);
                        width: 1.7em;
                        font-size: 1.05em;
                    }
                }
            }

            .label {
                padding-inline: 0.3em;
            }

            .attribute {
                text-align: center;
                text-transform: uppercase;

                .boost {
                    position: relative;
                    font-family: Signika, sans-serif;
                    border-radius: 3px;
                    border: 1px solid var(--color-boost);
                    font-size: 0.84em;
                    margin-inline: 0.15em;
                    opacity: 0.4;

                    i {
                        position: absolute;
                        top: 0;
                        left: 0;
                        transform: translate(-30%, -30%);
                        text-shadow:
                            0 0 3px black,
                            0 0 3px black;
                    }

                    &.Boost,
                    &.Partial {
                        color: var(--color-boost);
                    }

                    &.Boost.selected,
                    &.KeyIcon.selected {
                        background: var(--color-boost);
                    }

                    &.Boost.locked,
                    &.Partial.selected {
                        background: var(--color-boost-dark);
                    }

                    &.Flaw {
                        background: var(--color-boost-flaw);
                        border: 1px solid var(--color-boost-flaw);
                    }

                    &.selected {
                        color: var(--text-light);
                        opacity: 1;
                    }
                }
            }

            .mod {
                text-align: center;
                font-family: Eczar, Georgia, serif;
                line-height: 1.4;
                font-weight: bold;
                font-size: 1.1em;
            }
        }

        .skills {
            display: grid;
            grid-template-columns: 2fr 1fr 1fr;
            gap: 0.5rem;
            margin-inline: auto;

            .header {
                text-align: center;
                font-weight: bold;

                &.name {
                    padding-right: 1em;
                }
            }
        }

        .coinage {
            .currency {
                display: grid;
                grid-auto-columns: 1fr;
                grid-auto-flow: column;

                .label {
                    a {
                        white-space: nowrap;
                    }
                }
            }

            &.single {
                display: grid;
                grid-template-columns: 1fr 1fr;
                gap: 0.3rem;
            }
        }

        .spellcasting {
            display: grid;
            grid-template-columns: 1.2fr 1fr auto;
            align-items: center;
            gap: 0.5em;
            white-space: nowrap;
            margin-block: 0.5rem;
            padding: 0.2em 0.5em;
            background: var(--color-pf-primary);
            border-radius: 0.25em;
            color: var(--text-light);

            &:first-child {
                margin-top: 0;
            }

            .name {
                font-size: 1.2em;
                font-weight: bold;
                overflow: hidden;
                text-overflow: ellipsis;
            }

            select {
                line-height: 1.2;
                background-color: #00000029;
                border-color: #ffffff61;
            }

            .controls {
                display: flex;
                align-items: center;
                gap: 0.5em;
                grid-column: -2;

                a[disabled] {
                    opacity: 0.4;
                }
            }
        }

        .details {
            display: grid;
            grid-template-columns: 1fr 2fr 2fr;
            gap: 0.2rem 0.5rem;

            .name,
            .header {
                font-weight: bold;
            }

            .header {
                text-align: center;
            }

            > *:not(.header) {
                height: 1.715em;
                display: flex;
                align-items: center;

                &:not(.name) {
                    background: rgba(28, 28, 28, 0.1);
                    padding-inline: 0.3rem;
                }
            }
        }

        .languages {
            .header {
                font-weight: bold;
            }

            ul {
                margin-top: 0.3rem;
            }
        }

        .entry {
            position: relative;
            display: grid;
            grid-template-columns: 50px 1fr;
            grid-template-rows: 1fr 1fr;
            align-items: center;

            > * {
                pointer-events: none;
            }

            a {
                pointer-events: all;
            }

            img {
                grid-row: 1 / -1;
                border: none;
                border-right: var(--entry-border);
                border-top-right-radius: 0;
                border-bottom-right-radius: 0;
            }

            .header,
            .index {
                gap: 0.2rem;
                height: 100%;
                padding-inline: var(--outer-padding);
                overflow: hidden;

                .section {
                    display: flex;
                    align-items: center;
                    gap: 0.2rem;
                    overflow: hidden;

                    .value {
                        white-space: nowrap;
                        overflow: hidden;
                        text-overflow: ellipsis;
                    }
                }
            }

            .header {
                display: flex;
                align-items: center;
                border-bottom: var(--entry-border);
                justify-content: space-between;
                padding-right: 0;

                .controls {
                    height: 100%;
                    display: flex;

                    a {
                        height: calc(100% + 1px);
                        width: 1.35rem;
                        display: flex;
                        align-items: center;
                        justify-content: center;
                        border-left: var(--entry-border);
                        border-bottom-left-radius: 4px;

                        i.fa-lock {
                            opacity: 0.9;
                        }
                    }
                }
            }

            .index {
                display: grid;
                grid-template-columns: 1fr 1fr;
                align-items: center;

                a {
                    text-decoration: underline;
                }
            }

            .level,
            .extra {
                position: absolute;
                left: 0;
                color: var(--text-light);
                background: rgba(0, 0, 0, 0.74);
                display: flex;
                justify-content: center;
                align-items: center;
                outline: 1px solid #ffffff4a;
            }

            .level {
                font-size: 1.1em;
                font-weight: bold;
                bottom: 0;
                border-radius: 0 4px;
                padding: 0 0.3rem;
            }

            .extra {
                top: 0;
                border-radius: 4px 0;
                font-size: 0.6em;
                padding: 0.2rem;
            }

            &:has(+ .entry.child) {
                border-bottom-right-radius: 0;
                clip-path: inset(-10px -10px 0px -10px);
            }

            &:has(+ .entry:not(.child)) {
                margin-bottom: var(--row-spacing);
            }

            &.child {
                align-self: end;
                width: calc(100% - var(--depth) * 10px);
                border-top-right-radius: 0;
                border-top: 0;

                img {
                    border-top-left-radius: 0;
                }

                &:has(+ .entry.child) {
                    border-bottom-left-radius: 0;
                    clip-path: inset(0px -10px 0px -10px);

                    img {
                        border-bottom-left-radius: 0;
                    }
                }

                &:not(:has(+ .entry.child)) {
                    clip-path: inset(0px -10px -10px -10px);
                }
            }
        }

        &:not(.selected) {
            display: none;
        }
    }
}
