/* Tool shell: left sidebar + main workspace (InsMelo-style) */
body.has-tool-sidebar {
    padding-left: 0;
}

.tool-app-shell {
    display: flex;
    align-items: flex-start;
    gap: 0;
    max-width: 1480px;
    margin: 0 auto;
    padding: 0 12px 32px;
    min-height: calc(100vh - 120px);
}

.tool-main-column {
    flex: 1 1 auto;
    min-width: 0;
}

.tool-sidebar {
    flex: 0 0 268px;
    width: 268px;
    position: sticky;
    top: 108px;
    max-height: calc(100vh - 116px);
    display: flex;
    flex-direction: column;
    background: rgba(10, 10, 14, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    margin-right: 20px;
    overflow: hidden;
    z-index: 50;
}

.tool-sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    padding: 14px 12px 12px;
}

.tool-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 12px;
}

.tool-sidebar-brand a {
    color: #e2e8f0;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
}

.tool-sidebar-brand a:hover {
    color: #a78bfa;
}

.tool-sidebar-section {
    margin-bottom: 18px;
}

.tool-sidebar-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
    margin: 0 8px 10px;
}

.tool-sidebar-create-btn {
    width: calc(100% - 16px);
    margin: 0 8px 10px;
    justify-content: center;
}

.tool-sidebar-preview-notice {
    margin: 0 8px 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.25);
    font-size: 0.78rem;
    line-height: 1.45;
    color: #c4b5fd;
}

.tool-sidebar-preview-notice strong {
    color: #e9d5ff;
}

.tool-sidebar-project-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 4px;
}

.tool-sidebar-project-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
    transition: background 0.15s, border-color 0.15s;
}

.tool-sidebar-project-item:hover {
    background: rgba(139, 92, 246, 0.1);
}

.tool-sidebar-project-item.is-active {
    background: rgba(139, 92, 246, 0.16);
    border-color: rgba(139, 92, 246, 0.45);
}

.tool-sidebar-project-thumb {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(30, 41, 59, 0.9));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    overflow: hidden;
}

.tool-sidebar-project-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tool-sidebar-project-meta {
    min-width: 0;
    flex: 1;
}

.tool-sidebar-project-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tool-sidebar-project-sub {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 2px;
}

.tool-sidebar-empty {
    margin: 0 8px;
    font-size: 0.82rem;
    color: #94a3b8;
    line-height: 1.45;
}

.tool-sidebar-tools {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 4px;
}

.tool-sidebar-tool-link {
    display: block;
    padding: 10px 12px;
    border-radius: 10px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    transition: background 0.15s, color 0.15s;
}

.tool-sidebar-tool-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
}

.tool-sidebar-tool-link.is-current {
    background: rgba(139, 92, 246, 0.18);
    color: #c4b5fd;
    box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.35);
}

.tool-sidebar-footer {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.tool-sidebar-upgrade {
    width: calc(100% - 8px);
    margin: 8px 4px 0;
}

.tool-sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 16px;
    z-index: 200;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #8b5cf6, #a78bfa);
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.45);
}

/* Hide legacy inline project strip in Step 1 when sidebar is active */
body.has-tool-sidebar [data-project-library-mount] {
    display: none !important;
}

/* Setup modal + compact plan picker (unchanged) */
.project-setup-cover-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
    margin: 16px 0;
}

.project-setup-cover-preview {
    width: 96px;
    height: 96px;
    border-radius: 12px;
    border: 2px dashed rgba(139, 92, 246, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.6);
    overflow: hidden;
    font-size: 2rem;
}

.project-setup-cover-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-setup-cover-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.plan-picker-options--compact {
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 12px 0 16px;
}

.login-or-trial-plans-intro {
    margin-bottom: 4px !important;
}

@media (max-width: 960px) {
    .tool-app-shell {
        flex-direction: column;
        padding: 0 8px 24px;
    }

    .tool-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(300px, 88vw);
        max-height: none;
        margin: 0;
        border-radius: 0;
        border-left: none;
        border-top: none;
        border-bottom: none;
        transform: translateX(-105%);
        transition: transform 0.25s ease;
        z-index: 1300;
        top: 0;
        padding-top: env(safe-area-inset-top);
    }

    body.tool-sidebar-open .tool-sidebar {
        transform: translateX(0);
    }

    body.tool-sidebar-open::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        z-index: 1290;
    }

    .tool-sidebar-toggle {
        display: block;
    }
}

@media (min-width: 520px) {
    .plan-picker-options--compact {
        grid-template-columns: repeat(3, 1fr);
    }
}
