/* Delivery width comes from the conversation lane, never from a short bubble. */
.frame .chat .msg:not(.me):has(> .message-body > .delivery-surface) {
  width: 100%;
  max-width: calc(1100px + var(--chat-author-width, 46px));
}
.frame .chat .msg:not(.me):has(> .message-body > .delivery-surface) > .message-body {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  max-width: none;
}
.frame .delivery-package.delivery-surface,
.frame .chat .message-body > .delivery-surface,
.frame .chat .delivery-package.delivery-surface {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  max-width: 1100px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
  container: delivery-card / inline-size;
  --delivery-stage-height: clamp(280px, 46dvh, 520px);
}
/* Delivered private work keeps more room for results; typed drafts still grow. */
.frame:not(.group-frame):has(.chat .delivery-surface) .composer { --wechat-input-min: 64px; }

/* Private and task deliveries use the same compact header and last action row. */
.frame .chat .delivery-package.delivery-surface,
.frame .delivery-package.delivery-surface {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 12px;
}
.frame .delivery-package.delivery-surface > :not(.round-footer):not(.delivery-execution-details) {
  flex: 0 0 100%;
  width: 100%;
  min-width: 0;
}
.frame .delivery-package.delivery-surface > :is(.chat-round-head, .round-head) {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  min-height: 24px;
  margin: 0;
}
.frame .delivery-package.delivery-surface > :is(.chat-round-head, .round-head) :is(b, h3) {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 13px;
  line-height: 22px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.frame .delivery-package.delivery-surface > :is(.chat-round-head, .round-head) time { margin-left: auto; white-space: nowrap; }
.frame .delivery-package.delivery-surface > .round-status { margin: 0; font-size: 11px; line-height: 18px; }
.frame .delivery-package.delivery-surface > .round-footer.actions {
  order: 10;
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.frame .delivery-package.delivery-surface > .round-footer button { min-height: 26px; margin-block: 0; padding: 3px 7px; font-size: 11px; }
.frame .delivery-package.delivery-surface > .delivery-execution-details {
  order: 11;
  flex: 0 0 auto;
  min-width: 0;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  font-size: 11px;
}
.frame .delivery-package.delivery-surface > .delivery-execution-details[open] { flex-basis: 100%; margin-left: 0; }
.frame .delivery-package.delivery-surface > .delivery-execution-details > summary { min-height: 26px; }
.delivery-surface > .group-result-footer { align-items: center; }

/* A file has one header; switchable files share that header with their actions. */
.delivery-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  width: 100%;
  min-width: 0;
}
.delivery-stage-files {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: 3px 5px;
  min-width: 0;
}
.delivery-stage-choice { min-width: 0; }
.frame .delivery-stage-tab {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: none;
  height: 30px;
  min-height: 30px;
  padding: 3px 7px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 3px 3px 0 0;
  background: transparent;
  color: var(--ink, #39453e);
  font: inherit;
  font-size: 12px;
  line-height: 16px;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
.frame .delivery-stage-tab:hover { background: var(--row-hover, #edf1ed); }
.frame .delivery-stage-tab[aria-selected='true'] { border-bottom-color: var(--accent, #18765b); background: var(--accent-soft, #e7f2ec); color: var(--accent, #18765b); }
.delivery-stage-tab :is(strong, b, span) {
  display: block;
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  line-height: 18px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.delivery-stage-tab small {
  display: block;
  flex: none;
  max-width: min(90px, 45%);
  margin-top: 0;
  color: var(--muted, #78847f);
  font-size: 10px;
  line-height: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.delivery-stage-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  min-width: 0;
}
.delivery-stage.is-paired .delivery-stage-panels { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.delivery-stage-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.delivery-stage-filebar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 28px;
  padding: 1px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-secondary, #58665d);
  font-size: 12px;
  line-height: 18px;
}
.delivery-stage-filebar > strong {
  flex: 1 1 80px;
  min-width: 0;
  overflow: hidden;
  color: var(--ink, #39453e);
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.delivery-stage-filebar > small {
  flex: none;
  color: var(--muted, #78847f);
  font-size: 10px;
  white-space: nowrap;
}
.delivery-stage-filebar.has-chooser {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: start;
}
.delivery-stage-filebar.has-chooser > .delivery-stage-files { grid-column: 1; }
.delivery-stage-filebar.has-chooser > :is(button, a):last-child { grid-column: -2 / -1; }
.frame .delivery-stage-filebar > :is(button, a) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-height: 24px;
  padding: 1px 4px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--accent, #18765b);
  font: inherit;
  font-size: 11px;
  line-height: 18px;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}
.frame .delivery-stage-filebar > :is(button, a):hover { background: var(--file-hover, #eaf2ec); }
.delivery-stage-content {
  box-sizing: border-box;
  height: var(--delivery-stage-height, 300px);
  min-width: 0;
  min-height: 0;
  overflow: auto;
  border-radius: 0;
  background: transparent;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb, #c3cec6) transparent;
}
.delivery-stage-preview { position: relative; width: 100%; height: 100%; min-width: 0; min-height: 0; }
.delivery-stage-preview:has(> .group-result-audio) { display: flex; align-items: center; padding: 0; box-sizing: border-box; }
.delivery-stage .group-result-video {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: #111722;
  object-fit: contain;
}
.frame .delivery-stage .group-result-image {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  line-height: 0;
  cursor: zoom-in;
}
.delivery-stage .group-result-image img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.delivery-stage .group-result-audio { display: block; width: 100%; min-width: 0; height: 40px; margin: 0; padding: 0; }
.delivery-stage .group-work-media-error { margin: 0; padding: 8px 12px; font-size: 11px; line-height: 18px; }
.delivery-stage-preview > .group-work-media-error:not([hidden]) {
  position: absolute;
  z-index: 1;
  top: 10px;
  right: 10px;
  left: 10px;
  border: 1px solid var(--line, #dfe5e1);
  border-radius: 6px;
  background: var(--panel-surface, #fff);
  color: var(--danger, #b94239);
  box-shadow: 0 2px 8px #182b2110;
}
.delivery-stage-unavailable { display: flex; flex-direction: column; align-items: center; justify-content: center; box-sizing: border-box; height: 100%; gap: 8px; padding: 20px; text-align: center; overflow-wrap: anywhere; }
.delivery-stage-unavailable > b { font-size: 13px; line-height: 21px; color: var(--ink, #39453e); }
.delivery-stage-unavailable > p { max-width: 320px; margin: 0; color: var(--muted, #78847f); font-size: 12px; line-height: 21px; }

/* Compact mode follows the actual chat viewport, including an expanded composer. */
.frame .delivery-stage.is-compact .delivery-stage-tab {
  height: 28px;
  min-height: 28px;
  padding-block: 2px;
}
.delivery-stage.is-compact .delivery-stage-filebar { min-height: 26px; padding-block: 0; }
.frame .delivery-stage.is-compact .delivery-stage-filebar > :is(button, a) { min-height: 24px; padding-block: 1px; }
.frame .delivery-package.delivery-surface:has(> .delivery-stage.is-compact) { row-gap: 4px; }
.delivery-surface:has(> .delivery-stage.is-compact) > :is(.group-result-head, .chat-round-head) { min-height: 22px; }
.delivery-surface:has(> .delivery-stage.is-compact) > .group-result-footer { min-height: 26px; padding-top: 0; }
.frame .delivery-surface:has(> .delivery-stage.is-compact) .group-result-jump,
.frame .delivery-surface:has(> .delivery-stage.is-compact) .group-result-execution > summary,
.frame .delivery-package.delivery-surface:has(> .delivery-stage.is-compact) > .round-footer button,
.frame .delivery-package.delivery-surface:has(> .delivery-stage.is-compact) > .delivery-execution-details > summary { min-height: 26px; padding-block: 2px; }

/* The HTML bridge may resize content, while this viewport stays fixed. */
.delivery-stage .inline-html {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: var(--panel-surface, #fff);
}
.delivery-stage .inline-html-surface { flex: 1 1 0; min-width: 0; min-height: 0; }
.delivery-stage .inline-html-frame { width: 100%; height: 100% !important; max-height: none !important; margin: 0; border: 0; }
.delivery-stage .inline-html-status { padding: 12px; }
.delivery-stage .inline-html-followup { flex: none; gap: 8px; padding: 6px 9px; font-size: 10px; }
.delivery-stage .artifact-card-preview { min-height: 100%; margin: 0; padding: 0; border-radius: 0; background: transparent; }
.delivery-stage .artifact-card-text pre {
  display: block;
  max-height: none;
  overflow: visible;
  margin: 0;
  font-size: 12px;
  line-height: 21px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  -webkit-line-clamp: unset;
}
/* Text excerpts follow their content. The shared viewport budget is a ceiling,
   while page, HTML and media previews retain their own fixed viewport. */
.delivery-stage-content[data-stage-layout="text"] {
  height: auto;
  max-height: var(--delivery-stage-height, 300px);
}
.delivery-stage-content[data-stage-layout="text"] .delivery-stage-preview { height: auto; }
.delivery-stage-content[data-stage-layout="text"] .artifact-card-preview { min-height: 0; }
/* A delivered document stays a file until the reader explicitly opens it. */
.delivery-stage-main.is-file { width: min(100%, 560px); gap: 5px; }
.delivery-stage-content[data-stage-layout="file"] { height: auto; max-height: none; overflow: visible; }
.delivery-stage-content[data-stage-layout="file"] .delivery-stage-preview { height: auto; }
.delivery-stage-main.is-file > .delivery-stage-files { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: thin; }
.delivery-stage-main.is-file > .delivery-stage-files .delivery-stage-choice { flex: 0 1 180px; min-width: 104px; }
.delivery-stage-file-card { display: flex; align-items: center; box-sizing: border-box; width: 100%; min-width: 0; border: 1px solid var(--line, #dfe5e1); border-radius: 10px; background: var(--panel-surface, #fff); }
.frame .delivery-stage .delivery-stage-file-open { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; flex: 1 1 0; gap: 12px; box-sizing: border-box; min-width: 0; min-height: 80px; margin: 0; padding: 15px 12px 15px 16px; border: 0; border-radius: 10px; background: transparent; color: var(--ink, #293a31); font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.frame .delivery-stage .delivery-stage-file-open:hover { background: var(--row-hover, #f1f6f2); }
.delivery-stage-file-icon { display: flex; align-items: center; justify-content: center; width: 34px; height: 40px; color: var(--accent, #18765b); }
.delivery-stage-file-icon svg { width: 32px; height: 36px; fill: var(--accent-soft, #e7f2ec); stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.delivery-stage-file-copy { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.delivery-stage-file-copy strong { overflow: hidden; color: inherit; font-size: 13px; font-weight: 500; line-height: 20px; text-overflow: ellipsis; white-space: nowrap; }
.delivery-stage-file-copy small { color: var(--muted, #78847f); font-size: 11px; line-height: 16px; }
.delivery-stage-file-action { color: var(--accent, #18765b); font-size: 12px; line-height: 20px; white-space: nowrap; }
.frame .delivery-stage .delivery-stage-file-download { flex: none; margin-right: 14px; padding: 7px 3px; border: 0; background: transparent; color: var(--muted, #78847f); font-size: 11px; line-height: 20px; text-decoration: none; white-space: nowrap; }
.frame .delivery-stage .delivery-stage-file-download:hover { color: var(--accent, #18765b); }

/* Native modal focus containment keeps reading within the current conversation. */
.delivery-reader-dialog { box-sizing: border-box; width: min(1120px, calc(100vw - 48px)); max-width: calc(100vw - 48px); height: min(88dvh, 960px); max-height: calc(100dvh - 48px); margin: auto; padding: 0; overflow: hidden; border: 1px solid var(--line, #dfe5e1); border-radius: 12px; background: var(--panel-surface, #fff); color: var(--ink, #293a31); box-shadow: 0 18px 70px #14241b30; }
.delivery-reader-dialog[open] { display: flex; flex-direction: column; }
.delivery-reader-dialog::backdrop { background: #16221d50; }
.delivery-reader-header { display: flex; align-items: center; flex: none; gap: 16px; min-width: 0; min-height: 54px; padding: 0 16px 0 22px; border-bottom: 1px solid var(--line, #e3e9e5); }
.delivery-reader-title { flex: 1 1 0; min-width: 0; overflow: hidden; font-size: 14px; font-weight: 600; line-height: 22px; text-overflow: ellipsis; white-space: nowrap; }
.delivery-reader-header a { flex: none; color: var(--accent, #18765b); font: inherit; font-size: 12px; text-decoration: none; }
.delivery-reader-dialog button { box-sizing: border-box; border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.delivery-reader-dialog [data-reader-close] { flex: none; width: 32px; height: 32px; padding: 0; border-radius: 6px; color: var(--muted, #78847f); font-size: 24px; line-height: 28px; }
.delivery-reader-dialog [data-reader-close]:hover { background: var(--row-hover, #edf1ed); }
.delivery-reader-tabs { display: flex; flex: none; align-items: center; gap: 6px; min-width: 0; padding: 8px 16px; overflow-x: auto; border-bottom: 1px solid var(--line, #e3e9e5); scrollbar-width: thin; }
.delivery-reader-tabs button { flex: 0 0 auto; max-width: 240px; min-height: 30px; padding: 5px 10px; overflow: hidden; border-radius: 5px; font-size: 12px; line-height: 20px; text-overflow: ellipsis; white-space: nowrap; }
.delivery-reader-tabs button[aria-pressed="true"] { background: var(--accent-soft, #e7f2ec); color: var(--accent, #18765b); }
.delivery-reader-frame { display: block; flex: 1 1 0; width: 100%; min-width: 0; min-height: 0; margin: 0; border: 0; background: #fff; }
.delivery-reader-dialog :is(button, a):focus-visible { outline: 2px solid var(--focus-ring, #298b6b); outline-offset: 2px; }
@media (max-width: 600px) {
  .delivery-reader-dialog { width: calc(100vw - 16px); max-width: calc(100vw - 16px); height: calc(100dvh - 24px); max-height: calc(100dvh - 24px); border-radius: 10px; }
  .delivery-reader-header { gap: 12px; min-height: 50px; padding-inline: 12px; }
  .delivery-reader-tabs { padding-inline: 10px; }
  .frame .delivery-stage .delivery-stage-file-open { grid-template-columns: 28px minmax(0, 1fr) auto; gap: 9px; padding-inline: 12px 9px; }
  .delivery-stage-file-icon { width: 28px; }
  .frame .delivery-stage .delivery-stage-file-download { margin-right: 10px; }
}
.delivery-stage .artifact-card-page .artifact-card-content { min-height: 100%; flex-direction: column; gap: 8px; }
.delivery-stage .artifact-card-page canvas { max-width: 100%; height: auto; }
.frame .delivery-stage :is(button, a):focus-visible { outline: 2px solid var(--focus-ring, #298b6b); outline-offset: 2px; }

@container delivery-card (max-width: 620px) {
  .delivery-stage-files { grid-template-columns: repeat(auto-fit, minmax(min(120px, 100%), 1fr)); }
  .delivery-stage-tab small { display: none; }
  .delivery-stage.is-paired .delivery-stage-panels { grid-template-columns: minmax(0, 1fr); gap: 5px; }
}
@container delivery-card (max-width: 380px) {
  .delivery-stage-files { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .delivery-stage-filebar.has-chooser { grid-template-columns: minmax(0, 1fr) auto; row-gap: 1px; }
  .delivery-stage-filebar.has-chooser > .delivery-stage-files { grid-column: 1 / -1; width: 100%; }
  .delivery-stage-filebar.has-chooser > :is(button, a) { justify-self: end; }
  .delivery-stage-filebar > strong { flex-basis: 0; }
  .delivery-stage-filebar > small { display: none; }
}
@media (max-width: 760px) {
  .frame:not(.group-frame):has(.chat .delivery-surface) .composer { --wechat-input-min: 56px; }
  .frame .delivery-package.delivery-surface,
  .frame .chat .message-body > .delivery-surface,
  .frame .chat .delivery-package.delivery-surface { --delivery-stage-height: clamp(240px, 42dvh, 420px); }
  .frame .delivery-stage-tab { height: 32px; min-height: 32px; }
  .frame .delivery-stage-filebar > :is(button, a) { min-height: 26px; }
  .frame .delivery-package.delivery-surface > .round-footer button,
  .frame .delivery-package.delivery-surface > .delivery-execution-details > summary,
  .delivery-surface .group-result-footer > .group-result-execution > summary { min-height: 32px; }
}
@media (max-height: 620px) {
  .frame:not(.group-frame):has(.chat .delivery-surface) .composer { --wechat-input-min: 42px; }
  .frame .delivery-package.delivery-surface,
  .frame .chat .message-body > .delivery-surface,
  .frame .chat .delivery-package.delivery-surface { --delivery-stage-height: clamp(160px, 34dvh, 280px); }
}

/* Desktop delivery: actual document excerpt, existing reader remains the primary action. */
.frame .chat .delivery-package.delivery-surface.delivery-desktop-result,
.frame .delivery-package.delivery-surface.delivery-desktop-result { width: min(100%,720px); max-width: 100%; box-sizing:border-box; padding:0; border:0; border-radius:0; background:transparent; box-shadow:none; gap:10px; }
.delivery-desktop-stage .delivery-stage-file-card { border-radius:8px; }
.delivery-desktop-stage .delivery-stage-file-copy strong { font-size:14px; line-height:22px; overflow-wrap:anywhere; white-space:normal; }
.delivery-desktop-stage .delivery-stage-file-copy small { font-size:12px; line-height:18px; }
.delivery-desktop-excerpt:empty { display:none; }
.delivery-desktop-excerpt .artifact-card-preview { margin:0 0 10px; padding:0; border-radius:8px; font-size:14px; line-height:22px; color:var(--ink,#293a31); }
.delivery-desktop-excerpt .artifact-card-content pre { -webkit-line-clamp:6; max-height:132px; font-size:14px; line-height:22px; }
.delivery-desktop-excerpt .artifact-card-markdown { max-height:132px; font-size:14px; line-height:22px; }
.delivery-desktop-excerpt .artifact-card-markdown :is(h1,h2,h3) { font-size:15px; line-height:22px; }
.delivery-desktop-check { border-top:1px solid var(--line,#dfe5e1); padding-top:10px; color:var(--text-secondary,#58665d); font-size:12px; line-height:18px; }
.delivery-desktop-check>summary { display:flex; justify-content:space-between; gap:12px; cursor:pointer; list-style:none; }
.delivery-desktop-check>summary::-webkit-details-marker { display:none; }
.delivery-desktop-check>summary::marker { content:''; }
.delivery-desktop-check .delivery-check-toggle { color:var(--accent,#18765b); white-space:nowrap; }
.delivery-desktop-check.delivery-check-fail>summary { color:var(--warning-ink,#925321); font-weight:600; }
.delivery-desktop-check .wo-quality-compact { padding:10px 0 0; margin:0; background:transparent; border:0; }
.delivery-desktop-check>summary:focus-visible { outline:2px solid var(--focus-ring,#298b6b); outline-offset:3px; }
@media (prefers-reduced-motion:no-preference) { .delivery-desktop-check[open]>div { animation:delivery-check-reveal 140ms ease-out; } @keyframes delivery-check-reveal { from{opacity:0;transform:translateY(-3px)} to{opacity:1;transform:translateY(0)} } }

.frame .delivery-package.delivery-desktop-result > :is(.chat-round-head,.round-head) :is(b,h3) { font-size:15px; line-height:22px; white-space:normal; overflow-wrap:anywhere; }
.delivery-desktop-stage .delivery-stage-main.is-file { width:100%; }

.delivery-desktop-excerpt .artifact-card-content { max-height:132px; overflow:hidden; }

/* Conversation results stay compact; the existing reader provides full-size viewing. */
.frame .chat .msg:not(.me):has(> .message-body > .group-message-result.delivery-surface) { max-width:calc(720px + var(--chat-author-width,46px)); }
.frame .chat .message-body > .group-message-result.delivery-surface { max-width:720px; padding:12px 14px; gap:10px; border:1px solid var(--line,#e2e8e4); border-radius:12px; background:var(--panel-surface,#fff); --delivery-stage-height:clamp(140px,30dvh,280px); }
.group-message-result.delivery-surface .group-result-head { gap:8px; }
.group-message-result.delivery-surface .group-result-count { padding:0; background:transparent; color:var(--muted,#78847f); }
.group-message-result.delivery-surface .delivery-stage-tab small { display:none; }
.group-message-result.delivery-surface .delivery-stage-files { display:flex; flex-wrap:wrap; gap:4px; }
.group-message-result.delivery-surface .delivery-stage-choice { flex:1 1 140px; max-width:100%; }
.frame .group-message-result.delivery-surface .delivery-stage-tab { border:0; border-radius:6px; }
.group-message-result.delivery-surface .delivery-stage-filebar { gap:6px; padding:0 0 6px; }
.group-message-result.delivery-surface .delivery-stage-content[data-stage-layout="viewport"] { max-height:280px; border-radius:8px; overflow:hidden; }
.group-message-result.delivery-surface .group-result-footer { border-top:1px solid var(--line,#e8ede9); padding-top:6px; }
.group-message-result.delivery-surface .group-result-execution > summary { font-size:11px; }
.group-message-result.delivery-surface .group-result-quality-note { color:var(--text-secondary,#65736b); }
.group-message-result.delivery-surface .group-result-execution[open] > :not(summary) { margin-top:8px; }
@media(max-width:540px) { .frame .chat .message-body > .group-message-result.delivery-surface { padding:10px; gap:8px; } .group-message-result.delivery-surface .group-result-head { flex-wrap:wrap; } .group-message-result.delivery-surface .group-result-heading { flex-basis:100%; } }

.group-result-file-details { padding:0; margin:8px 0; list-style:none; }
.group-result-file-details li { display:flex; flex-wrap:wrap; gap:4px 12px; padding:4px 0; overflow-wrap:anywhere; }
.group-result-file-details li > span { flex:1 1 180px; min-width:0; }
.group-result-file-details small { color:var(--muted,#78847f); }

/* Desktop results follow the message flow: content first, quiet file actions below. */
.delivery-desktop-stage .delivery-stage-main { gap:8px; }
.delivery-desktop-stage .delivery-stage-files { display:flex; flex-wrap:wrap; gap:4px; }
.delivery-desktop-stage .delivery-stage-choice { flex:0 1 auto; max-width:100%; }
.frame .delivery-desktop-stage .delivery-stage-tab { width:auto; max-width:240px; height:auto; min-height:30px; padding:5px 9px; border:0; border-radius:6px; }
.frame .delivery-desktop-stage .delivery-stage-tab[aria-selected='true'] { background:var(--quote-surface,#eef0ef); color:var(--ink,#293a31); }
.delivery-desktop-stage .delivery-stage-tab small { display:none; }
.delivery-desktop-stage .delivery-stage-content[data-stage-layout="viewport"] { height:auto; max-height:none; overflow:visible; border-radius:10px; }
.delivery-desktop-stage .delivery-stage-content[data-stage-layout="viewport"] > .delivery-stage-preview { height:auto; }
.delivery-desktop-stage .group-result-video { width:auto; max-width:100%; height:var(--delivery-stage-height,300px); max-height:var(--delivery-stage-height,520px); border-radius:10px; background:#111722; }
.frame .delivery-desktop-stage .group-result-image { height:auto; border-radius:10px; overflow:hidden; }
.delivery-desktop-stage .group-result-image img { max-height:var(--delivery-stage-height,520px); border-radius:10px; }
.delivery-desktop-stage .delivery-stage-filebar { min-height:30px; gap:10px; padding:0; }
.delivery-desktop-stage .delivery-stage-filebar > strong { font-size:12px; font-weight:400; color:var(--text-secondary,#58665d); }
.delivery-desktop-stage .delivery-stage-filebar > small { font-size:11px; }
.frame .delivery-desktop-stage .delivery-stage-filebar > :is(button,a) { min-height:30px; padding:3px 2px; font-size:12px; }
.delivery-desktop-stage .delivery-stage-file-card { border-color:var(--line,#dfe5e1); border-radius:8px; background:transparent; }
.frame .delivery-desktop-stage .delivery-stage-file-open { min-height:58px; padding:9px 12px; gap:10px; grid-template-columns:26px minmax(0,1fr) auto; border-radius:8px; }
.delivery-desktop-stage .delivery-stage-file-icon { width:26px; height:30px; color:var(--muted,#78847f); }
.delivery-desktop-stage .delivery-stage-file-icon svg { width:23px; height:27px; fill:none; }
.delivery-desktop-stage .delivery-stage-file-copy { gap:2px; }
.delivery-desktop-stage .delivery-stage-file-copy strong { font-size:13px; line-height:20px; }
.delivery-desktop-stage .delivery-stage-file-copy small { font-size:11px; line-height:17px; }
.delivery-desktop-stage .delivery-stage-file-action { font-size:12px; }
.delivery-desktop-check { border-top:0; padding-top:0; }
@container delivery-card (max-width:480px) {
 .delivery-desktop-stage .delivery-stage-filebar > small { display:none; }
 .frame .delivery-desktop-stage .delivery-stage-tab { max-width:180px; }
 .delivery-desktop-stage .delivery-stage-file-action { display:none; }
}
.delivery-desktop-stage .delivery-stage-content[data-stage-layout="text"] { max-height:none; overflow:visible; }

.frame .chat .message-body > .group-message-result.delivery-surface:has(> .delivery-desktop-stage) { padding:0; border:0; border-radius:0; background:transparent; gap:10px; }
.group-message-result.delivery-surface:has(> .delivery-desktop-stage) .group-result-footer { border-top:0; padding-top:0; }
.group-message-result.delivery-surface .delivery-desktop-stage .delivery-stage-content[data-stage-layout="viewport"] { max-height:none; overflow:visible; }
