.portal-topic-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--portal-line, #e5e7eb);
  background: #fff;
}

.portal-topic-panel-head strong { font-size: 13px; }
.portal-topic-panel-head span { font-size: 11px; color: var(--portal-muted, #64748b); }
.portal-topic-panel-actions { display: inline-flex; align-items: center; gap: 8px; }
.portal-new-topic-btn { width: 32px; height: 32px; }
.portal-topic-list-item { grid-template-columns: 30px minmax(0, 1fr) auto; }
.portal-topic-icon { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; background: #f1f5f9; color: #475569; }
.portal-topic-icon svg { width: 15px; height: 15px; }
.portal-topic-switch { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--portal-line, #e5e7eb); background: #fff; }
.portal-topic-switch label, .portal-topic-status { font-size: 12px; color: var(--portal-muted, #64748b); }
.portal-topic-switch select { min-width: 0; height: 36px; padding-top: 4px; padding-bottom: 4px; font-size: 13px; }
.portal-client-context-strip { justify-content: space-between; }
.portal-topic-separator { display: flex; align-items: baseline; gap: 8px; margin: 14px 0 8px; padding: 0 4px; color: #64748b; }
.portal-topic-separator::before { content: ""; width: 18px; border-top: 1px solid #dbe1e8; }
.portal-topic-separator span { font-size: 12px; font-weight: 700; color: #172033; }
.portal-topic-separator small { font-size: 11px; }
.portal-composer-context { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-bottom: 0; font-size: 12px; color: #64748b; }
.portal-composer-context strong { color: #172033; }
.portal-composer-row { display: grid; grid-template-columns: minmax(0, 1fr) 42px auto; align-items: end; gap: 8px; }
.portal-conversation-composer .portal-composer-row textarea { height: 42px; min-height: 42px; max-height: 102px; resize: none; overflow-y: hidden; padding-top: 10px; padding-bottom: 10px; line-height: 20px; }
.portal-attach-button.portal-attach-icon { width: 42px; height: 42px; padding: 0; justify-content: center; border-radius: 9px; }
.portal-attach-button.portal-attach-icon svg { width: 16px; height: 16px; }
.portal-send-button { min-height: 42px; gap: 6px; padding: 9px 13px; }
.portal-send-button svg { width: 15px; height: 15px; }
.portal-conversation-composer .portal-upload-status { display: flex; flex-wrap: wrap; gap: 4px; }
.portal-conversation-composer .portal-upload-status span { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 7px; border: 1px solid var(--portal-line, #e5e7eb); border-radius: 999px; background: #f8fafc; }
.portal-reply-disabled { gap: 6px; }
.portal-resolved-reply-state { min-height: 42px; display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid #d7dee8; border-radius: 9px; background: #f8fafc; color: #64748b; }
.portal-resolved-reply-state > svg { width: 17px; height: 17px; flex: 0 0 auto; color: #475569; }
.portal-resolved-reply-state > div { min-width: 0; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.portal-resolved-reply-state strong { color: #172033; font-size: 12px; }
.portal-resolved-reply-state span { font-size: 11.5px; }
.portal-client-conversation .portal-conversation-message-stream { scroll-behavior: smooth; }
.portal-new-topic-context-pills { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.portal-new-topic-context-pills[hidden] { display: none; }
.portal-context-pill { display: inline-flex; align-items: center; min-width: 0; max-width: 100%; gap: 7px; padding: 6px 9px; border: 1px solid #bfdbfe; border-radius: 999px; background: #eff6ff; color: #1e40af; font-size: 11.5px; line-height: 1.2; }
.portal-context-pill-kind { flex: 0 0 auto; font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; opacity: .72; }
.portal-context-pill strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; }
.portal-conversation-dialog.contextual-topic-dialog { width: min(520px, calc(100vw - 28px)); max-height: min(82vh, 650px); }
.contextual-topic-dialog .portal-conversation-dialog-head { align-items: center; padding: 12px 14px; }
.contextual-topic-dialog .portal-conversation-dialog-head > div { gap: 0; }
.contextual-topic-dialog .portal-conversation-dialog-head strong { font-size: 15px; }
.contextual-topic-dialog .portal-conversation-dialog-head span { display: none; }
.contextual-topic-dialog .portal-form { gap: 10px; padding: 12px 14px 14px; }
.contextual-topic-dialog .portal-form label { gap: 4px; }
.contextual-topic-dialog [data-new-topic-context-fields], .contextual-topic-dialog [data-context-field] { display: none !important; }
.contextual-topic-dialog .portal-control { min-height: 38px; }
.contextual-topic-dialog [data-new-topic-message] textarea { min-height: 104px; max-height: 150px; resize: vertical; }
.contextual-topic-dialog [data-new-topic-attachments] small { display: none; }
.contextual-topic-dialog .portal-conversation-dialog-actions { margin-top: 2px; }

.conversation-activity-card { width: min(560px, calc(100% - 10px)); margin: 9px auto; display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 10px; padding: 11px; border: 1px solid #dbe3ee; border-radius: 11px; background: #fff; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.conversation-activity-icon { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; background: #f1f5f9; color: #334155; }
.conversation-activity-icon svg { width: 18px; height: 18px; }
.conversation-activity-copy { min-width: 0; display: grid; gap: 4px; }
.conversation-activity-copy > strong { color: #172033; font-size: 13px; }
.conversation-activity-copy p { margin: 0; color: #64748b; font-size: 12px; line-height: 1.45; white-space: pre-line; }
.conversation-activity-meta, .conversation-activity-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.conversation-activity-meta { color: #94a3b8; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.conversation-activity-status { display: inline-flex; align-items: center; min-height: 22px; padding: 3px 7px; border-radius: 999px; background: #f1f5f9; color: #475569; font-size: 10.5px; font-weight: 700; }
.conversation-activity-footer a { display: inline-flex; align-items: center; gap: 4px; color: #2563eb; font-size: 11px; font-weight: 700; text-decoration: none; }
.conversation-activity-footer a svg { width: 13px; height: 13px; }
.chat-file-cards { display: grid; gap: 6px; margin-top: 8px; }
.chat-file-card { min-width: min(340px, 100%); display: grid !important; grid-template-columns: 30px minmax(0, 1fr) 16px; align-items: center; gap: 8px; padding: 8px 9px !important; border: 1px solid #dbe3ee !important; border-radius: 9px !important; background: #fff !important; color: #172033 !important; text-decoration: none; }
.chat-file-card-icon { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; background: #f1f5f9; color: #475569; }
.chat-file-card-icon svg, .chat-file-card > svg { width: 14px; height: 14px; }
.chat-file-card-copy { min-width: 0; display: grid; gap: 1px; }
.chat-file-card-copy strong, .chat-file-card-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-file-card-copy strong { font-size: 11.5px; }
.chat-file-card-copy small { color: #64748b; font-size: 10px; font-weight: 500; }

@media (max-width: 760px) {
  .portal-topic-switch { grid-template-columns: 1fr auto; }
  .portal-topic-switch label { grid-column: 1 / -1; }
  .portal-composer-row { grid-template-columns: minmax(0, 1fr) 40px auto; gap: 6px; }
  .portal-attach-button.portal-attach-icon { width: 40px; height: 40px; }
  .portal-send-button { min-height: 40px; padding-inline: 11px; }
  .conversation-activity-card { width: 100%; }
}

@media (max-width: 420px) {
  .portal-send-button span { display: none; }
  .portal-send-button { width: 40px; padding: 0; }
  .portal-conversation-dialog.contextual-topic-dialog { width: calc(100vw - 16px); max-height: calc(100vh - 16px); }
}

@media (prefers-reduced-motion: reduce) {
  .portal-client-conversation .portal-conversation-message-stream { scroll-behavior: auto; }
}
