/* Dialog visuals from video-agent.css and image-workbench.css; mobile only changes fit. */
.agent-dialog.agent-run-card {
  display: block; max-width: 980px; min-width: 0; padding: 0; overflow: hidden;
  border: 1px solid #d7e7fa; border-radius: 15px;
  background: rgba(255,255,255,.94); box-shadow: 0 12px 30px rgba(36,76,138,.08);
}
.agent-dialog .agent-run-head { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:14px 16px 10px; }
.agent-dialog .agent-run-title { display:flex; align-items:center; gap:9px; color:#123c7e; font-size:15px; font-weight:800; }
.agent-dialog .agent-run-state { flex:0 0 auto; padding:3px 8px; border-radius:999px; color:#9a6a09; background:#fff3cf; font-size:10px; font-weight:800; }
.agent-dialog .agent-run-copy { margin:0 16px 13px; padding:11px 12px; border:1px solid #dce9f9; border-radius:10px; color:#4d6b97; background:#f7faff; font-size:12px; line-height:1.6; white-space:pre-wrap; overflow-wrap:anywhere; }
.agent-dialog .run-node-list { display:grid; gap:5px; padding:0 16px 12px; }
.agent-dialog .run-node { display:grid; grid-template-columns:26px minmax(110px,.45fr) minmax(0,1fr) 42px; align-items:center; gap:9px; min-height:39px; padding:6px 10px; border:0; border-radius:10px; color:#6782a9; background:#f3f7fd; font-size:11px; }
.agent-dialog .run-node strong { color:#17437d; }
.agent-dialog .run-node > span:not(.run-node-marker):not(.run-node-progress) { white-space:pre-wrap; overflow-wrap:anywhere; }
.agent-dialog .run-node-marker { display:grid; width:25px; height:25px; place-items:center; border-radius:50%; color:#fff; background:#8bb7ef; font-weight:800; }
.agent-dialog .run-node.is-running .run-node-marker { background:#0868df; }
.agent-dialog .run-node.is-done .run-node-marker { background:#18ad83; }
.agent-dialog .run-node.is-failed .run-node-marker { background:#df5260; }
.agent-dialog .run-node.is-uncertain .run-node-marker { background:#c58b31; }
.agent-dialog .run-node-progress { color:#2264bd; font-weight:800; text-align:right; }
.agent-dialog .run-actions { display:flex; flex-wrap:wrap; align-items:center; gap:9px; margin:0; padding:11px 15px 14px; }
.agent-dialog .run-actions button,.agent-dialog > button { min-height:37px; padding:0 17px; border:1px solid #cfe0f8; border-radius:9px; background:#fff; color:#1a579f; font-family:inherit; font-size:12px; font-weight:760; cursor:pointer; }
.agent-dialog .run-actions .primary-run-action { background:#0868df; border-color:#0868df; color:#fff; }
.agent-dialog button:disabled { opacity:.55; cursor:default; }
.agent-dialog .run-result { margin:0 16px 12px; padding:10px; border:1px solid #cfe3fb; border-radius:12px; background:#f7fbff; }
.agent-dialog .run-result video { width:100%; max-height:180px; border-radius:9px; background:#10213a; }
.agent-dialog .run-result-meta { display:grid; gap:4px; color:#6984aa; font-size:11px; }
.agent-dialog .run-result-meta strong { color:#143f7d; font-size:13px; }
.agent-dialog.desktop-case-flow:has(.desktop-case-head) { padding:16px; }
.agent-dialog.desktop-case-flow .desktop-case-head { padding:0; }
.agent-dialog.desktop-case-flow .desktop-case-status { margin:10px 0; }
.agent-dialog.desktop-case-flow .desktop-case-note { color:#5a7ba8; font-size:12px; line-height:1.65; }
.agent-dialog.desktop-case-flow:has(.desktop-case-head) .run-node-list { display:none; }

#chatMessages { --iw-primary:#0b6fff; --iw-primary-strong:#0868df; }
#chatMessages .message-row { display:grid; grid-template-columns:40px minmax(0,1fr); gap:10px; align-items:start; }
#chatMessages .user-row.message-row { grid-template-columns:minmax(0,1fr) 40px; }
#chatMessages .user-row.message-row .chat-avatar { grid-column:2; grid-row:1; }
#chatMessages .user-row.message-row .chat-content { grid-column:1; grid-row:1; align-items:flex-end; }
#chatMessages .chat-content { width:100%; max-width:100%; min-width:0; gap:0; }
#chatMessages .message-row .chat-avatar { width:40px; height:40px; background:transparent; }
#chatMessages .message-row .chat-avatar.is-user { background:#eaf3ff; }
#chatMessages .chat-avatar.is-assistant img { object-fit:contain; object-position:center; transform:none; border-radius:0; }
#chatMessages .message-row .message-bubble { max-width:100%; padding:11px 15px; border:1px solid rgba(214,230,251,.84); border-radius:14px; background:rgba(255,255,255,.78); color:#294d83; font-size:13px; line-height:1.65; white-space:pre-wrap; }
#chatMessages .user-row .message-bubble { border-color:#d2e6ff; border-top-right-radius:5px; background:#e7f2ff; color:#123f84; }
#chatMessages .agent-dialog { width:100%; }
#chatMessages .agent-dialog > video { display:block; width:calc(100% - 32px); max-width:none; max-height:180px; margin:0 16px 12px; }
#chatMessages .agent-dialog > :is(.mobile-replica-flow,.mobile-replica-slots,.mobile-replica-prompt,.video-job-recovery-direction) { margin:0 16px 12px; max-width:calc(100% - 32px); }
#chatMessages .agent-dialog > .depth-confirm { margin:0 16px 12px; max-width:calc(100% - 32px); }
#chatMessages .replica-slot-confirm-feedback { color:#46668f; font-size:12px; line-height:1.55; padding:10px 12px; border:1px solid #e0ebfa; border-radius:10px; background:#f8fbff; }

#chatMessages .iw-message { display:grid; grid-template-columns:42px minmax(0,1fr); gap:12px; max-width:920px; margin:0 auto 18px; }
#chatMessages .iw-message.is-user { grid-template-columns:minmax(0,1fr) 42px; }
#chatMessages .iw-message.is-user .iw-avatar { grid-column:2; }
#chatMessages .iw-message.is-user .iw-message-body { grid-column:1; grid-row:1; justify-self:end; max-width:75%; }
#chatMessages .iw-avatar { display:grid; width:42px; height:42px; place-items:center; overflow:hidden; border-radius:50%; background:var(--iw-primary); color:#fff; font-size:16px; font-style:italic; font-weight:900; }
#chatMessages .iw-avatar img { width:100%; height:100%; max-width:none; max-height:none; object-fit:cover; }
#chatMessages .iw-avatar.is-assistant { width:48px; height:48px; overflow:visible; background:transparent; }
#chatMessages .iw-avatar.is-assistant img { object-fit:contain; filter:drop-shadow(0 5px 10px rgba(11,111,255,.16)); }
#chatMessages .iw-message-body { min-width:0; display:block; }
#chatMessages .iw-bubble { width:fit-content; max-width:760px; padding:12px 16px; border:1px solid #e5edf9; border-radius:6px 16px 16px; background:#fff; color:#3f5e93; font-size:13px; line-height:1.7; white-space:pre-wrap; overflow-wrap:anywhere; }
#chatMessages .iw-message.is-user .iw-bubble { border-radius:16px 6px 16px 16px; background:#eaf3ff; color:#2b548d; }
#chatMessages .iw-message.is-error .iw-bubble { border-color:#f1cbd2; background:#fff8f9; color:#a53248; }
#chatMessages .iw-task-progress { width:min(540px,100%); height:5px; margin-top:8px; overflow:hidden; border-radius:4px; background:#e7effa; }
#chatMessages .iw-task-progress span { display:block; width:42%; height:100%; border-radius:inherit; background:var(--iw-primary); animation:dialog-image-progress 1.2s ease-in-out infinite alternate; }
@keyframes dialog-image-progress { to { transform:translateX(130%); } }
#chatMessages .iw-result-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; width:min(660px,100%); margin-top:10px; }
#chatMessages .iw-result-card { position:relative; min-height:160px; padding:0; overflow:hidden; border:2px solid transparent; border-radius:10px; background:#eaf0f8; cursor:pointer; }
#chatMessages .iw-result-card img { display:block; width:100%; height:auto; min-height:160px; max-width:none; max-height:520px; object-fit:contain; background:#edf3fb; }
#chatMessages .iw-result-card.is-active { border-color:var(--iw-primary); }
#chatMessages .iw-result-card span { position:absolute; right:8px; bottom:8px; padding:4px 7px; border-radius:7px; background:rgba(12,31,61,.72); color:#fff; font-size:10px; font-weight:700; }
#chatMessages .iw-result-hint { width:min(660px,100%); margin:7px 0 0; color:#7185a4; font-size:12px; line-height:1.5; }
#chatMessages .iw-result-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
#chatMessages .iw-action-button { display:inline-flex; min-height:38px; padding:0 15px; align-items:center; gap:6px; border:1px solid #cfe0f7; border-radius:10px; background:#fff; color:#315b95; font-family:inherit; font-size:12px; font-weight:800; }
#chatMessages .iw-action-button img { width:19px; height:19px; flex:0 0 auto; object-fit:contain; }
#chatMessages .iw-action-button.is-primary { border-color:#a9cbff; color:var(--iw-primary-strong); }
@media (max-width:720px) {
  #chatMessages .iw-message { grid-template-columns:34px minmax(0,1fr); gap:8px; }
  #chatMessages .iw-message.is-user { grid-template-columns:minmax(0,1fr) 34px; }
  #chatMessages .iw-avatar { width:34px; height:34px; }
  #chatMessages .iw-avatar.is-assistant { width:36px; height:36px; }
  #chatMessages .iw-bubble { max-width:100%; }
  .agent-dialog .run-node { grid-template-columns:26px minmax(0,1fr) 42px; }
  .agent-dialog .run-node > span:not(.run-node-marker):not(.run-node-progress) { grid-column:2; grid-row:2; }
  .agent-dialog .run-node-progress { grid-column:3; grid-row:1; }
}
#chatMessages .iw-bubble .iw-task-capacity { display:block; width:fit-content; margin-top:8px; padding:2px 9px; border:1px solid #cfe0f8; border-radius:999px; background:#f3f8ff; color:#3970b8; font-size:10px; font-weight:800; white-space:nowrap; }
.mobile-receipt-status{margin:8px 14px;padding:10px 12px;border:1px solid #dbe6f7;border-radius:12px;background:#f7faff;color:#38537f;font-size:12px;line-height:1.6;overflow-wrap:anywhere;white-space:normal}
.mobile-receipt-status[hidden]{display:none}
.mobile-receipt-status button{margin:4px 0 0 8px;padding:4px 10px;border:1px solid #caddff;border-radius:8px;background:#fff;color:#1768df;font:inherit;cursor:pointer}
