.chat-surface {
  --ink:#263947;
  --muted:#5e707d;
  --line:#d4e2eb;
  --green:#176d99;
  --green-soft:#e7f4fc;
  color:var(--ink);
}
.chat-surface .primary {background:#c5eaff;color:#164f70;border-color:#87c4e0;}
.chat-surface input[type=checkbox] {accent-color:#176d99;}
.chat-surface :is(button,input,textarea,select):focus-visible {outline-color:#176d99;}
.chat-surface .ai-disclosure {background:#f2f8fc;}
.chat-surface .messages {
  background:#eaf5fc;
  padding:24px 20px;
  gap:22px;
  height:360px;
  scrollbar-gutter:stable;
}
.chat-surface .message {
  display:flex;
  align-items:flex-start;
  gap:9px;
  max-width:88%;
  min-width:0;
  padding:0;
  border:0;
  background:none;
  white-space:normal;
  font-size:16px;
  line-height:1.8;
}
.chat-surface .message.user {align-self:flex-end;}
.chat-surface .message.assistant {align-self:flex-start;}
.message-avatar {
  display:grid;
  place-items:center;
  flex:0 0 32px;
  height:32px;
  margin-top:23px;
  border-radius:50%;
  background:#176d99;
  color:#fff;
  font-size:12px;
  font-weight:700;
}
.message-body {min-width:0;}
.company-research-sources,.company-research-status {font-size:13px;line-height:1.7;overflow-wrap:anywhere;margin:12px 0 0;}
.company-research-sources summary {cursor:pointer;color:#176d99;}
.company-research-sources p {margin:8px 0;}
.company-research-sources ul {padding-left:20px;margin:8px 0;}
.company-research-sources li {margin:8px 0;}
.company-research-sources a {color:#155879;text-decoration:underline;}
.research-task {margin-top:12px;padding:12px 0;border-block:1px solid #b6cbd9;overflow-wrap:anywhere;}
.research-task>a {display:inline-block;color:#155879;text-decoration:underline;font-weight:700;padding-block:6px;}
.research-task dl {margin:8px 0 0;}
.research-task dt {font-size:13px;font-weight:700;color:#435764;}
.research-task dd {margin:4px 0 12px;white-space:pre-wrap;}
.research-task dd:last-child {margin-bottom:0;}
.chat-surface .message-label {color:#435764;font-size:12px;margin:0 0 6px;line-height:1.4;}
.chat-surface .message.user .message-label {text-align:right;}
.message-bubble {
  position:relative;
  margin:0;
  padding:12px 16px;
  border-radius:16px;
  background:#fff;
  color:#263947;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
}
.message-bubble::before {
  content:"";
  position:absolute;
  top:0;
  left:-6px;
  width:15px;
  height:14px;
  border-radius:0 0 0 14px;
  background:inherit;
}
.message.user .message-bubble {background:#c5eaff;}
.message.user .message-bubble::before {left:auto;right:-6px;border-radius:0 0 14px 0;}
.chat-surface .chat-symbol {border-radius:50%;background:#e7f4fc;color:#176d99;}
.chat-surface .chat-composer {
  display:flex;
  align-items:flex-end;
  gap:10px;
  padding:14px 16px;
  border-top:1px solid #d4e2eb;
  background:#fff;
}
#chat-form {padding:0;border:0;}
#chat-form textarea,#company-chat-form textarea {
  flex:1;
  min-width:0;
  min-height:66px;
  max-height:160px;
  border:1px solid #b6cbd9;
  border-radius:8px;
  background:#f7fbfe;
  font-size:16px;
  line-height:1.5;
}
.chat-composer .icon-button {border-radius:50%;margin-bottom:1px;}
.chat-surface .chat-actions {margin:0;padding:0 16px 10px;flex-wrap:wrap;}
.chat-surface .chat-actions .secondary {font-size:14px;}
#chat-status {overflow-wrap:anywhere;}
#talk-panel .messages:focus-visible,#company-dialogue #company-messages:focus-visible {outline:3px solid #176d99;outline-offset:-3px;}
#company-dialogue {padding:20px;overflow:hidden;}
#company-dialogue>header .badge {white-space:normal;}
#company-dialogue #company-messages,
#company-dialogue[data-chat-state=conversation] #company-messages {
  height:360px;
  min-height:220px;
  margin:16px -20px 0;
}
#company-chat-form {margin:0 -20px;}
#company-dialogue #company-chat-status {margin:10px 0 0;font-size:13px;}
#company-dialogue #company-chat-summary {align-self:flex-start;margin:12px 0 0;max-width:100%;white-space:normal;}
.image-suggestion {margin-top:12px;padding-top:12px;border-top:1px solid #b6cbd9;overflow-wrap:anywhere;}
.image-suggestion strong {font-size:16px;}
.image-suggestion p {font-size:14px;line-height:1.8;margin:8px 0;white-space:pre-wrap;}
.image-suggestion button {white-space:normal;max-width:100%;}
.image-dialog {max-width:600px;max-height:calc(100dvh - 32px);overflow:auto;}
.image-dialog h2 {font-size:22px;margin:0 0 20px;}
.image-dialog label {margin:16px 0;}
.image-dialog textarea {font-size:16px;}
.image-dialog .button-row {flex-wrap:wrap;}
#image-status {min-height:24px;overflow-wrap:anywhere;}
.image-preview-dialog {max-width:1000px;max-height:calc(100dvh - 32px);overflow:auto;}
#image-preview-content img {display:block;width:100%;max-height:70dvh;object-fit:contain;}
.generated-images {border-top:1px solid #d4e2eb;margin-top:20px;padding-top:16px;}
.generated-images h3 {font-size:17px;margin:0 0 16px;}
.generated-image-grid {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,240px),1fr));gap:16px;}
.generated-image-item {border:1px solid #b6cbd9;border-radius:8px;overflow:hidden;min-width:0;background:#fff;}
.generated-image-preview {aspect-ratio:3/2;display:grid;place-items:center;background:#f2f8fc;position:relative;overflow:hidden;}
.generated-image-preview img {display:block;position:absolute;inset:0;width:100%;height:100%;object-fit:contain;}
.generated-image-preview p {font-size:14px;padding:16px;}
.generated-image-heading {display:grid;gap:6px;padding:12px;overflow-wrap:anywhere;}
.generated-image-heading strong {font-size:16px;}
.generated-image-heading span {font-size:12px;color:#5e707d;}
.generated-image-actions {display:flex;flex-wrap:wrap;gap:8px;padding:0 12px 12px;}
.generated-image-actions button {white-space:normal;font-size:14px;}
.generated-image-item>.error {padding:0 12px;overflow-wrap:anywhere;}
#company-dialogue>.image-create,#talk-panel>.image-create {align-self:flex-start;margin:12px 0;white-space:normal;}
@media(max-width:700px) {
  .chat-surface .messages {padding:20px 12px;height:min(360px,42dvh);min-height:220px;}
  .chat-surface .message {max-width:92%;gap:8px;}
  .message-avatar {flex-basis:28px;height:28px;font-size:11px;}
  .message-bubble {padding:10px 12px;}
  .chat-surface .chat-composer {padding:12px;gap:8px;}
  #company-dialogue {padding:16px;}
  #company-dialogue #company-messages,
  #company-dialogue[data-chat-state=conversation] #company-messages {height:min(360px,42dvh);margin-inline:-16px;}
  #company-chat-form {margin-inline:-16px;}
  .image-dialog {padding:20px;}
}
