/* Application behavior/layout adapters; visual tokens belong to sc-brand. */
body { color: var(--sc-ink); font-synthesis: none; overflow-wrap: anywhere; }
main, turbo-frame, .card-body, .form-control { min-width: 0; }
turbo-frame { display: block; }
.label { white-space: normal; color: var(--sc-ink); }
.label-text-alt { color: var(--sc-muted); }
.form-control > .label { display: flex; flex-wrap: wrap; gap: .5rem; padding-block: .5rem; }
.form-control > .input, .form-control > .select, .form-control > .textarea { width: 100%; }
.field_with_errors { display: contents; }
.field_with_errors :is(input, textarea, select) { border-color: var(--sc-danger); }
.link-primary, .text-primary { color: var(--sc-brand-link); }
/* Status text uses the foreground role; DaisyUI status backgrounds are pastel. */
.text-error { color: var(--sc-danger); }
.text-warning { color: var(--sc-warning); }
.text-success { color: var(--sc-success); }
.text-info { color: var(--sc-info); }
.btn { white-space: normal; }
.menu a, .menu button { overflow-wrap: anywhere; }
.dropdown-content { z-index: 60; border: 1px solid var(--sc-line); max-width: calc(100vw - 2rem); }
.brand-lockup { width: 180px; height: auto; }
.brand-dark { display: none; }
[data-theme=dark] .brand-light { display: none; }
[data-theme=dark] .brand-dark { display: block; }
.app-header { flex-shrink: 0; }
.app-navigation { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem 1rem; padding: .75rem 1rem; border-bottom: 1px solid var(--sc-line); background: var(--sc-surface); }
.app-navigation .brand-home { padding: .5rem; flex-shrink: 0; }
.app-navigation .primary-links { flex: 1; }
.app-navigation .account-links { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.app-navigation .menu-horizontal { flex-wrap: wrap; }
.app-navigation [aria-current=page] { background: var(--sc-tint); color: var(--sc-brand-link); font-weight: 700; }
.app-conversation-layout { height: 100dvh; display: flex; flex-direction: column; }
.app-conversation-layout > main { flex: 1; min-height: 44rem; display: flex; flex-direction: column; }
.conversation-workspace { flex: 1; min-height: 0; border-radius: 0; border: 0; }
.conversation-workspace > aside { padding: 0; overflow: auto; }
.conversation-workspace > section { padding: 0; min-height: 0; }
.conversation-workspace.without-sidebar { grid-template-columns: minmax(0, 1fr); }
.conversation-workspace .chat-main { min-height: 0; }
.messages-area { position: relative; scrollbar-color: var(--sc-control) transparent; }
.chat { min-width: 0; }
.chat-header { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; color: var(--sc-ink); overflow-wrap: anywhere; }
.chat-header :is(.badge, time) { white-space: nowrap; flex-shrink: 0; }
.chat-bubble.sc-message { color: var(--sc-ink); max-width: min(72ch, 100%); min-width: 0; font-size: 14px; line-height: 1.3; padding: .75rem; border-radius: .75rem; }
.chat-end .sc-message { background: var(--sc-tint); }
.chat-bubble.sc-message::before { display: none; }
.chat-footer { opacity: 1; display: flex; flex-wrap: wrap; gap: .25rem; color: var(--sc-muted); }
.scroll-to-latest { position: sticky; top: .5rem; margin-left: auto; margin-bottom: .5rem; z-index: 10; }
.scroll-to-latest:not(.hidden) { display: flex; align-items: center; justify-content: center; }
.modal-box.sc-dialog { margin: auto; }
.modal-box.sc-dialog.modal-fullscreen { width: calc(100% - 2rem); max-width: none; height: calc(100dvh - 2rem); max-height: calc(100dvh - 2rem); }
.conversation-drawer { margin: 0; width: min(20rem, calc(100% - 2rem)); height: 100dvh; max-height: 100dvh; border-radius: 0; }
/* Markdown supplements: structure only, with shared semantic colors. */
.sc-prose :is(h1,h2,h3,h4) { font-weight: 700; line-height: 1.3; margin-block: 1.5em .75em; }
.sc-prose h1 { font-size: 2em; }
.sc-prose h2 { font-size: 1.5em; }
.sc-prose h3 { font-size: 1.25em; }
.sc-prose :is(p,ul,ol,pre,table,blockquote) { margin-block: 1em; }
.sc-prose li + li { margin-top: .5em; }
.sc-prose strong { font-weight: 700; }
.sc-prose :not(pre) > code { padding: .15em .3em; background: var(--sc-canvas); border-radius: .25rem; }
.sc-prose pre { white-space: pre; max-width: 100%; }
.sc-prose blockquote { border-left: 3px solid var(--sc-control); padding-left: 1rem; color: var(--sc-muted); }
.sc-prose :is(td,th) { padding: .5rem; border-bottom: 1px solid var(--sc-line); text-align: left; }
.sc-prose hr { margin-block: 2rem; border-color: var(--sc-line); }
.message-content > :first-child { margin-top: 0; }
.message-content > :last-child { margin-bottom: 0; }
/* Tribute supplies its own DOM; keep suggestions in the current theme. */
.tribute-container { position: absolute; max-height: 200px; max-width: min(24rem, calc(100vw - 2rem)); overflow: auto; z-index: 1000; border: 1px solid var(--sc-control); border-radius: .5rem; background: var(--sc-surface); color: var(--sc-ink); }
.tribute-container ul { margin: 0; padding: .25rem; list-style: none; }
.tribute-container li { padding: .75rem; cursor: pointer; overflow-wrap: anywhere; }
.tribute-container li:hover, .tribute-container li.highlight { background: var(--sc-tint); color: var(--sc-brand-link); }
/* Diffy's .diff conflicts with DaisyUI's image comparison component. Scope the adapter. */
.sc-diff .diff { display: block; position: static; aspect-ratio: auto; overflow: auto; }
.sc-diff .diff ul { margin: 0; padding: 0; list-style: none; }
.sc-diff .diff li { padding: .25rem .75rem; }
.sc-diff .diff :is(del,ins,span) { white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font-mono); }
.sc-diff .diff li.ins { background: var(--sc-success-soft); color: var(--sc-success); }
.sc-diff .diff li.del { background: var(--sc-danger-soft); color: var(--sc-danger); }
.sc-diff .diff li.diff-comment { display: none; }
.sc-diff .diff li.diff-block-info { background: var(--sc-tint); color: var(--sc-muted); }
@media (max-width: 767px) {
 .app-navigation { padding: .5rem; }
 .app-navigation .primary-links { order: 3; flex-basis: 100%; overflow-x: auto; }
 .app-navigation .menu-horizontal { flex-wrap: nowrap; }
 .app-navigation .menu-horizontal a { min-height: 44px; padding-inline: .75rem; }
 .app-navigation .account-links { flex-wrap: wrap; }
 .brand-lockup { width: 156px; }
 .chat-image { display: none; }
 .chat { grid-template-columns: minmax(0, 1fr); }
 .chat > :is(.chat-header, .chat-bubble, .chat-footer) { grid-column: 1; }
}
