/* 文档预览：音频、显示不了时的提示、rp 的下一步。 */
.preview-audio { display: flex; flex-direction: column; gap: 14px; align-items: center; padding: 56px 24px; color: var(--label-2); font-size: 15px; }
.preview-audio .ellipsis { max-width: 100%; }
.preview-audio audio { width: min(520px, 100%); }
.preview-fallback { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 56px 24px; text-align: center; color: var(--label-2); font-size: 15px; }
.preview-fallback p { margin: 0; max-width: 460px; }
.preview-cut { padding: 8px 22px; color: var(--label-2); font-size: 13px; background: var(--fill-soft); }

.rp-guide { max-width: 640px; margin: 0 auto; padding: 28px 20px 36px; }
.rp-guide h3 { margin: 0; font-size: 20px; font-weight: 600; }
.rp-lead { margin: 6px 0 16px; color: var(--label-2); font-size: 15px; }
.rp-step { min-height: 64px; padding-block: 10px; }
.rp-step-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rp-step-text strong { font-size: 15px; font-weight: 600; }
.rp-step-text span { color: var(--label-2); font-size: 13px; line-height: 1.45; }
.rp-step .btn { flex: none; }
.rp-done { flex: none; color: var(--green); font-size: 15px; }
.rp-guide .upload-progress, .rp-guide .form-error { margin-top: 12px; }
.sheet-nav .left .nav-btn { white-space: nowrap; }
@media (max-width: 640px) { dialog.preview .sheet-nav { grid-template-columns: auto minmax(0, 1fr) auto; } }

/* 看文件的弹层：默认够大，放大后铺满。各种内容都占满中间这块，自己管滚动。 */
dialog.modal.preview.file-preview:not(.full) { width: 92vw; height: 92vh; height: 92dvh; max-width: none; max-height: none; }
dialog.modal.preview.file-preview.full { width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; border-radius: 0; }
dialog.modal.file-preview .modal-form { height: 100%; }
dialog.modal.file-preview .preview-body { position: relative; flex: 1; min-height: 0; height: auto; overflow: hidden; background: var(--surface); }
dialog.modal.file-preview .preview-body iframe { position: absolute; inset: 0; width: 100%; height: 100%; }
.pv-hidden { visibility: hidden; }

.pv-nav.sheet-nav { display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 18px; }
.pv-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.pv-title strong { min-width: 0; font-size: 15px; font-weight: 600; }
.pv-count { flex: none; color: var(--label-3); font-size: 13px; font-variant-numeric: tabular-nums; }
.pv-nav .sheet-nav-right { flex: none; gap: 4px; }
.pv-nav .nav-btn { display: inline-flex; align-items: center; white-space: nowrap; padding-inline: 8px; }
.pv-prev svg { transform: rotate(180deg); }
.pv-divider { width: 1px; height: 18px; margin-inline: 4px; background: var(--sep); }
.nav-icon:disabled { color: var(--label-3); opacity: .45; cursor: default; background: none; }

.preview-loading {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 24px; color: var(--label-2); font-size: 14px; text-align: center; animation: pv-appear .2s .12s both;
}
.preview-loading p { margin: 0; }
.pv-loading-more { color: var(--label-3); font-size: 13px; }
.preview-loading .btn { margin-top: 6px; }
.pv-spinner { width: 26px; height: 26px; margin-bottom: 4px; border: 2.5px solid var(--fill-strong); border-top-color: var(--label-2); border-radius: 50%; animation: pv-spin .8s linear infinite; }
@keyframes pv-spin { to { transform: rotate(360deg); } }
@keyframes pv-appear { from { opacity: 0; } to { opacity: 1; } }

dialog.modal.file-preview .preview-fallback { position: absolute; inset: 0; justify-content: center; }
.preview-fallback p { text-wrap: balance; }
.preview-fallback .doc-badge { width: 56px; height: 56px; border-radius: 14px; font-size: 15px; }
.preview-fallback .doc-badge svg { width: 28px; height: 28px; }
.pv-actions { display: flex; gap: 8px; }

/* 图片：透明背景的图放在棋盘格上，深色模式也看得清 */
.pv-image { position: absolute; inset: 0; display: flex; padding: 16px; overflow: hidden; background: var(--fill-soft); user-select: none; -webkit-user-select: none; outline: none; }
.preview-body .pv-image img {
  display: block; margin: auto; max-width: 100%; max-height: 100%; object-fit: contain;
  background: #fff repeating-conic-gradient(#e5e5ea 0% 25%, #fff 0% 50%) 50% / 16px 16px;
}
.pv-image.can-zoom { cursor: zoom-in; }
.pv-image.zoomed { overflow: auto; padding: 0; cursor: grab; }
.pv-image.zoomed:active { cursor: grabbing; }
.preview-body .pv-image.zoomed img { max-width: none; max-height: none; flex: none; }

.pv-video { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #000; }
.pv-video video { display: block; max-width: 100%; max-height: 100%; }
dialog.modal.file-preview .preview-audio { position: absolute; inset: 0; justify-content: center; padding: 24px; }
.pv-audio-icon { display: grid; place-items: center; width: 88px; height: 88px; border-radius: 22px; background: var(--teal-soft); color: var(--teal); }
.pv-audio-icon svg { width: 44px; height: 44px; }
dialog.modal.file-preview .preview-audio .ellipsis { max-width: min(520px, 100%); color: var(--label); font-weight: 500; }

/* 文字：版心合适，长行折行不撑破 */
.pv-scroll { position: absolute; inset: 0; overflow: auto; overscroll-behavior: contain; }
.pv-column { max-width: 880px; margin-inline: auto; }
.pv-scroll .markdown.pv-column { padding: 32px 36px 64px; font-size: 15px; line-height: 1.75; }
.pv-scroll .markdown h1 { font-size: 26px; line-height: 1.3; margin: 0 0 12px; }
.pv-scroll .markdown img { max-width: 100%; height: auto; border-radius: 6px; }
.pv-scroll .markdown pre code { white-space: pre; }
/* Markdown 表格：预览和知识库文档都用，单线边框，表头看得出来 */
.markdown .md-table table { border-collapse: collapse; }
.markdown .md-table th { color: var(--label); font-weight: 600; background: var(--fill-soft); }
.pv-scroll .md-table table { width: 100%; }
.pv-scroll .preview-text.pv-column { max-width: 1040px; padding: 24px 32px 56px; font-size: 13px; line-height: 1.6; tab-size: 4; }
.pv-scroll .preview-text.prose { max-width: 800px; font: 15px/1.8 inherit; font-family: inherit; }
.pv-scroll .preview-cut { position: sticky; top: 0; z-index: 1; padding-inline: 32px; background: var(--surface-raised); box-shadow: inset 0 -1px 0 var(--sep); }

/* PDF：手机上给一条打开的路 */
.pv-frame { position: absolute; inset: 0; }
.pv-frame.with-tip { top: 34px; }
.pv-pdf-tip { display: flex; align-items: center; gap: 6px; height: 34px; padding-block: 0; background: var(--surface-raised); }
.pv-pdf-tip a { color: var(--accent-text); }

/* 不能预览的文件：文件信息、下载、怎么在线看 */
.pv-info { max-width: 540px; min-height: 100%; margin: 0 auto; padding: 48px 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; }
.pv-info .doc-badge { width: 76px; height: 76px; border-radius: 19px; font-size: 19px; }
.pv-info .doc-badge svg { width: 38px; height: 38px; }
.pv-info h3 { margin: 8px 0 0; font-size: 19px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.pv-info-meta { margin: 0 0 10px; color: var(--label-2); font-size: 13px; }
.pv-info-how { width: 100%; margin-top: 24px; padding: 14px 16px; border-radius: 12px; background: var(--fill-soft); text-align: left; font-size: 14px; line-height: 1.6; }
.pv-info-how strong { display: block; margin-bottom: 2px; font-weight: 600; }
.pv-info-how p { margin: 0; color: var(--label-2); }

/* 缩略图和类型图标 */
.doc-badge.long { font-size: 10px; letter-spacing: -.2px; }
.doc-thumb { position: relative; overflow: hidden; background: var(--fill); }
.doc-thumb img, .doc-thumb video { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.doc-thumb-play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; background: rgba(0, 0, 0, .16); pointer-events: none; }
.doc-thumb-play svg { width: 16px; height: 16px; fill: #fff; stroke: none; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .4)); }

/* Bug、用例的附件网格：和文档列表用同样的缩略图和预览 */
.media-open .doc-thumb { display: block; width: 100%; height: 100%; border-radius: 0; }
.media-open .doc-thumb-play svg { width: 26px; height: 26px; }
.media-file { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; width: 100%; height: 100%; padding: 8px; }
.media-file .media-name { width: 100%; padding: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* 上传队列：右下角，换页面也还在 */
.upload-queue {
  position: fixed; right: 20px; bottom: 20px; z-index: 55; display: flex; flex-direction: column; width: min(380px, calc(100vw - 24px)); max-height: min(50vh, 340px);
  overflow: hidden; border-radius: 14px; background: var(--surface-raised); box-shadow: var(--shadow-float); font-size: 13px; animation: pv-appear .2s both;
}
.uq-head { flex: none; padding: 10px 14px; box-shadow: inset 0 -1px 0 var(--sep); font-size: 14px; }
.uq-head strong { font-weight: 600; }
.uq-list { overflow: auto; padding-block: 4px; }
.uq-row { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 4px 14px; }
.uq-name { flex: 1; min-width: 0; }
.uq-row .upload-progress { flex: none; display: flex; align-items: center; gap: 8px; width: 132px; margin: 0; padding: 0; background: none; font-size: 12px; }
.uq-pct { flex: none; width: 32px; color: var(--label-2); text-align: right; font-variant-numeric: tabular-nums; }
.uq-note { flex: none; color: var(--label-3); }
.uq-note.ok { color: var(--green); }
.uq-note.bad { flex: 0 1 auto; max-width: 38%; color: var(--red); }
.uq-btn { flex: none; padding: 3px 4px; border-radius: 6px; color: var(--label-2); font-size: 13px; }
.uq-btn.strong { color: var(--accent-text); font-weight: 600; }
.uq-btn:hover { background: var(--fill); }

/* 文件拖进页面时的提示 */
.drop-hint { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; pointer-events: none; background: var(--accent-soft); box-shadow: inset 0 0 0 3px var(--accent); }
.drop-hint-card { padding: 14px 24px; border-radius: 14px; background: var(--surface-raised); box-shadow: var(--shadow-float); color: var(--label); font-size: 17px; font-weight: 600; }

@media (max-width: 760px) {
  dialog.modal.preview.file-preview:not(.full), dialog.modal.preview.file-preview.full { width: 100vw; height: 100vh; height: 100dvh; margin: 0; border-radius: 0; }
  .pv-nav.sheet-nav { gap: 8px; padding: max(8px, env(safe-area-inset-top)) 8px 8px 14px; min-height: 52px; }
  .pv-title { flex-direction: column; gap: 0; }
  .pv-title strong { max-width: 100%; }
  .pv-divider { display: none; }
  .pv-nav .nav-btn { min-height: 36px; font-size: 16px; padding-inline: 6px; }
  .pv-scroll .markdown.pv-column { padding: 18px 16px 48px; font-size: 16px; }
  .pv-scroll .preview-text.pv-column { padding: 16px 16px 48px; }
  .pv-scroll .preview-cut { padding-inline: 16px; }
  .pv-image { padding: 0; }
  .upload-queue { left: 12px; right: 12px; bottom: calc(64px + env(safe-area-inset-bottom)); width: auto; }
}
