/* Conversation deliveries use one card; media keeps its own proportions. */
.frame .chat .delivery-package {
  width: min(100%, 660px); max-width: 660px; padding: 16px; margin-top: 10px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel-surface);
  box-shadow: 0 2px 8px #182b2110;
}
.frame .chat .msg:not(.me):has(> .message-body > .delivery-package) > .message-body {
  flex: 1 1 auto; width: 100%; max-width: 660px;
}
.delivery-package .chat-round-head { gap: 10px; margin: 0 0 14px; color: var(--ink); }
.delivery-package .chat-round-head b { font-size: 12px; font-weight: 600; }
.delivery-package .chat-round-head time { font-size: 10px; }
.delivery-package .chat-round-head .state-text {
  padding: 2px 7px; border-radius: 5px; background: var(--badge-surface); font-size: 10px;
}
.delivery-package .chat-round-head .state-text::before { display: none; }
.delivery-package .delivery-layout { display: grid; gap: 16px; min-width: 0; }
.delivery-feature, .delivery-related { min-width: 0; }
.delivery-related { display: flex; flex-direction: column; }
.frame .delivery-package .media-result { margin: 0; border: 0; border-radius: 0; background: transparent; overflow: visible; }
.frame .delivery-package .delivery-feature .media-result { display: flex; flex-direction: column; gap: 9px; }
.frame .delivery-package .artifact {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px;
  margin: 0; padding: 11px 0; border: 0; border-bottom: 1px solid var(--line);
  border-radius: 0; background: transparent;
}
.frame .delivery-package .delivery-feature .artifact { padding: 0; border: 0; }
.delivery-package .file-name { min-width: 0; flex: 1 1 110px; }
.delivery-package .file-title { color: var(--ink); font-size: 12px; text-decoration: none; font-weight: 500; }
.delivery-package .file-title:hover { color: var(--accent); text-decoration: underline; }
.delivery-package .file-name .quiet { font-size: 10px; margin-top: 2px; color: var(--muted); }
.delivery-package .file-actions { gap: 10px; margin: 0; }
.delivery-package .file-actions a { padding: 3px 0; min-height: 25px; font-size: 11px; color: var(--accent); }
.delivery-package .delivery-media-stage { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-width: 0; border-radius: 8px; overflow: hidden; }
.frame .delivery-package .delivery-video {
  display: block; width: auto; height: auto; max-width: 100%; max-height: min(340px, 40dvh);
  margin: 0; border-radius: 8px; object-fit: contain; background: #080d12;
}
.frame .delivery-package .delivery-image { width: auto; max-width: 100%; padding: 0; border-radius: 8px; background: transparent; }
.frame .delivery-package .delivery-image img { display: block; width: auto; height: auto; max-width: 100%; max-height: min(340px, 40dvh); object-fit: contain; }
.delivery-package .delivery-media-stage .inline-html { width: 100%; }
.frame .delivery-package .delivery-audio { width: 100%; margin: 8px 0; }
.delivery-related-label { display: flex; gap: 7px; align-items: center; color: var(--muted); font-size: 11px; padding: 1px 0 4px; }
.delivery-related-label span { font-size: 10px; }
.delivery-file-list { min-width: 0; }
.delivery-package .process-attachments { margin-top: 11px; }
.delivery-package .delivery-missing { color: var(--warning); font-size: 11px; line-height: 1.6; margin: 12px 0 0; }
.delivery-package .round-footer.actions { margin-top: auto; padding: 16px 0 0; border: 0; gap: 8px; flex-wrap: wrap; }
.delivery-package .round-footer button { min-height: 32px; padding: 6px 10px; border-radius: 6px; font-size: 11px; }
.delivery-package .round-footer [data-action="round-explanation"] { color: var(--muted); border-color: transparent; background: transparent; padding-left: 0; }
.delivery-package .round-footer [data-action="review-round"] { margin-left: auto; }
.frame .chat .msg:has(> .message-body > .delivery-package) > .message-body > .bubble {
  max-width: 660px; min-height: 0; padding: 0; border: 0; background: transparent;
}
.frame .chat .msg:has(> .message-body > .delivery-package) > .message-body > .bubble::before { display: none; }
.delivery-message-note { font-size: 12px; color: var(--text-secondary); }
.delivery-message-note > summary { display: flex; align-items: baseline; gap: 12px; list-style: none; cursor: pointer; line-height: 1.7; }
.delivery-message-note > summary::-webkit-details-marker { display: none; }
.delivery-message-note > summary > span:first-child { min-width: 0; }
.delivery-note-toggle { flex: none; color: var(--muted); font-size: 10px; white-space: nowrap; }
.delivery-note-toggle::after { content: '⌄'; display: inline-block; margin-left: 5px; }
.delivery-message-note[open] .delivery-note-toggle::after { transform: rotate(180deg); }
.delivery-note-body { margin-top: 8px; padding: 10px 12px; border-radius: 6px; background: var(--quote-surface); font-size: 12px; line-height: 1.8; }
.delivery-message-note .delivery-note-body p { margin: 0; }
.delivery-message-note > summary:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 3px; border-radius: 3px; }
/* Files share one row shape; optional content opens in the document flow. */
.delivery-package.delivery-surface { width: min(100%, 660px); max-width: 660px; min-width: 0; }
.chat .delivery-package.delivery-surface .delivery-layout,
.chat .delivery-package.delivery-surface .delivery-layout.has-feature,
.delivery-package.delivery-surface .delivery-layout { display: flex; flex-direction: column; gap: 12px; }
.delivery-surface .delivery-file-list:empty { display: none; }
.delivery-package.delivery-surface .media-result { margin: 0; border: 0; border-radius: 0; background: transparent; overflow: visible; }
.delivery-package.delivery-surface .delivery-feature .media-result { display: flex; flex-direction: column; gap: 9px; }
.delivery-package.delivery-surface .artifact,
.frame .delivery-surface .delivery-feature .artifact { min-height: 58px; margin: 0; padding: 10px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
.delivery-package.delivery-surface .delivery-video,
.delivery-package.delivery-surface .delivery-image img { display: block; width: auto; height: auto; max-width: 100%; max-height: min(340px, 40dvh); object-fit: contain; }
.delivery-package.delivery-surface .delivery-image { width: auto; max-width: 100%; padding: 0; background: transparent; }
.delivery-package.delivery-surface .delivery-audio { width: 100%; margin: 8px 0; }
.delivery-surface .file-name { flex: 1 1 150px; min-width: 0; }
.delivery-surface .file-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.delivery-surface .file-actions { flex: 0 0 auto; margin-left: auto; }
.delivery-surface .file-actions a { white-space: nowrap; }
.delivery-surface .delivery-file-summary,
.delivery-surface .delivery-more-files,
.delivery-surface .process-attachments { margin: 7px 0 0; font-size: 11px; }
.delivery-surface :is(.delivery-file-summary,.delivery-more-files,.process-attachments) > summary {
  cursor: pointer; color: var(--muted); padding: 4px 0; line-height: 1.7;
}
.delivery-surface :is(.delivery-file-summary,.delivery-more-files,.process-attachments) > summary:focus-visible {
  outline: 2px solid var(--focus-ring); outline-offset: 3px; border-radius: 3px;
}
.delivery-surface .artifact-card-preview { margin-top: 5px; border-radius: 6px; }
.delivery-surface .round-footer.actions { margin-top: 12px; padding-top: 0; }
@media(max-width:760px) {
  .frame .chat .delivery-package { padding: 12px; }
  .delivery-package .chat-round-head { gap: 7px; }
  .frame .chat .delivery-package .delivery-video, .frame .delivery-package .delivery-image img { max-height: 275px; }
  .delivery-package .file-actions { gap: 12px; }
  .delivery-package .file-actions a { min-height: 30px; }
  .delivery-package .round-footer button { min-height: 36px; }
  .delivery-message-note > summary { gap: 8px; flex-wrap: wrap; }
}
@media(max-width:520px) {
  .delivery-package .delivery-feature .media-result { align-items: stretch; }
  .delivery-package .delivery-media-stage { background: var(--quote-surface); padding: 10px; }
  .delivery-package .round-footer.actions { padding-top: 12px; }
}
@media(max-width:420px) {
  .delivery-surface .file-name { flex-basis: 100%; }
  .delivery-surface .file-actions { gap: 14px; }
}
