/* Workspace overrides only; chat IDs and transport remain in ChatApp. */
.workspace-chat-page {
    --chat-accent: var(--workspace-blue, #315ae8);
    --chat-border: #e4eaf3;
    --chat-muted: #748096;
    --workspace-chat-padding: 24px;
}

.workspace-chat-page .workspace-main {
    height: 100vh;
    height: 100dvh;
    min-width: 0;
    min-height: 0;
}

.workspace-chat-page .workspace-header,
.workspace-chat-page .workspace-footer {
    flex: 0 0 auto;
}

.workspace-chat-page .workspace-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    flex: 1 1 0;
    overflow: hidden;
    padding: 12px;
}

.workspace-chat-page .hbm-chat-shell {
    width: 100%;
    height: calc(100vh - var(--workspace-header-height, 60px) - var(--workspace-footer-height, 50px) - var(--workspace-chat-padding));
    height: calc(100dvh - var(--workspace-header-height, 60px) - var(--workspace-footer-height, 50px) - var(--workspace-chat-padding));
    min-height: 0;
    flex: 1 1 0;
    margin: 0;
    border: 1px solid var(--chat-border);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 30px rgba(29, 49, 82, .035);
    isolation: isolate;
}

.workspace-chat-page .hbm-chat-layout,
.workspace-chat-page .hbm-chat-main {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.workspace-chat-page .hbm-chat-sidebar {
    width: 220px;
    flex: 0 0 220px;
    border-right-color: var(--chat-border);
    background: #f8faff;
}

.workspace-chat-page .hbm-sidebar-content {
    padding: 16px 14px;
    gap: 20px;
    overscroll-behavior: contain;
}

.workspace-chat-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #62718a;
    font-size: 12px;
    text-decoration: none;
}

.workspace-chat-back:hover {
    color: var(--chat-accent);
}

.workspace-chat-page .hbm-action-btn {
    min-height: 40px;
    padding: 10px;
    border-radius: 9px;
    font: inherit;
    font-size: 12px;
}

.workspace-chat-page .hbm-action-primary {
    background: var(--chat-accent);
    box-shadow: 0 4px 10px rgba(37, 99, 235, .12);
}

.workspace-chat-page .hbm-action-warm {
    background: #fff;
    color: #68758b;
    border: 1px solid var(--chat-border);
}

.workspace-chat-page .hbm-chat-history h3 {
    color: #8b96a9;
    font-size: 11px;
    letter-spacing: .04em;
}

.workspace-chat-page .hbm-history-item {
    border-color: transparent;
    background: transparent;
    border-radius: 9px;
    box-shadow: none;
}

.workspace-chat-page .hbm-history-item:hover {
    background: #edf3ff;
}

.workspace-chat-page .hbm-history-item.active {
    border-color: #dce7ff;
    background: #eaf1ff;
    box-shadow: none;
}

.workspace-chat-page .hbm-chat-header {
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 12px 18px;
    padding: 16px 20px;
    border-bottom-color: var(--chat-border);
    background: #fff;
}

.workspace-chat-identity {
    flex: 1 1 220px;
    min-width: 0;
}

.workspace-chat-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.workspace-chat-avatar {
    display: inline-flex;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: #edf3ff;
    color: var(--chat-accent);
}

.workspace-chat-avatar .layui-icon {
    font-size: 21px;
}

.workspace-chat-title {
    min-width: 0;
}

.workspace-chat-kicker {
    display: block;
    margin-bottom: 3px;
    color: var(--chat-muted);
    font-size: 10px;
    line-height: 1.2;
}

.workspace-chat-page .hbm-chat-header h2 {
    margin: 0;
    font-size: 16px;
    line-height: 1.4;
    color: #26344c;
}

.workspace-chat-description {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    margin: 9px 0 0;
    color: var(--chat-muted);
    font-size: 12px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.workspace-chat-page .hbm-header-right {
    flex-wrap: wrap;
    gap: 8px;
    max-width: 100%;
}

.workspace-chat-switch,
.workspace-chat-page .hbm-mobile-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    padding: 7px 10px;
    border: 1px solid #dce7fa;
    border-radius: 8px;
    background: #f5f8ff;
    color: var(--chat-accent);
    font: inherit;
    font-size: 12px;
    line-height: 1.4;
    text-decoration: none;
    white-space: nowrap;
}

.workspace-chat-switch:hover,
.workspace-chat-page .hbm-mobile-toggle:hover {
    background: #eaf1ff;
    color: #1d4ed8;
}

.workspace-chat-page .hbm-mobile-toggle {
    display: none;
    border-color: var(--chat-border);
    background: #fff;
    color: #5b6a82;
}

.workspace-chat-page .hbm-chat-info:empty {
    display: none;
}

.workspace-chat-page .hbm-chat-messages {
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    padding: 24px;
    background: #f8faff;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.workspace-chat-page .hbm-welcome {
    max-width: 620px;
    margin: 22px auto;
    border-color: var(--chat-border);
    border-radius: 14px;
    box-shadow: none;
}

.workspace-chat-page .hbm-welcome h3 {
    color: #26344c;
    font-size: 19px;
}

.workspace-chat-page .message.user {
    background: #e8f0ff;
    color: #253d66;
    box-shadow: none;
}

.workspace-chat-page .message.assistant {
    box-shadow: 0 2px 10px rgba(35, 57, 89, .025);
}

.workspace-chat-page .hbm-chat-input {
    flex: 0 0 auto;
    min-width: 0;
    padding: 12px 18px 10px;
    border-top-color: var(--chat-border);
}

.workspace-chat-page .hbm-input-container {
    min-width: 0;
}

.workspace-chat-page .hbm-input-container textarea {
    min-width: 0;
    min-height: 82px;
    max-height: min(160px, 25dvh);
    border-color: #dfe7f4;
    background: #fafcff;
    color: #25344d;
    font-family: inherit;
}

.workspace-chat-page .hbm-input-container textarea:disabled {
    background: #f5f7fa;
    color: #8390a4;
    cursor: not-allowed;
}

.workspace-chat-page .hbm-input-actions {
    min-width: 72px;
}

.workspace-chat-page .hbm-input-actions .layui-btn {
    min-width: 72px;
    font-family: inherit;
    font-size: 12px;
}

.workspace-chat-page .hbm-input-actions .layui-btn-normal {
    background: var(--chat-accent);
    box-shadow: none;
}

.workspace-chat-input-hint {
    margin-top: 7px;
    color: #93a0b4;
    font-size: 10px;
    line-height: 1.5;
}

.workspace-chat-page .hbm-chat-shell [hidden] {
    display: none !important;
}

.workspace-chat-page .hbm-chat-shell a:focus-visible,
.workspace-chat-page .hbm-chat-shell button:focus-visible {
    outline: 2px solid #80a7fb;
    outline-offset: 2px;
}

@media (max-width: 1000px) {
    .workspace-chat-page .hbm-mobile-toggle {
        display: inline-flex;
    }

    .workspace-chat-page .hbm-chat-sidebar {
        position: absolute;
        inset: 0 auto 0 0;
        z-index: 20;
        width: min(220px, 86vw);
        flex-basis: auto;
        transform: translateX(-105%);
        visibility: hidden;
        pointer-events: none;
        box-shadow: 6px 0 22px rgba(25, 46, 82, .12);
        transition: transform .2s ease, visibility .2s;
    }

    .workspace-chat-page .hbm-chat-shell.sidebar-open .hbm-chat-sidebar {
        transform: translateX(0);
        visibility: visible;
        pointer-events: auto;
    }

    .workspace-chat-page .hbm-sidebar-overlay {
        position: absolute;
        inset: 0;
        z-index: 15;
        background: rgba(31, 51, 83, .2);
    }

    .workspace-chat-page .hbm-chat-shell.sidebar-open .hbm-sidebar-overlay {
        display: block;
    }

    .workspace-chat-page .hbm-history-delete {
        opacity: 1;
    }
}

@media (max-width: 640px) {
    .workspace-chat-page {
        --workspace-chat-padding: 16px;
    }

    .workspace-chat-page .workspace-content {
        padding: 8px;
    }

    .workspace-chat-page .hbm-chat-shell {
        border: 1px solid var(--chat-border);
        border-radius: 12px;
    }

    .workspace-chat-page .hbm-chat-header {
        gap: 10px;
        padding: 12px;
    }

    .workspace-chat-identity,
    .workspace-chat-page .hbm-header-right {
        flex: 1 1 100%;
    }

    .workspace-chat-page .hbm-header-right {
        margin-left: 0;
    }

    .workspace-chat-page .hbm-chat-info {
        max-width: 120px;
    }

    .workspace-chat-page .hbm-turn-nav {
        padding: 3px 5px;
    }

    .workspace-chat-page .hbm-chat-messages {
        padding: 14px 10px;
    }

    .workspace-chat-page .hbm-welcome {
        margin: 6px auto;
        padding: 22px 16px;
    }

    .workspace-chat-page .message {
        max-width: 96%;
        padding: 12px;
    }

    .workspace-chat-page .hbm-chat-input {
        padding: 10px;
    }

    .workspace-chat-page .hbm-input-container {
        gap: 8px;
    }

    .workspace-chat-page .hbm-input-container textarea {
        min-height: 76px;
        padding: 10px;
        font-size: 16px;
    }

    .workspace-chat-page .hbm-input-actions,
    .workspace-chat-page .hbm-input-actions .layui-btn {
        min-width: 60px;
    }

    .workspace-chat-page .hbm-attach-preview {
        max-height: 84px;
        overflow-y: auto;
    }
}

@media (max-height: 560px) {
    .workspace-chat-description,
    .workspace-chat-input-hint {
        display: none;
    }

    .workspace-chat-page .hbm-chat-header {
        padding-top: 8px;
        padding-bottom: 8px;
    }

    .workspace-chat-page .hbm-input-container textarea {
        min-height: 64px;
        max-height: 84px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .workspace-chat-page .hbm-chat-sidebar,
    .workspace-chat-page .hbm-action-btn,
    .workspace-chat-page .message {
        animation: none;
        transition: none;
    }
}
