.tools-viewer-page {
    display: flex;
    flex-direction: column;
    gap: .85rem;
    min-height: calc(100dvh - var(--header-height));
    padding-bottom: 0;
}

.tools-viewer-intro {
    flex: 0 0 auto;
    margin-bottom: 0;
}

.tools-alert {
    background: #fff0f0;
    border: 1px solid #ffc7c7;
    border-radius: .75rem;
    color: #a11919;
    flex: 0 0 auto;
    padding: .8rem 1rem;
}

.tools-viewer-layout {
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
}

.tools-viewer-stage {
    background:
        radial-gradient(circle at 50% 18%, rgba(255, 255, 255, .92) 0, rgba(239, 246, 255, .72) 33%, rgba(226, 232, 240, .92) 100%);
    border-radius: .35rem;
    height: calc(100dvh - var(--header-height) - 8.6rem);
    min-height: 34rem;
    min-width: 0;
    overflow: hidden;
    position: relative;
}

.tools-model-viewer {
    background: transparent;
    height: 100%;
    min-height: 100%;
    position: relative;
    width: 100%;
    z-index: 1;
}

.tools-empty-state {
    align-items: center;
    color: #667085;
    display: flex;
    height: 100%;
    flex-direction: column;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.tools-empty-state h2 {
    color: #1d2939;
    font-size: 1.35rem;
    font-weight: 700;
    margin: .75rem 0 .25rem;
}

.tools-empty-state p {
    margin: 0;
}

.tools-empty-icon {
    align-items: center;
    background: #e6f4ff;
    border-radius: .7rem;
    color: var(--primary);
    display: inline-flex;
    height: 4.5rem;
    justify-content: center;
    width: 4.5rem;
}

.tools-empty-icon svg {
    fill: none;
    height: 2.25rem;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.6;
    width: 2.25rem;
}

.tools-viewer-toolbar {
    align-items: center;
    display: flex;
    gap: .65rem;
    justify-content: flex-end;
    left: 1rem;
    pointer-events: none;
    position: absolute;
    right: 1rem;
    top: 1rem;
    z-index: 8;
}

.tools-catalog-button,
.tools-viewer-controls button,
.tools-close-button,
.tools-refresh-button {
    align-items: center;
    border: 0;
    cursor: pointer;
    display: inline-flex;
    font-weight: 700;
    justify-content: center;
}

.tools-catalog-button {
    background: rgba(255, 255, 255, .92);
    border: 1px solid rgba(208, 213, 221, .85);
    border-radius: 999px;
    box-shadow: 0 10px 24px rgba(16, 24, 40, .12);
    color: #344054;
    font-size: .84rem;
    gap: .5rem;
    padding: .62rem .95rem;
    pointer-events: auto;
}

.tools-catalog-button span {
    align-items: center;
    background: #e6f4ff;
    border-radius: 999px;
    color: var(--primary);
    display: inline-flex;
    height: 1.55rem;
    justify-content: center;
    width: 1.55rem;
}

.tools-catalog-button svg,
.tools-close-button svg,
.tools-viewer-controls svg {
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.9;
}

.tools-catalog-button svg {
    height: .95rem;
    width: .95rem;
}

.tools-catalog-button .tools-cube-icon {
    height: 1.35rem;
    width: 1.35rem;
}

.tools-model-loader {
    align-items: center;
    color: #344054;
    display: flex;
    flex-direction: column;
    font-size: .86rem;
    font-weight: 700;
    gap: .65rem;
    left: 50%;
    justify-content: center;
    letter-spacing: .02em;
    opacity: .5;
    overflow: visible;
    pointer-events: none;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    transition: opacity .38s ease, visibility .38s ease;
    z-index: 6;
}

.tools-model-loader img {
    display: block;
    height: 6.25rem;
    object-fit: contain;
    overflow: visible;
    width: 6.25rem;
}

.tools-model-loader.is-hidden {
    opacity: 0;
    visibility: hidden;
}

.tools-viewer-controls {
    align-items: center;
    background: rgba(255, 255, 255, .9);
    border: 1px solid rgba(208, 213, 221, .85);
    border-radius: 999px;
    bottom: 1rem;
    box-shadow: 0 10px 24px rgba(16, 24, 40, .13);
    display: flex;
    gap: .35rem;
    left: 50%;
    padding: .35rem;
    position: absolute;
    transform: translateX(-50%);
    z-index: 8;
}

.tools-viewer-controls button {
    background: #fff;
    border-radius: 999px;
    color: #344054;
    font-size: .78rem;
    height: 2.2rem;
    transition: background .18s ease, color .18s ease, transform .18s ease;
    width: 2.2rem;
}

.tools-viewer-controls button:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-1px);
}

.tools-viewer-controls svg {
    height: 1rem;
    width: 1rem;
}

.tools-selected-card {
    backdrop-filter: blur(14px);
    background: rgba(255, 255, 255, .9);
    border: 1px solid rgba(208, 213, 221, .86);
    border-radius: .8rem;
    box-shadow: 0 12px 28px rgba(16, 24, 40, .12);
    left: 1rem;
    max-width: min(28rem, calc(100% - 2rem));
    padding: .9rem 1rem;
    position: absolute;
    top: 1rem;
    z-index: 7;
}

.tools-selected-card h2 {
    color: #1d2939;
    font-size: 1.08rem;
    font-weight: 700;
    margin: .28rem 0 .15rem;
}

.tools-selected-card p {
    color: #667085;
    font-size: .84rem;
    margin: 0;
}

.tools-category-pill {
    background: #e6f4ff;
    border-radius: 999px;
    color: var(--primary);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .06em;
    padding: .2rem .55rem;
    text-transform: uppercase;
}

.tools-model-meta {
    color: #1d2939;
    display: flex;
    gap: .5rem;
    font-size: .76rem;
    font-weight: 700;
    margin-top: .5rem;
}

.tools-model-meta small {
    color: #98a2b3;
    font-weight: 700;
}

.tools-offcanvas-backdrop {
    background: rgba(15, 23, 42, .36);
    border: 0;
    bottom: 0;
    cursor: default;
    left: 0;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 90;
}

.tools-selector-panel {
    background: #fff;
    border-left: 1px solid #eaecf0;
    bottom: 0;
    box-shadow: -18px 0 42px rgba(16, 24, 40, .18);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    position: fixed;
    right: 0;
    top: 0;
    transform: translateX(0);
    transition: transform .22s ease;
    width: min(26rem, 92vw);
    z-index: 100;
}

.tools-selector-panel.collapsed {
    pointer-events: none;
    transform: translateX(105%);
    visibility: hidden;
}

.tools-selector-heading {
    align-items: center;
    border-bottom: 1px solid #eaecf0;
    display: flex;
    gap: .85rem;
    justify-content: space-between;
    padding: 1.1rem;
}

.tools-selector-heading span {
    color: var(--primary);
    display: block;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.tools-selector-heading strong {
    color: #1d2939;
    display: block;
    font-size: 1rem;
    font-weight: 700;
    margin-top: .16rem;
}

.tools-close-button {
    background: #f8fafc;
    border-radius: 999px;
    color: #475467;
    height: 2.35rem;
    width: 2.35rem;
}

.tools-close-button svg {
    height: 1.05rem;
    width: 1.05rem;
}

.tools-selector-actions {
    border-bottom: 1px solid #eaecf0;
    padding: .9rem 1.1rem;
}

.tools-refresh-button {
    background: var(--primary);
    border: 1px solid var(--primary);
    border-radius: .45rem;
    color: #fff;
    font-size: .8rem;
    gap: .4rem;
    padding: .58rem .8rem;
    width: 100%;
}

.tools-refresh-button:disabled {
    cursor: not-allowed;
    opacity: .7;
}

.tools-loading {
    color: #667085;
    padding: 1rem;
}

.tools-category-group {
    border-bottom: 1px solid #eaecf0;
}

.tools-category-group summary {
    align-items: center;
    color: #1d2939;
    cursor: pointer;
    display: flex;
    font-size: .92rem;
    font-weight: 700;
    gap: .55rem;
    justify-content: flex-start;
    list-style: none;
    padding: .9rem 1.1rem;
    text-align: left;
}

.tools-category-group summary::-webkit-details-marker {
    display: none;
}

.tools-category-group summary::after {
    color: #98a2b3;
    content: "+";
    font-size: 1.15rem;
    margin-left: auto;
}

.tools-category-group[open] summary::after {
    content: "-";
}

.tools-category-group summary small {
    background: #eef2ff;
    border-radius: 999px;
    color: var(--primary);
    font-size: .72rem;
    padding: .1rem .45rem;
}

.tools-category-items {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: 0 .9rem .9rem;
}

.tools-item {
    background: #f8fafc;
    border: 1px solid transparent;
    border-radius: .65rem;
    color: #344054;
    padding: .72rem .8rem;
    text-align: left;
    transition: border-color .18s ease, background .18s ease, color .18s ease;
}

.tools-item span,
.tools-item small {
    display: block;
}

.tools-item span {
    font-size: .86rem;
    font-weight: 700;
}

.tools-item small {
    color: #667085;
    font-size: .74rem;
    margin-top: .2rem;
}

.tools-item:hover,
.tools-item.active {
    background: #e6f4ff;
    border-color: rgba(0, 123, 255, .22);
    color: var(--primary);
}

@media (max-width: 991px) {
    .tools-viewer-page {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .tools-viewer-layout {
        margin-left: -1rem;
        margin-right: -1rem;
    }

    .tools-viewer-stage {
        border-radius: 0;
        height: calc(100dvh - var(--header-height) - 8.2rem);
        min-height: 30rem;
    }

    .tools-selected-card {
        max-width: min(24rem, calc(100% - 2rem));
    }

}

@media (max-width: 575px) {
    .tools-viewer-page {
        gap: .65rem;
        padding: .85rem .65rem 0;
    }

    .tools-viewer-layout {
        margin-left: -.65rem;
        margin-right: -.65rem;
    }

    .tools-viewer-intro .intro-description {
        display: none;
    }

    .tools-viewer-stage {
        height: calc(100dvh - var(--header-height) - 6.4rem);
        min-height: 27rem;
    }

    .tools-selected-card {
        display: none;
    }

    .tools-model-meta {
        display: none;
    }

    .tools-viewer-toolbar {
        left: .75rem;
        right: .75rem;
        top: .75rem;
    }

    .tools-viewer-controls {
        bottom: .75rem;
        gap: .2rem;
        max-width: calc(100% - 1rem);
        overflow-x: auto;
    }

    .tools-viewer-controls button {
        flex: 0 0 auto;
        height: 2rem;
        width: 2rem;
    }

    .tools-selector-panel {
        width: min(23rem, 94vw);
    }
}
