/* Task details retain the existing overlay contract; file previews are pushed siblings. */
.eva-file-preview-resizer {
  position: absolute;
  z-index: 102;
  top: 0;
  bottom: 0;
  left: 0;
  width: 8px;
  pointer-events: auto;
  cursor: col-resize;
  touch-action: none;
}

.eva-file-preview-resizer::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 3px;
  width: 1px;
  background: var(--eva-border-subtle, var(--wk-border-subtle));
  content: '';
  transition: width 120ms ease, background-color 120ms ease;
}

.eva-file-preview-resizer:hover::after,
.eva-file-preview-resizer:focus-visible::after,
html.eva-file-preview-resizing .eva-file-preview-resizer::after {
  width: 2px;
  background: var(--eva-action-primary, var(--wk-color-accent));
}

.eva-file-preview-resizer:focus-visible {
  outline: none;
}

html.eva-file-preview-resizing,
html.eva-file-preview-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

.ch-layout .ch-right-panel--preview:not(.ch-right-panel--file-preview) {
  position: absolute;
  z-index: 84;
  inset: 0 0 0 auto;
  max-width: 100%;
  flex: 0 0 664px;
  width: 664px;
  min-width: 0;
  background: var(--wk-bg-surface);
  border-left: 1px solid var(--wk-border-subtle);
  box-shadow: var(--wk-shadow-drawer);
}

.ch-layout .ch-right-panel--file-preview {
  position: relative;
  z-index: 1;
  inset: auto;
  align-self: stretch;
  max-width: 66.666%;
  min-width: 280px;
  width: var(--eva-file-preview-current, min(664px, 58%));
  flex: 0 0 var(--eva-file-preview-current, min(664px, 58%));
  background: var(--wk-bg-surface);
  border-left: 1px solid var(--wk-border-subtle);
  box-shadow: none;
  animation: eva-pushed-preview-in 160ms ease-out;
}

.ch-layout .ch-right-panel--preview > .wk-file-preview-panel {
  position: relative;
  inset: auto;
  width: 100%;
  max-width: none;
  height: 100%;
  border: 0;
  box-shadow: none;
}

.loop-idp.eva-task-file-preview-open {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, var(--eva-file-preview-current, min(48%, 664px)));
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.loop-idp.eva-task-file-preview-open > .loop-idp__topbar {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
}

.loop-idp.eva-task-file-preview-open > .loop-idp__body {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
}

.eva-task-file-preview-pane {
  position: relative;
  grid-column: 2;
  grid-row: 1 / -1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-left: 1px solid var(--wk-border-subtle);
  background: var(--wk-bg-surface);
  animation: eva-pushed-preview-in 160ms ease-out;
}

.eva-task-file-preview-pane > .wk-file-preview-panel {
  position: relative;
  inset: auto;
  width: 100%;
  max-width: none;
  height: 100%;
  border: 0;
  box-shadow: none;
}

.ch-layout .ch-right-panel--file-preview:has(> .wk-file-preview-panel.is-fullscreen),
.eva-task-file-preview-pane:has(> .wk-file-preview-panel.is-fullscreen) {
  position: fixed;
  z-index: 950;
  inset: var(--topbar-height, 37px) 0 0 var(--eva-sider-w, 180px);
  width: auto;
  max-width: none;
  height: auto;
  min-width: 0;
  border-left: 0;
  animation: none;
}

.ch-layout .ch-right-panel--file-preview:has(> .wk-file-preview-panel.is-fullscreen) {
  flex: none;
}

.ch-layout .ch-right-panel--file-preview:has(> .wk-file-preview-panel.is-fullscreen) > .eva-file-preview-resizer,
.eva-task-file-preview-pane:has(> .wk-file-preview-panel.is-fullscreen) > .eva-file-preview-resizer {
  display: none;
}

.wk-file-preview-panel.is-fullscreen {
  position: relative;
  inset: auto;
  width: 100%;
  max-width: none;
  height: 100%;
  border: 0;
  box-shadow: none;
}

/* ============================================================
   任务附件全屏预览（铺满工作区内容区，替代原抽屉内挤压式 pane）
   ------------------------------------------------------------
   由 009-6 portal 到 .collab-body：absolute inset:0，层级高于任务抽屉(z60)，
   盖住看板+抽屉，但保留 Γ 顶栏/侧栏与项目页签，用户不失去坐标。
   复用 FilePreviewHost 的工具条与内容渲染，调性与项目文件库一致。
   ============================================================ */
.eva-task-file-fs {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: flex;
  background: var(--eva-surface-primary, #fff);
  animation: eva-task-file-fs-in 160ms ease-out;
}
.eva-task-file-fs__stage {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  animation: eva-task-file-fs-stage-in 200ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.eva-task-file-fs__stage > .wk-file-preview-panel {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
/* 标题栏：.wk-file-preview-header 的高度/内边距只在 .ch-layout 作用域下定义，
   本覆盖层 portal 到 .collab-body 不在其内，header 会塌成内容高度而显局促。
   在此补齐，并对齐任务详情抽屉标题栏（.loop-idp__topbar 52px / 内边距 24px）——
   两者处于同一工作区、概念上是同层替换关系，高度须一致。 */
.eva-task-file-fs .wk-file-preview-header {
  box-sizing: border-box;
  height: 52px;
  min-height: 52px;
  margin: 0;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--eva-surface-primary);
  border-bottom: 1px solid var(--wk-border-subtle, #e6e7e9);
}
.eva-task-file-fs .wk-file-preview-header__left {
  flex: 1;
  min-width: 0;
  max-width: none;
}
/* FilePreviewHost 为窄侧栏预设了 150px/110px 宽度上限，全屏下标题过早省略。
   解除上限，标题随可用空间伸展，仅在空间不足时才省略。 */
.eva-task-file-fs .wk-file-preview-header__dropdown {
  min-width: 0;
  max-width: 100%;
}
.eva-task-file-fs .wk-file-preview-header__dropdown-btn {
  max-width: none;
}
.eva-task-file-fs .wk-file-preview-header__dropdown-text {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  overflow: hidden;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}
/* 右侧动作按钮：对齐任务详情抽屉标题栏按钮（32×32、圆角 8、
   --eva-text-secondary、hover/active 填充 overlay token、focus 环一致），
   间距取抽屉同款 12px，去掉仅因窄侧栏而设的分隔线。
   选择器带 .wk-file-preview-header 拉高特异度：vendor 在暗色下用
   body[theme-mode=dark] .wk-file-preview-header__btn（0,2,1）改写颜色，
   需 (0,3,0)+ 才能稳定压回 Eva token。 */
.eva-task-file-fs .wk-file-preview-header__actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 12px;
}
.eva-task-file-fs .wk-file-preview-header__sep {
  display: none;
}
.eva-task-file-fs .wk-file-preview-header .wk-file-preview-header__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--eva-text-secondary);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 120ms ease;
}
.eva-task-file-fs .wk-file-preview-header .wk-file-preview-header__btn:hover {
  color: var(--eva-text-secondary);
  background: var(--eva-overlay-hover);
}
.eva-task-file-fs .wk-file-preview-header .wk-file-preview-header__btn:active {
  background: var(--eva-overlay-pressed);
}
.eva-task-file-fs .wk-file-preview-header .wk-file-preview-header__btn:focus-visible {
  outline: var(--eva-border-focus-w) solid var(--eva-border-focus);
  outline-offset: 2px;
}
/* 图标对齐抽屉的 Lucide 线性图标（18px，随 currentColor）：组件自带的
   12px 填充图标用 mask 换成同套 Lucide 图标，仅作用于本覆盖层。 */
.eva-task-file-fs {
  --eva-ico-download: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='7 10 12 15 17 10'/%3E%3Cline x1='12' x2='12' y1='15' y2='3'/%3E%3C/svg%3E");
  --eva-ico-x: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 6 6 18'/%3E%3Cpath d='m6 6 12 12'/%3E%3C/svg%3E");
}
.eva-task-file-fs .wk-file-preview-header .wk-file-preview-header__btn > svg {
  display: none;
}
.eva-task-file-fs .wk-file-preview-header .wk-file-preview-header__btn::before {
  content: "";
  width: 18px;
  height: 18px;
  background-color: currentColor;
  -webkit-mask: var(--eva-ico-download) center / contain no-repeat;
  mask: var(--eva-ico-download) center / contain no-repeat;
}
.eva-task-file-fs .wk-file-preview-header .wk-file-preview-header__btn--close::before {
  -webkit-mask-image: var(--eva-ico-x);
  mask-image: var(--eva-ico-x);
}
/* 已铺满工作区，隐藏组件自带的“再全屏”按钮，避免重复层级。
   须压过下方 .wk-file-preview-header .eva-file-preview-fullscreen-button(0,2,0)，
   故加一层 header 作用域拉高特异度到 (0,3,0)。 */
.eva-task-file-fs .wk-file-preview-header .eva-file-preview-fullscreen-button {
  display: none;
}
@keyframes eva-task-file-fs-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes eva-task-file-fs-stage-in {
  from { opacity: 0; transform: translateY(6px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

.wk-file-preview-header .eva-file-preview-fullscreen-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--wk-text-secondary);
  border-radius: var(--wk-r-input);
}

.wk-file-preview-header .eva-file-preview-fullscreen-button > svg {
  display: block;
  width: 16px;
  height: 16px;
}

.wk-file-preview-header .eva-file-preview-fullscreen-button:hover {
  background: var(--wk-bg-hover);
  color: var(--wk-text-primary);
}

.eva-file-preview-fullscreen-button:focus-visible {
  outline: 2px solid var(--wk-color-accent);
  outline-offset: 2px;
}

.loop-idp .eva-task-attachments {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  margin: 16px auto 0;
}

.loop-idp .eva-task-attachment-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 280px;
  max-width: calc(100% - 24px);
  height: 44px;
  min-height: 44px;
  padding: 10px 12px;
  box-sizing: content-box;
  background: var(--eva-im-bubble-incoming, #f2f2f2);
  border: 0;
  border-radius: 12px;
}

.loop-idp button.eva-task-attachment-card__preview {
  display: grid;
  flex: 1;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.eva-task-attachment-card__filetype {
  --eva-task-file-color: var(--eva-text-secondary);

  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--eva-task-file-color);
  background: color-mix(in srgb, var(--eva-task-file-color) 9%, var(--eva-surface-primary));
  border-radius: 8px;
}

.eva-task-attachment-card__filetype.is-pdf {
  --eva-task-file-color: var(--semi-color-danger);
}

.eva-task-attachment-card__filetype.is-sheet {
  --eva-task-file-color: var(--semi-color-success);
}

.eva-task-attachment-card__filetype:is(.is-document, .is-image, .is-audio, .is-video) {
  --eva-task-file-color: var(--eva-action-primary);
}

.eva-task-attachment-card__filetype:is(.is-presentation, .is-archive) {
  --eva-task-file-color: var(--semi-color-warning);
}

.eva-task-attachment-card__filetype-icon {
  display: block;
  stroke-width: 1.75;
}

.eva-task-attachment-card__filetype-label {
  position: absolute;
  right: -2px;
  bottom: -2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  box-sizing: border-box;
  color: var(--eva-task-file-color);
  font: var(--eva-fw-semibold) 8px/14px var(--eva-font-sans);
  background: var(--eva-surface-primary);
  border-radius: 4px;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--eva-task-file-color) 20%, transparent);
}

.eva-task-attachment-card__content {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.loop-idp button.eva-task-attachment-action {
  appearance: none;
  padding: 0;
  font: inherit;
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.eva-task-attachment-card__name {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--eva-text-primary);
  font: var(--eva-fw-medium) 14px/20px var(--eva-font-sans);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eva-task-attachment-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--eva-text-secondary);
  font: var(--eva-fw-regular) 12px/18px var(--eva-font-sans);
}

.eva-task-attachment-card__format {
  max-width: 52px;
  overflow: hidden;
  color: var(--eva-text-secondary);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eva-task-attachment-card__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: none;
  gap: 4px;
  width: 92px;
  height: 44px;
}

.loop-idp button.eva-task-attachment-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--eva-text-primary);
  border-radius: var(--eva-radius-control);
}

.loop-idp button.eva-task-attachment-action:hover:not(:disabled) {
  background: var(--eva-overlay-hover);
}

.loop-idp button.eva-task-attachment-action:disabled {
  color: var(--eva-text-muted);
  cursor: not-allowed;
}

.loop-idp button.eva-task-attachment-card__preview:focus-visible,
.loop-idp button.eva-task-attachment-action:focus-visible {
  outline: var(--eva-border-focus-w) solid var(--eva-border-focus);
  outline-offset: 2px;
}

@keyframes eva-pushed-preview-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.eva-word-preview-renderer {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--wk-bg-base);
}

.eva-word-preview-renderer__frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--wk-bg-base);
}

.eva-word-preview-renderer__loading {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--wk-text-secondary);
  font-size: 13px;
  background: var(--wk-bg-base);
}

.eva-word-preview-renderer__spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--wk-border-strong);
  border-top-color: var(--wk-color-accent);
  border-radius: 50%;
  animation: eva-word-preview-spin 0.8s linear infinite;
}

.eva-word-preview-renderer--error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px;
  color: var(--wk-text-secondary);
  text-align: center;
}

.eva-word-preview-renderer--error strong {
  color: var(--wk-text-primary);
  font-size: 16px;
}

.eva-word-preview-renderer--error button {
  min-height: 32px;
  padding: 0 14px;
  color: var(--wk-text-inverse);
  background: var(--wk-color-accent);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

@keyframes eva-word-preview-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1439px) {
  .ch-layout .ch-right-panel--preview:not(.ch-right-panel--file-preview) {
    flex-basis: 380px;
    width: 380px;
  }

  .ch-layout .ch-right-panel--file-preview {
    max-width: 52%;
    width: var(--eva-file-preview-current, min(480px, 52%));
    flex-basis: var(--eva-file-preview-current, min(480px, 52%));
  }
}

@media (max-width: 1099px) {
  .ch-layout .ch-right-panel--preview:not(.ch-right-panel--file-preview) {
    position: absolute;
    z-index: 84;
    inset: 0 0 0 auto;
    width: min(480px, 100%);
    max-width: 100%;
  }

  .ch-layout .ch-right-panel--file-preview {
    position: relative;
    z-index: 1;
    inset: auto;
    max-width: 50%;
    min-width: 0;
    width: var(--eva-file-preview-current, 50%);
    flex: 0 0 var(--eva-file-preview-current, 50%);
  }

  .loop-idp.eva-task-file-preview-open {
    grid-template-columns: minmax(0, 1fr) minmax(0, var(--eva-file-preview-current, 50%));
  }
}

@media (prefers-reduced-motion: reduce) {
  .eva-word-preview-renderer__spinner,
  .ch-layout .ch-right-panel--file-preview,
  .eva-task-file-preview-pane { animation: none; }
}
