.stage-messages-shell
{
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
    background:
        radial-gradient(circle at 15% 10%, #d7f3ec, transparent 35%),
        radial-gradient(circle at 85% 20%, #e4eef9, transparent 40%),
        var(--bg);
}

.stage-conversation-status
{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    background: transparent;
}

.stage-conversation-status .history-summary-menu
{
    display: flex;
    align-items: center;
    gap: 4px;
}

.stage-conversation-status .talk-chain-btn.active
{
    border-color: #5fb3a8;
    color: #1f6f66;
    background: #e7f6f3;
}

.stage-conversation-status .talk-chain-btn.active:hover,
.stage-conversation-status .talk-chain-btn.active:focus
{
    border-color: #42988d;
    color: #185c55;
    background: #d9f0ec;
}

.stage-messages
{
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.stage-messages .talk-chain-group
{
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 14px;
    border: 1px solid #62bfb6;
    border-radius: 12px;
    padding: 18px 18px 18px 48px;
    background: linear-gradient(135deg, #b8ebe5 0%, #c8e5f6 100%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.stage-messages .talk-chain-group::before
{
    content: "";
    position: absolute;
    top: 14px;
    bottom: 14px;
    left: 15px;
    width: 3px;
    border-radius: 999px;
    background: linear-gradient(
        to right,
        rgba(22, 139, 128, 0.18),
        rgba(22, 139, 128, 0.9) 52%,
        rgba(22, 139, 128, 0.22)
    );
}

.stage-messages .talk-chain-group .msg
{
    position: relative;
    z-index: 1;
}

.stage-messages .talk-chain-group .msg:last-child
{
    margin-bottom: 0;
}

.stage-messages .talk-chain-group .msg.talk-chain-message
{
    border-color: #5bb5ac;
    box-shadow: 0 2px 8px rgba(34, 97, 91, 0.12);
}

.stage-messages .talk-chain-group .msg.user.talk-chain-message
{
    background: #e5faf7;
}

.stage-messages .talk-chain-group .msg.ai.talk-chain-message
{
    background: #f8fffd;
}

.stage-messages .msg-content
{
    display: block;
}

.stage-messages .msg-copy-btn
{
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin: 0 0 0 auto;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-dim);
    background: transparent;
    cursor: pointer;
}

.stage-messages .msg-copy-btn:hover,
.stage-messages .msg-copy-btn:focus
{
    border-color: #8bcfc6;
    color: var(--accent-hover);
    background: #eef8f6;
    outline: none;
}

.stage-messages .msg-copy-btn svg
{
    width: 15px;
    height: 15px;
}

.stage-messages .msg-meta
{
    display: flex;
    align-items: center;
    gap: 10px;
}

.stage-messages .msg-meta .msg-copy-btn
{
    flex: 0 0 auto;
}

.stage-messages .msg-directives
{
    display: grid;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #d9ebe8;
}

.stage-messages .msg-directives-toggle
{
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: fit-content;
    max-width: 100%;
    border: 1px solid #c9e5e1;
    border-radius: 8px;
    padding: 5px 9px;
    background: #f5fbfa;
    color: #25635d;
    font-family: inherit;
    font-size: 12px;
    line-height: 1.2;
    cursor: pointer;
}

.stage-messages .msg-directives-toggle:hover,
.stage-messages .msg-directives-toggle:focus
{
    border-color: #93ccc4;
    background: #eef8f6;
    outline: none;
}

.stage-messages .msg-directives-toggle svg
{
    width: 14px;
    height: 14px;
    transition: transform 0.16s ease;
}

.stage-messages .msg-directives-toggle[aria-expanded="true"] svg
{
    transform: rotate(180deg);
}

.stage-messages .msg-directives-list
{
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0 0 0 16px;
    color: #3f6662;
    font-size: 12px;
    line-height: 1.55;
}

.stage-messages .msg-directives-list[hidden]
{
    display: none;
}
