.root {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    background-color: var(--background-color);
}

.content {
    display: flex;
    flex-direction: row;
    justify-content: stretch;
    flex: 1 1 auto;
    height: 0;

    & .sidebar {
        display: flex;
        flex-direction: column;
        min-width: 150px;
        max-width: 85%;
        background-color: var(--background-color);
        position: relative;

        & .sidebarTabs {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 3px;
            padding: 8px 10px 0;
        }

        & .sidebarTab {
            min-width: 0;
            border: 1px solid transparent;
            border-radius: 6px 6px 0 0;
            background: transparent;
            color: var(--foreground-secondary-color);
            cursor: pointer;
            font: inherit;
            font-size: 11px;
            font-weight: 700;
            line-height: 1.2;
            overflow: hidden;
            padding: 7px 6px;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        & .sidebarTab:hover {
            background: var(--panel-background-color);
            color: var(--foreground-color);
        }

        & .sidebarTabActive {
            border-color: rgba(148, 163, 184, 0.28);
            border-bottom-color: transparent;
            background: var(--panel-background-color);
            color: var(--foreground-color);
        }

        & .sidebarPanels {
            display: flex;
            flex: 1 1 auto;
            min-height: 0;
            border-top: 1px solid rgba(148, 163, 184, 0.24);
        }

        & .sidebarPanel {
            display: flex;
            flex: 1 1 auto;
            min-width: 0;
            min-height: 0;
        }

        & .sidebarPanel > * {
            flex: 1 1 auto;
            min-width: 0;
            min-height: 0;
        }

        & .sidebarPanel[hidden] {
            display: none;
        }

        & .sidebarPanelActive {
            display: flex;
        }

        & .sidebarItem {
            overflow: hidden;
            flex: 1 1 auto;
            min-width: 0;
            min-height: 0;
            width: 100%;
        }
    }

    & .viewportContainer {
        position: relative;
        background-color: var(--viewport-background-color);
        flex: 1 1 auto;
        width: 0;

        .viewport {
            height: 100%;
            position: relative;
        }
    }
}

.sidebarResizer {
    width: 6px;
    cursor: ew-resize;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    background: var(--resizer-gradient);
    transition: background 0.2s;
}
.sidebarResizer:hover {
    background: var(--resizer-gradient-hover);
}

.statusbar {
    height: 24px;
    display: flex;
    flex-direction: column;
}

.contextMenu {
    position: fixed;
    z-index: 10000;
    display: flex;
    width: min(320px, calc(100vw - 12px));
    max-height: calc(100vh - 16px);
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: 7px;
    background: var(--background-color);
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.34), 0 4px 16px rgba(15, 23, 42, 0.22);
    color: var(--foreground-color);
    outline: none;
    padding: 3px;
}

.contextMenuHeader {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 1px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
    padding: 3px 5px 4px;
}

.contextMenuBody {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    column-count: 1;
    padding-top: 2px;
}

.contextMenuTitle {
    overflow: hidden;
    font-size: 11px;
    font-weight: 750;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.contextMenuSubtitle {
    overflow: hidden;
    color: var(--foreground-secondary-color);
    font-size: 9px;
    font-weight: 600;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.contextMenuSection {
    display: inline-flex;
    min-width: 0;
    width: 100%;
    break-inside: avoid;
    flex-direction: column;
    gap: 1px;
    margin: 0 0 3px;
    padding: 0;
    vertical-align: top;
}

.contextMenuSection + .contextMenuSection {
    border-top: 0;
}

.contextMenuSectionTitle {
    color: var(--foreground-secondary-color);
    font-size: 8px;
    font-weight: 750;
    line-height: 1.1;
    padding: 3px 5px 1px;
    text-transform: uppercase;
}

.contextMenuItem {
    display: grid;
    min-width: 0;
    width: 100%;
    grid-template-columns: 14px minmax(0, 1fr) auto;
    align-items: center;
    gap: 5px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--foreground-color);
    cursor: pointer;
    font: inherit;
    font-size: 10px;
    line-height: 1.2;
    min-height: 19px;
    padding: 2px 5px;
    text-align: left;
}

.contextMenuItem:hover:not(:disabled),
.contextMenuItem:focus-visible:not(:disabled) {
    background: rgba(56, 189, 248, 0.14);
}

.contextMenuItem:disabled {
    cursor: not-allowed;
    opacity: 0.42;
}

.contextMenuItemChecked {
    color: #0284c7;
    font-weight: 750;
}

.contextMenuItemDanger {
    color: #dc2626;
}

.contextMenuIcon {
    display: inline-flex;
    width: 14px;
    height: 14px;
    align-items: center;
    justify-content: center;
}

.contextMenuSvg {
    width: 12px;
    height: 12px;
    color: currentColor;
    fill: currentColor;
}

.contextMenuLabel {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.contextMenuShortcut {
    color: var(--foreground-secondary-color);
    font-size: 8px;
    font-weight: 650;
    line-height: 1;
    white-space: nowrap;
}

@media (max-width: 720px) {
    .contextMenu {
        width: min(320px, calc(100vw - 12px));
    }

    .contextMenuBody {
        column-count: 1;
    }
}

@media (max-width: 680px) {
    .content {
        flex-direction: column-reverse;
        min-height: 0;

        & .viewportContainer {
            height: 100px;
            width: 100%;
        }

        & .sidebar {
            display: none;
            flex: 1 1 auto;
            width: 100%;
        }
    }
}
