/* 千柯工作台 · 动效与滚动收口
 * 参考 Apple HIG、SaaS UI App Shell、shadcn/ui 与 Plane 的交互约定：
 * - 页面切换 180–220ms，轻微位移，不做夸张缩放；
 * - 悬停只改变表面/边框，按压用 spring 微缩；
 * - 滚动区域各自独立，滚动条细而低对比；
 * - prefers-reduced-motion 下全部关闭。
 */

:root {
  --motion-page: 200ms;
  --motion-surface: 160ms;
  --ease-standard: cubic-bezier(.2, .8, .2, 1);
}

/* 页面切换：比旧版更轻，位移 6px，不闪白 */
main#page-content.page-enter {
  animation: qw-page-in var(--motion-page) var(--motion-out, ease-out) both;
}
@keyframes qw-page-in {
  from { opacity: 0; transform: translate3d(0, 6px, 0); }
  to { opacity: 1; transform: none; }
}

/* 列表、行、卡片：只做表面变化，不整块跳 */
.pf-list-item,
.pf-row,
.pf-link-row,
.pf-portal,
.pf-evidence-row,
.pf-quick,
.pf-process-card,
.pf-agent-card,
.pf-business-tabs .tab {
  transition:
    background-color var(--motion-surface) var(--ease-standard),
    border-color var(--motion-surface) var(--ease-standard),
    box-shadow var(--motion-surface) var(--ease-standard),
    transform 180ms var(--motion-spring, cubic-bezier(.32, 1.3, .5, 1));
}
.pf-list-item:hover { background: #f8f9fb; }
.pf-list-item.active:hover { background: #f5f8ff; }
.pf-list-item:active { transform: scale(.997); }
.pf-quick:hover,
.pf-process-card:hover {
  transform: translateY(-1px);
  border-color: #cfd9ee;
  box-shadow: 0 6px 18px rgba(31, 41, 55, .06);
}
.pf-link-row:active { transform: translateX(1px); }

/* 业务分页：滑块式选中感 */
.pf-business-tabs .tab { border-radius: 7px; }
.pf-business-tabs .tab.active { box-shadow: 0 1px 3px rgba(16, 24, 40, .07); }

/* Toast：出现和离开都有收束 */
.toast {
  transition: opacity 180ms var(--ease-standard), transform 180ms var(--ease-standard);
}
.toast.leaving {
  opacity: 0;
  transform: translateY(4px);
}

/* 滚动条：细、低对比；主滚动和内部滚动统一 */
html {
  scrollbar-width: thin;
  scrollbar-color: rgba(110, 110, 115, .28) transparent;
  scrollbar-gutter: stable;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 99px;
  background: rgba(110, 110, 115, .24);
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(110, 110, 115, .38);
  background-clip: content-box;
}
::-webkit-scrollbar-corner { background: transparent; }

/* 内部滚动不要带着整页一起滚 */
.sidebar,
.modal-body,
.chat-messages,
.requirement-detail,
.kanban-scroll,
.pf-table-scroll {
  overscroll-behavior: contain;
}
.kanban-scroll { scroll-snap-type: x proximity; }
.kanban-column { scroll-snap-align: start; }

/* 长表格固定表头，滚动留在表格内部 */
.pf-table-scroll {
  max-height: min(62vh, 640px);
  overflow: auto;
  scrollbar-width: thin;
}
.pf-table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
  box-shadow: 0 1px 0 var(--line);
}

/* 深链接 / 搜索跳转后，标题不要贴住顶栏 */
#page-content .panel,
#page-content .page-head,
#page-content .pf-detail-panel,
#page-content .requirement-detail {
  scroll-margin-top: 76px;
}

/* 情报局整页时，外层不再出现第二条滚动条 */
body:has(#page-content.intel-mode) { overflow: hidden; }

@media (max-width: 760px) {
  html { scrollbar-gutter: auto; }
  .pf-table-scroll { max-height: 58vh; }
}

@media (prefers-reduced-motion: reduce) {
  main#page-content.page-enter { animation: none !important; }
  .toast { transition: none !important; }
  .pf-list-item,
  .pf-row,
  .pf-link-row,
  .pf-portal,
  .pf-evidence-row,
  .pf-quick,
  .pf-process-card,
  .pf-agent-card,
  .pf-business-tabs .tab {
    transition: none !important;
  }
  .pf-list-item:active,
  .pf-quick:active,
  .pf-link-row:active { transform: none !important; }
  .pf-quick:hover,
  .pf-process-card:hover { transform: none !important; }
  html { scroll-behavior: auto !important; }
}
