/* Preserve native Filament pagination while presenting messages as a dialog. */
.fi-panel-client .client-conversation .fi-ta-table {
    table-layout: fixed;
    border: 0;
}

.fi-panel-client .client-conversation .fi-ta-table > thead {
    display: none;
}

.fi-panel-client .client-conversation .fi-ta-table > tbody,
.fi-panel-client .client-conversation .fi-ta-row {
    border: 0;
}

.fi-panel-client .client-conversation .fi-ta-cell {
    padding: .4rem 1rem;
    white-space: normal;
}

.fi-panel-client .client-conversation .fi-ta-col {
    display: block;
    width: 100%;
}

.fi-panel-client .conversation-message {
    display: flex;
    padding-block: .25rem;
    color: var(--dashboard-text);
    text-align: start;
}

.fi-panel-client .conversation-message-user {
    justify-content: flex-end;
}

.fi-panel-client .conversation-message-bubble {
    min-width: 0;
    width: fit-content;
    max-width: 88%;
    padding: .85rem 1rem;
    border: 1px solid var(--dashboard-border);
    border-radius: .75rem .75rem .75rem .15rem;
    background: var(--dashboard-control, var(--dashboard-panel));
    overflow-wrap: anywhere;
    font-size: .875rem;
    line-height: 1.65;
}

.fi-panel-client .conversation-message-user .conversation-message-bubble {
    border-color: var(--dashboard-active-border, var(--dashboard-border));
    border-radius: .75rem .75rem .15rem .75rem;
    background: var(--dashboard-active-bg, var(--dashboard-panel));
}

.fi-panel-client .conversation-message-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .25rem 1rem;
    margin-bottom: .5rem;
    font-size: .7rem;
    color: var(--dashboard-muted);
}

.fi-panel-client .conversation-message-meta strong {
    color: var(--dashboard-text);
    font-weight: 600;
}

.fi-panel-client .conversation-message-meta time {
    white-space: nowrap;
}

.fi-panel-client .conversation-message-text {
    white-space: pre-wrap;
}

.fi-panel-client .conversation-message-empty {
    color: var(--dashboard-muted);
    font-style: italic;
}

.fi-panel-client .conversation-message-content :is(p, ul, ol, pre, blockquote, hr) {
    margin-block: .6rem;
}

.fi-panel-client .conversation-message-content :is(ul, ol) {
    padding-inline-start: 1.5rem;
}

.fi-panel-client .conversation-message-content ul {
    list-style-type: disc;
}

.fi-panel-client .conversation-message-content ol {
    list-style-type: decimal;
}

.fi-panel-client .conversation-message-content :is(h1, h2, h3, h4, h5, h6) {
    margin-block: .8rem .4rem;
    font-size: 1em;
    font-weight: 650;
}

.fi-panel-client .conversation-message-content .turn-markdown > :first-child {
    margin-top: 0;
}

.fi-panel-client .conversation-message-content .turn-markdown > :last-child {
    margin-bottom: 0;
}

.fi-panel-client .conversation-message-content a {
    color: var(--dashboard-blue);
    text-decoration: underline;
    text-underline-offset: .15em;
}

.fi-panel-client .conversation-message-content a:focus-visible {
    outline: 2px solid var(--dashboard-blue);
    outline-offset: 3px;
}

.fi-panel-client .conversation-message-content :is(pre, code) {
    background: var(--dashboard-bg);
    border-radius: .25rem;
    font-size: .85em;
}

.fi-panel-client .conversation-message-content code {
    padding: .1rem .25rem;
}

.fi-panel-client .conversation-message-content pre {
    max-width: 100%;
    overflow-x: auto;
    padding: .7rem;
    white-space: pre;
}

.fi-panel-client .conversation-message-content pre code {
    padding: 0;
    background: none;
    font-size: inherit;
}

.fi-panel-client .conversation-message-content blockquote {
    border-inline-start: 3px solid var(--dashboard-border);
    padding-inline-start: .8rem;
    color: var(--dashboard-muted);
}

.fi-panel-client .conversation-message-content .turn-json-children {
    padding-inline-start: 1rem;
}

.fi-panel-client .conversation-message-content .turn-json-key {
    font-weight: 600;
}

@media (max-width: 640px) {
    .fi-panel-client .client-conversation .fi-ta-cell {
        padding-inline: .5rem;
    }

    .fi-panel-client .conversation-message-bubble {
        max-width: 96%;
        padding: .7rem .75rem;
    }
}

/* Handoff operators need readable products and a clear indication of new messages. */
.fi-panel-client .handoff-products-scroll { overflow-x: auto; }
.fi-panel-client .handoff-products { width: 100%; font-size: .875rem; text-align: start; }
.fi-panel-client .handoff-products :is(th, td) { padding: .7rem .6rem; border-bottom: 1px solid var(--dashboard-border); }
.fi-panel-client .handoff-products th { color: var(--dashboard-muted); font-weight: 600; }
.fi-panel-client .handoff-products td:first-child { min-width: 11rem; overflow-wrap: anywhere; }
.fi-panel-client .handoff-products td:not(:first-child) { white-space: nowrap; }
.fi-panel-client .handoff-products a { color: var(--dashboard-blue); text-decoration: underline; }
.fi-panel-client .handoff-products tfoot td { font-weight: 650; }
.fi-panel-client .handoff-load-older { display: flex; justify-content: center; margin-bottom: 1rem; }
.fi-panel-client .handoff-unread-notice { padding: .8rem; margin-bottom: 1rem; border-radius: .5rem; background: #fef3c7; color: #78350f; }
.fi-panel-client .handoff-new-label { display: inline-block; margin-inline-start: .5rem; border-radius: .3rem; padding: .1rem .4rem; background: #fef3c7; color: #78350f; }
.fi-panel-client .handoff-new-message .conversation-message-bubble { background: #fffbeb; border-color: #d97706; }
.fi-panel-client .handoff-unread-row { background: #fffbeb; }
.fi-panel-client.dark .handoff-unread-row, .dark .fi-panel-client .handoff-unread-row { background: #302618; }
.fi-panel-client.dark .handoff-new-message .conversation-message-bubble, .dark .fi-panel-client .handoff-new-message .conversation-message-bubble { background: #302618; border-color: #d97706; }
.fi-panel-client.dark :is(.handoff-new-label, .handoff-unread-notice), .dark .fi-panel-client :is(.handoff-new-label, .handoff-unread-notice) { background: #422f12; color: #fde68a; }

.fi-panel-client .handoff-list-title { max-width: 24rem; padding: .7rem 1rem; }
.fi-panel-client .handoff-list-heading { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem .65rem; }
.fi-panel-client .handoff-list-unread-badge { display: inline-block; border-radius: .35rem; padding: .15rem .45rem; font-size: .75rem; line-height: 1.35; font-weight: 650; background: #fef3c7; color: #78350f; white-space: nowrap; }
.fi-panel-client .handoff-list-preview { display: block; margin-top: .35rem; color: var(--dashboard-muted); font-size: .8rem; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
.fi-panel-client .handoff-unread-banner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; border: 1px solid #d97706; border-radius: .65rem; padding: 1rem 1.2rem; background: #fffbeb; color: #78350f; }
.fi-panel-client .handoff-unread-banner strong { display: block; font-size: .95rem; }
.fi-panel-client .handoff-unread-banner p { margin-top: .25rem; font-size: .8rem; }
.fi-panel-client .handoff-read-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem 1rem; margin-bottom: 1rem; }
.fi-panel-client .handoff-read-actions > span { color: var(--dashboard-muted); font-size: .8rem; }
.fi-panel-client :is(.handoff-conversation, .handoff-new-message) { scroll-margin-top: 5rem; }
.fi-panel-client.dark .handoff-unread-banner, .dark .fi-panel-client .handoff-unread-banner { background: #302618; color: #fde68a; }
.fi-panel-client.dark .handoff-list-unread-badge, .dark .fi-panel-client .handoff-list-unread-badge { background: #422f12; color: #fde68a; }
