/* Message history and stable streaming content. */
.load-older { display: block; margin: 18px auto; padding: 9px 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--muted); font-size: 12px; }
.load-older:hover { border-color: var(--accent); color: var(--accent); }
.turn[data-active="false"] { content-visibility: auto; contain-intrinsic-size: auto 240px; }
.streaming-text { white-space: pre-wrap; }
.text-segment:empty { display: none; }
.user-message:has(.attachment-gallery:not(:empty)) { min-width: 180px; }
.user-message > div:empty { display: none; }

/* Uploads and returned media share the same theme surfaces. */
.composer.drag-over { border: 1px dashed var(--accent); box-shadow: 0 0 0 6px var(--accent-soft); }
.attach-file { width: 32px; height: 32px; flex: none; }
.draft-attachments { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; padding: 4px 18px 10px; }
.draft-attachment { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-alt); }
.draft-thumbnail { flex: none; width: 42px; height: 42px; padding: 0; overflow: hidden; border-radius: 7px; }
.draft-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.draft-file-icon { display: grid; place-items: center; width: 36px; height: 38px; flex: none; color: var(--accent); font-size: 23px; }
.draft-attachment-info { min-width: 0; flex: 1; }
.draft-attachment-info b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 500; }
.draft-attachment-info small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.draft-attachment.failed { border-color: var(--danger); }
.draft-attachment.failed small { color: var(--danger); }
.draft-attachment button { color: var(--muted); font-size: 12px; flex-shrink: 0; }
.draft-attachment .remove-attachment { width: 25px; height: 30px; border-radius: 7px; font-size: 19px; }
.remove-attachment:hover { color: var(--danger); background: var(--surface-hover); }
.attachment-gallery { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.attachment-gallery:empty { display: none; }
.attachment-card { display: flex; flex-direction: column; gap: 5px; max-width: 280px; min-width: 120px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); line-height: 1.5; }
.attachment-card > small { color: var(--muted); font-size: 10px; }
.attachment-card .attachment-warning { color: var(--warning-text); }
.attachment-name { overflow-wrap: anywhere; font-size: 12px; text-decoration: none; }
a.attachment-name:hover { text-decoration: underline; }
.image-preview { display: grid; place-items: center; min-height: 80px; max-width: 260px; min-width: 120px; padding: 0; overflow: hidden; border-radius: 8px; background: var(--surface-alt); color: var(--muted); font-size: 12px; }
.image-preview img { display: block; width: 100%; max-height: 200px; object-fit: contain; }
.media-dialog { width: min(1100px,calc(100vw - 32px)); padding: 18px; }
.media-dialog > .icon-button { margin-left: auto; }
.media-dialog figure { margin: 0; text-align: center; }
.media-dialog img { max-width: 100%; max-height: 75dvh; object-fit: contain; border-radius: 10px; }
.media-dialog figcaption { margin-top: 12px; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }

/* Decisions stay attached to the turn; the composer only links to pending work. */
.approval-card { margin: 16px 0; border: 1px solid var(--line-strong); border-radius: 15px; background: var(--surface); overflow: hidden; }
.approval-card > summary { display: flex; align-items: center; gap: 9px; list-style: none; padding: 13px 15px; }
.approval-card > summary b { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.approval-mark { color: var(--accent); }
.approval-status { margin-left: auto; flex-shrink: 0; font-size: 11px; color: var(--muted); }
.approval-card[data-status="pending"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.approval-card[data-status="pending"] .approval-status { color: var(--accent); }
.approval-card[data-decision="decline"] .approval-mark,.approval-card[data-decision="decline"] .approval-status { color: var(--danger); }
.approval-body { padding: 0 15px 15px; }
.approval-body p { font-size: 13px; margin: 0 0 10px; line-height: 1.8; }
.approval-details { color: var(--muted); font-size: 12px; }
.approval-details pre { max-height: 240px; }
.approval-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.approval-actions button { padding: 9px 13px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface-alt); font-size: 12px; }
.approval-actions button:first-child { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.approval-actions button[data-decision="decline"] { color: var(--danger); }
.approval-result { display: block; margin-top: 12px; color: var(--muted); font-size: 11px; }
.approval-action-result { margin-top: 10px !important; color: var(--muted); font-size: 11px !important; }
.approval-action-result:empty { display: none; }
.approval:has(.approval-jump) { border-radius: 12px; padding: 0; }
.approval-jump { width: 100%; padding: 11px 15px; color: var(--accent); text-align: left; font-size: 12px; }
@media(max-width:600px) {
  .draft-attachments { grid-template-columns: minmax(0,1fr); padding-left: 12px; padding-right: 12px; }
  .composer-toolbar { gap: 7px; }
  .device-picker { max-width: 190px; }
  .attachment-card { max-width: 100%; }
  .approval-actions button { flex: 1 1 auto; }
}
.steer-message { display: grid; justify-items: end; gap: 7px; margin: 24px 0; }
.steer-message .user-message { margin: 0; max-width: min(90%, 680px); }
.steer-status { color: var(--muted); font-size: 11px; padding-inline: 4px; }
.steer-message[data-status="pending"] .steer-status { color: var(--accent); }
.steer-message[data-status="retry"] .steer-status { color: var(--danger); }
