/*
 * 素材与对话 · 任务工作区弹窗、素材网格、对话记录（2026-10 改版）
 * 依赖同目录 style.css 中的设计变量。
 */

.task-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.task-actions button { min-height: 32px; padding: 0 10px; font-size: 13px; }
.task-foot > div:first-child { min-width: 0; max-width: 46%; }

/* 弹窗 */
dialog { width: min(1400px, 97vw); max-height: 94dvh; padding: 0; overflow: auto; border: 1px solid var(--pp-border); border-radius: 16px; background: var(--pp-surface); color: inherit; box-shadow: var(--pp-shadow-lg); }
dialog[open] { animation: pp-dialog-in .28s var(--pp-ease) both; }
dialog::backdrop { background: rgba(16, 24, 40, .5); backdrop-filter: blur(2px); }
dialog[open]::backdrop { animation: pp-fade .2s ease-out both; }
#document { width: min(950px, 96vw); }
#preview { width: min(1300px, 96vw); background: var(--pp-surface-2); }

.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 24px 14px; border-bottom: 1px solid var(--pp-border); }
.detail-head > div { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.detail-head h2 { font-size: 20px; line-height: 28px; overflow-wrap: anywhere; }
.detail-head p { font-size: 12px; color: var(--pp-text-3); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.detail-head > button, .detail-tools > button { flex-shrink: 0; white-space: nowrap; }

.detail-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 24px 0; padding: 10px 12px 10px 34px; position: relative; border: 1px solid var(--pp-primary-line); border-radius: var(--pp-radius-sm); background: var(--pp-primary-wash); color: var(--pp-primary-ink); font-size: 13px; }
.detail-tools::before { content: ""; position: absolute; left: 14px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 4px; background: var(--pp-primary); animation: pp-blink 1.6s ease-in-out infinite; }
.detail-tools > span { line-height: 1.6; }
.detail-tools > button { min-height: 34px; }

/* 标签页 */
#tabs { position: sticky; top: 0; z-index: 3; display: flex; gap: 6px; margin: 12px 0 0; padding: 10px 24px; background: rgba(255, 255, 255, .96); border-bottom: 1px solid var(--pp-border); backdrop-filter: blur(6px); overflow-x: auto; scrollbar-width: none; }
#tabs::-webkit-scrollbar { display: none; }
#tabs button { flex: none; min-height: 34px; padding: 0 14px; border: 1px solid transparent; border-radius: 17px; background: transparent; color: var(--pp-text-3); font-weight: 500; font-variant-numeric: tabular-nums; }
#tabs button:hover:not(:disabled) { background: var(--pp-surface-3); color: var(--pp-text); }
#tabs button.selected, #tabs button.selected:hover { border-color: var(--pp-primary-line); background: var(--pp-primary-soft); color: var(--pp-primary-ink); font-weight: 600; }

#detailBody { padding: 4px 24px 8px; animation: pp-fade .25s ease-out both; }
#detailBody > h3 { margin: 22px 0 10px; font-size: 15px; }
#detailBody > button { margin: 0 0 12px; }
#detailBody > details { margin: 16px 0; padding: 14px 16px; border: 1px solid var(--pp-border); border-radius: var(--pp-radius); background: var(--pp-surface-2); }
summary { cursor: pointer; color: var(--pp-primary-ink); font-size: 14px; font-weight: 500; line-height: 1.6; }
#detailBody .empty { margin: 16px 0; }
#detailBody > .hint { margin: 12px 0; }

/* 提交信息 */
.summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 16px 0 20px; }
.summary p { margin: 0; padding: 12px 14px; border: 1px solid var(--pp-border); border-radius: var(--pp-radius-sm); background: var(--pp-surface-2); font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.summary b { display: block; margin-bottom: 2px; font-size: 12px; font-weight: 500; color: var(--pp-text-3); }

/* 素材网格 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 16px; }
.asset { min-width: 0; margin: 0; overflow: hidden; border: 1px solid var(--pp-border); border-radius: var(--pp-radius); background: var(--pp-surface); transition: border-color .15s, box-shadow .15s, transform .15s; }
.asset:hover { border-color: var(--pp-primary-line); box-shadow: var(--pp-shadow-md); transform: translateY(-1px); }
.asset img, .asset video { display: block; width: 100%; height: 280px; object-fit: contain; background: #0f172a; }
.asset img { cursor: zoom-in; }
.asset audio { width: 100%; }
.asset figcaption { padding: 10px 12px 12px; font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.asset strong { display: block; font-size: 13px; color: var(--pp-text); }
.asset small { display: block; color: var(--pp-text-3); font-variant-numeric: tabular-nums; }
.asset figcaption button { display: flex; width: 100%; min-height: 34px; margin-top: 10px; font-size: 13px; }

/* 文档行 */
.evidence { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--pp-border); }
.evidence:last-child { border-bottom: 0; }
.evidence div { min-width: 0; }
.evidence strong { font-size: 13px; }
.evidence small { display: block; margin-top: 2px; font: 11px/1.5 var(--pp-mono); color: var(--pp-text-3); overflow-wrap: anywhere; }
.evidence button { flex-shrink: 0; min-height: 32px; }

/* 模型调用与对话 */
.calls { margin-top: 12px; display: flex; flex-direction: column; gap: 12px; }
.call { position: relative; padding: 14px 16px 14px 20px; border: 1px solid var(--pp-border); border-radius: var(--pp-radius); background: var(--pp-surface); }
.call::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 2px 2px 0; background: var(--pp-primary-line); }
.call:has(.message.error)::before { background: var(--pp-red-ink); }
.call > strong { display: block; font-size: 14px; overflow-wrap: anywhere; }
.call > p { margin-top: 2px; font-size: 12px; line-height: 1.6; color: var(--pp-text-3); }
.call > .hint { margin-top: 8px; }
.message { margin: 10px 0 0; padding: 12px 14px; border: 1px solid var(--pp-border); border-radius: 12px; }
.message b { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.message b::before { content: ""; width: 6px; height: 6px; border-radius: 3px; background: currentColor; }
.message.outgoing { margin-right: 48px; border-color: var(--pp-primary-line); border-top-left-radius: 4px; background: var(--pp-primary-wash); }
.message.outgoing b { color: var(--pp-primary-ink); }
.message.incoming { margin-left: 48px; border-color: #b7e4cb; border-top-right-radius: 4px; background: var(--pp-green-soft); }
.message.incoming b { color: var(--pp-green-ink); }
.message.error { border-color: var(--pp-red-line); background: var(--pp-red-soft); }
.message.error b { color: var(--pp-red-ink); }
pre, .call pre { margin: 0; padding: 16px; border-radius: var(--pp-radius-sm); background: var(--pp-surface-2); color: var(--pp-text-2); font: 13px/1.8 var(--pp-font); white-space: pre-wrap; word-break: break-word; }
.message pre { margin: 6px 0 0; padding: 0; background: transparent; font-size: 14px; color: var(--pp-text); }
.message details { margin-top: 8px; }

.privacy { margin: 20px 24px 0; padding: 14px 0 20px; border-top: 1px solid var(--pp-border); color: var(--pp-text-3); font-size: 12px; line-height: 1.7; }

/* 文档弹窗 */
#docNote { margin: 14px 24px 0; font-size: 12px; color: var(--pp-text-3); }
#docText { margin: 12px 24px 24px; }

/* 预览弹窗 */
#previewBody { display: grid; justify-items: center; margin: 16px 20px; }
#previewBody img, #previewBody video { display: block; max-width: 100%; max-height: 76dvh; width: auto; border-radius: 10px; background: #0f172a; object-fit: contain; }
#previewBody video { width: 100%; height: 74dvh; }
#previewBody audio { width: min(800px, 100%); }
#previewBody .hint { margin-top: 8px; }
#previewLink { display: inline-flex; margin: 0 20px 20px; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
#users { max-height: 65dvh; overflow: auto; }
button[hidden] { display: none; }

@media (max-width: 760px) {
  .task-foot { display: block; }
  .task-foot > div:first-child { max-width: 100%; }
  .task-actions { justify-content: flex-start; margin-top: 10px; }
  .detail-head { padding: 14px 16px 12px; gap: 10px; }
  .detail-head h2 { font-size: 18px; line-height: 26px; }
  .detail-head > button { padding: 0 10px; }
  .detail-tools { margin: 12px 16px 0; align-items: flex-start; }
  #tabs { padding: 8px 16px; }
  #tabs button { padding: 0 10px; }
  #detailBody { padding: 4px 16px 8px; }
  .privacy { margin: 16px 16px 0; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .asset img, .asset video { height: 220px; }
  .asset figcaption { padding: 9px; }
  .asset strong { font-size: 12px; }
  .message.outgoing { margin-right: 0; }
  .message.incoming { margin-left: 0; }
  .evidence { align-items: flex-start; }
  #previewBody video { height: 68dvh; }
  #previewBody img { max-height: 70dvh; }
  #users { max-height: 220px; }
}
@media (max-width: 390px) {
  .grid, .summary { grid-template-columns: 1fr; }
}
