/* =============================================================================
 * app.css · V4 壳层、左栏、中栏头 / composer、右栏标签条、通用组件、响应式
 * -----------------------------------------------------------------------------
 * 数值来源：docs/design/v4-pages.md（逐面规格）、v4-workspace-layout.md、
 *           v4-design-system.md；颜色与圆角阴影一律引用 tokens.css 的 --dsw-* / --v4-*。
 * 归属：shell-ui（左栏 / 中栏头 / composer / 右栏标签条 / 壳层 / 通用组件）。
 * 约定：chat.css 负责消息流内部样式，panels.css 负责右栏画布内部，views.css 负责次级视图；
 *       本文件提供通用组件类（.v4-btn / .v4-card / .v4-chip / .v4-dot / .v4-empty /
 *       .v4-skeleton / .v4-field-* / .v4-menu / .v4-dialog / .v4-toast）供其它 owner 复用。
 * ========================================================================== */

/* ============================== 0. 基础 ============================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--v4-bg);
  color: var(--v4-text-primary);
  font-family: var(--v4-font-family);
  font-size: var(--v4-fs-14);
  line-height: var(--v4-lh-14);
  font-weight: var(--v4-fw-regular);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button {
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

a {
  color: var(--v4-accent);
  text-decoration: none;
}

svg {
  display: block;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: var(--v4-focus-ring);
  outline-offset: 2px;
}

::selection {
  background: var(--dsw-alias-bg-document-selection);
}

/* 细滚动条（设计 §5）：WebKit 5px，thumb 用模块底；Firefox thin */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--v4-scroll-thumb) transparent;
}

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--v4-scroll-thumb);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--v4-scroll-thumb-hover);
}

/* ============================== 1. 壳层 Grid ============================== */

.app {
  position: relative;
  height: 100vh;
  height: 100dvh;
  /* 用户拖拽宽度写在 -user 变量上，收起态由 data-* 规则覆盖，避免内联样式压过收起 */
  --v4-side-w: var(--v4-side-w-user, 260px);
  --v4-work-w: var(--v4-work-w-user, 380px);
  display: grid;
  grid-template-columns: var(--v4-side-w) minmax(0, 1fr) var(--v4-work-w);
  overflow: hidden;
  transition: grid-template-columns var(--v4-dur-collapse) var(--v4-ease);
}

.app[data-side="collapsed"] {
  --v4-side-w: var(--v4-side-w-collapsed);
}

.app[data-work="collapsed"] {
  --v4-work-w: 0px;
}

/* 收起后中间栏给右缘竖条让位，避免内容被 24px 竖条压住 */
.app[data-work="collapsed"] .main {
  padding-right: var(--v4-rail-w);
}

.app[data-work="collapsed"] .workpanel {
  visibility: hidden;
  pointer-events: none;
}

.app.is-resizing,
.app.is-resizing * {
  transition: none !important;
  user-select: none;
}

/* 拖拽热区：4px 视觉宽、6px 命中宽，位于栏内缘 */
.resizer {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 6px;
  z-index: 6;
  cursor: col-resize;
  background: transparent;
  touch-action: none;
}

.resizer::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: transparent;
  transition: background 120ms var(--v4-ease);
}

.resizer:hover::after,
.app.is-resizing .resizer::after {
  background: var(--v4-accent);
}

.side-resizer {
  right: 0;
}

.side-resizer::after {
  right: 0;
}

.wp-resizer {
  left: 0;
}

.wp-resizer::after {
  left: 0;
}

/* ============================== 2. 左栏 Sidebar ============================== */

.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  background: var(--v4-bg);
  border-right: 1px solid var(--v4-border-l1);
}

/* ---- 2.1 品牌行（高 48） ---- */
.side-brand {
  flex: none;
  height: var(--v4-brand-h);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 10px 0 14px;
}

.side-logo {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--v4-bg-inverse);
  color: var(--v4-text-inverse);
  display: grid;
  place-items: center;
  font-family: var(--dsw-font-family-brand);
  font-size: 12px;
  line-height: 1;
  font-weight: 500;
}

.side-brand-name {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.side-brand-title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.side-brand-name b {
  font-size: var(--v4-fs-14);
  line-height: 18px;
  font-weight: var(--v4-fw-medium);
  color: var(--v4-text-primary);
  white-space: nowrap;
}

/* 正式版版本徽标：v1.0（悬停看完整版本与日期） */
.side-ver {
  flex: none;
  padding: 0 5px;
  border: 1px solid var(--v4-border-l3);
  border-radius: var(--v4-radius-pill);
  color: var(--v4-text-tertiary);
  font-size: 10px;
  line-height: 14px;
  letter-spacing: 0.02em;
}

.side-brand-name small {
  font-size: var(--v4-fs-11);
  line-height: 14px;
  color: var(--v4-text-caption);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-collapse {
  margin-left: auto;
}

/* ---- 2.2 新建画册（高 34、深色实心） ---- */
.side-new-wrap {
  flex: none;
  padding: 2px 12px 10px;
}

.side-new {
  width: 100%;
  height: var(--v4-newalbum-h);
  border-radius: var(--v4-radius-sm);
  background: var(--v4-primary-fill);
  color: var(--v4-text-inverse);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  font-size: var(--v4-fs-13);
  line-height: var(--v4-lh-13);
  font-weight: var(--v4-fw-medium);
  transition: background-color 120ms var(--v4-ease);
}

.side-new:hover {
  background: var(--v4-primary-fill-hover);
}

.side-new:active {
  background: var(--v4-bg-inverse);
}

.side-new-plus {
  font-size: 15px;
  line-height: 1;
  opacity: 0.75;
}

/* ---- 2.3 固定入口（委托 / 衣识，高 32） ---- */
.side-quick {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 8px;
}

.side-quick-row {
  height: var(--v4-row-h);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 8px;
  border-radius: var(--v4-radius-sm);
  font-size: var(--v4-fs-13);
  line-height: var(--v4-lh-13);
  color: var(--v4-text-primary);
  text-align: left;
}

.side-quick-row:hover {
  background: var(--v4-bg-hover);
}

.side-quick-row.is-active {
  background: var(--v4-bg-active);
}

.side-icon {
  flex: none;
  width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
  color: var(--v4-text-secondary);
}

.side-quick-label {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-badge {
  margin-left: auto;
  flex: none;
  min-width: 18px;
  height: 16px;
  padding: 0 5px;
  border-radius: var(--v4-radius-xs);
  background: var(--v4-bg-muted);
  color: var(--v4-text-tertiary);
  font-size: var(--v4-fs-11);
  line-height: 16px;
  text-align: center;
}

.side-badge[data-empty="true"] {
  display: none;
}

/* ---- 2.4 分组标题（高 30） ---- */
.side-group {
  flex: none;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 16px;
}

.side-group-title {
  font-size: var(--v4-fs-12);
  line-height: var(--v4-lh-12);
  font-weight: var(--v4-fw-medium);
  color: var(--v4-text-secondary);
}

.side-group-count {
  font-size: var(--v4-fs-12);
  line-height: var(--v4-lh-12);
  color: var(--v4-text-caption);
}

/* ---- 2.5 画册树 ---- */
.side-tree {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 8px 8px;
  overscroll-behavior: contain;
}

.album {
  border-radius: var(--v4-radius-sm);
}

.album-row {
  height: var(--v4-row-h);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px 0 4px;
  border-radius: var(--v4-radius-sm);
  user-select: none;
}

.album-row:hover {
  background: var(--v4-bg-hover);
}

.album.is-selected > .album-row {
  background: var(--v4-bg-active);
}

.album-caret {
  flex: none;
  width: 12px;
  height: 12px;
  display: grid;
  place-items: center;
  color: var(--v4-text-caption);
  font-size: 9px;
  line-height: 1;
  transition: transform 120ms var(--v4-ease);
}

.album[data-expanded="true"] > .album-row .album-caret {
  transform: rotate(90deg);
}

.album-cover {
  flex: none;
  width: 20px;
  height: 26px;
  border-radius: var(--v4-radius-xs);
  background: var(--v4-bg-muted);
  border: 1px solid var(--v4-border-l2);
  overflow: hidden;
  display: grid;
  place-items: center;
  font-size: 10px;
  line-height: 1;
  color: var(--v4-text-caption);
}

.album-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.album-name {
  flex: 1;
  min-width: 0;
  font-size: var(--v4-fs-13);
  line-height: var(--v4-lh-13);
  font-weight: var(--v4-fw-medium);
  color: var(--v4-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.album-summary {
  flex: none;
  font-size: var(--v4-fs-11);
  line-height: 14px;
  color: var(--v4-text-caption);
  font-family: var(--v4-font-family-code);
}

.album-row > .dot {
  flex: none;
}

.album-more,
.session-more {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 13px;
  line-height: 1;
  color: var(--v4-text-tertiary);
  opacity: 0;
  visibility: hidden;
}

.album-row:hover .album-more,
.session-row:hover .session-more,
.album-more[aria-expanded="true"],
.session-more[aria-expanded="true"],
.album-more:focus-visible,
.session-more:focus-visible {
  opacity: 1;
  visibility: visible;
}

.album-more:hover,
.session-more:hover {
  background: var(--v4-bg-hover);
  color: var(--v4-text-primary);
}

/* 绘画列表 */
.sessions {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0 0 4px 17px;
  padding-left: 8px;
  border-left: 1px solid var(--v4-border-l1);
}

.session-row {
  height: var(--v4-row-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px 0 8px;
  border-radius: var(--v4-radius-sm);
  color: var(--v4-text-secondary);
  font-size: var(--v4-fs-13);
  line-height: var(--v4-lh-13);
  user-select: none;
}

.session-row:hover {
  background: var(--v4-bg-hover);
}

.session-row.is-active {
  background: var(--v4-bg-active);
  color: var(--v4-text-primary);
  box-shadow: inset 2px 0 0 var(--v4-selected-bar);
}

.session-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-time {
  flex: none;
  font-size: var(--v4-fs-11);
  line-height: 14px;
  color: var(--v4-text-caption);
}

.session-row .session-more {
  margin-left: 2px;
}

/* 绘画行尾的状态点：正在跑 / 在等您回答（切到别的会话也看得见） */
.session-row > .dot {
  flex: none;
}

.new-session {
  width: 100%;
  height: 30px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border-radius: var(--v4-radius-sm);
  color: var(--v4-text-secondary);
  font-size: var(--v4-fs-13);
  line-height: var(--v4-lh-13);
  text-align: left;
}

.new-session:hover {
  background: var(--v4-bg-hover);
  color: var(--v4-text-primary);
}

.new-session-plus {
  font-size: 13px;
  line-height: 1;
  opacity: 0.7;
}

/* 行内重命名输入 */
.inline-input {
  flex: 1;
  min-width: 0;
  height: 22px;
  padding: 0 4px;
  border: 1px solid var(--v4-accent);
  border-radius: var(--v4-radius-xs);
  background: var(--v4-bg);
  color: var(--v4-text-primary);
  font-size: var(--v4-fs-13);
  line-height: var(--v4-lh-13);
}

/* 左栏状态：加载骨架 / 错误 / 空态 */
.side-state {
  padding: 10px 8px;
  font-size: var(--v4-fs-12);
  line-height: var(--v4-lh-12);
  color: var(--v4-text-caption);
}

.side-state-error {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  color: var(--v4-text-tertiary);
}

.side-state-retry {
  font-size: var(--v4-fs-12);
  color: var(--v4-accent);
}

.side-skeleton {
  height: var(--v4-row-h);
  border-radius: var(--v4-radius-sm);
  background: var(--v4-bg-skeleton);
  margin-bottom: 4px;
  animation: v4-pulse 1.6s ease-in-out infinite;
}

.side-skeleton[data-w="sm"] {
  width: 70%;
}

.side-empty {
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.side-empty-text {
  font-size: var(--v4-fs-12);
  line-height: var(--v4-lh-12);
  color: var(--v4-text-caption);
}

/* ---- 2.6 已归档（高 40） ---- */
.side-archived {
  flex: none;
  height: var(--v4-archived-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border-top: 1px solid var(--v4-border-l1);
  background: transparent;
  color: var(--v4-text-secondary);
  font-size: var(--v4-fs-12);
  line-height: var(--v4-lh-12);
  text-align: left;
}

.side-archived:hover {
  background: var(--v4-bg-hover);
}

.side-archived.is-active {
  background: var(--v4-bg-active);
  color: var(--v4-text-primary);
}

.side-archived-count {
  margin-left: auto;
  color: var(--v4-text-caption);
  font-family: var(--v4-font-family-code);
}

/* ---- 2.7 收起态（48px 图标条） ---- */
.side-covers {
  display: none;
}

.app[data-side="collapsed"] .side-brand {
  padding: 0;
  justify-content: center;
}

.app[data-side="collapsed"] .side-brand-name,
.app[data-side="collapsed"] .side-collapse,
.app[data-side="collapsed"] .side-new-label,
.app[data-side="collapsed"] .side-quick-label,
.app[data-side="collapsed"] .side-badge,
.app[data-side="collapsed"] .side-group,
.app[data-side="collapsed"] .side-tree,
.app[data-side="collapsed"] .side-archived-label,
.app[data-side="collapsed"] .side-archived-count {
  display: none;
}

.app[data-side="collapsed"] .side-new-wrap {
  display: flex;
  justify-content: center;
  padding: 4px 0 8px;
}

.app[data-side="collapsed"] .side-new {
  width: 32px;
  height: 32px;
  justify-content: center;
  padding: 0;
  border-radius: var(--v4-radius-sm);
}

.app[data-side="collapsed"] .side-new-plus {
  opacity: 1;
  font-size: 16px;
}

.app[data-side="collapsed"] .side-quick {
  padding: 0;
  align-items: center;
  gap: 4px;
}

.app[data-side="collapsed"] .side-quick-row {
  width: 32px;
  height: 32px;
  justify-content: center;
  padding: 0;
}

.app[data-side="collapsed"] .side-covers {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.side-cover-btn {
  flex: none;
  width: 32px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--v4-radius-sm);
}

.side-cover-btn:hover {
  background: var(--v4-bg-hover);
}

.side-cover-btn.is-active {
  background: var(--v4-bg-active);
}

.side-cover-more {
  font-size: var(--v4-fs-11);
  line-height: 14px;
  color: var(--v4-text-caption);
  font-family: var(--v4-font-family-code);
  padding: 2px 0 4px;
}

.app[data-side="collapsed"] .side-archived {
  justify-content: center;
  width: 100%;
  padding: 0;
}

/* ---- 2.8 收起态 hover tooltip（左栏溢出可见，不裁剪） ---- */
.app[data-side="collapsed"] .has-tip {
  position: relative;
}

.app[data-side="collapsed"] .has-tip::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  z-index: var(--v4-z-popover);
  padding: 4px 9px;
  border-radius: var(--v4-radius-sm);
  background: var(--v4-tooltip-bg);
  color: var(--v4-tooltip-text);
  font-size: var(--v4-fs-12);
  line-height: var(--v4-lh-12);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms var(--v4-ease);
}

.app[data-side="collapsed"] .has-tip:hover::after,
.app[data-side="collapsed"] .has-tip:focus-visible::after {
  opacity: 1;
}

/* ============================== 3. 中栏 Main ============================== */

.main {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--v4-bg);
  overflow: hidden;
}

.chat-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* ---- 3.1 会话头（高 48） ---- */
.chat-head {
  flex: none;
  height: var(--v4-head-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid var(--v4-border-l1);
}

.chat-head-title {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  font-size: var(--v4-fs-14);
  line-height: var(--v4-lh-14);
  font-weight: var(--v4-fw-medium);
  color: var(--v4-text-primary);
}

.chat-head-album {
  min-width: 0;
  max-width: 48%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-head-sep {
  flex: none;
  font-size: var(--v4-fs-12);
  line-height: var(--v4-lh-12);
  font-weight: var(--v4-fw-regular);
  color: var(--dsw-static-neutral-bluish-300);
}

.chat-head-session {
  min-width: 0;
  font-size: var(--v4-fs-13);
  line-height: var(--v4-lh-13);
  font-weight: var(--v4-fw-regular);
  color: var(--v4-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-head-meta {
  margin-left: auto;
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-head-dot {
  width: 6px;
  height: 6px;
}

.chat-head-status {
  font-size: var(--v4-fs-12);
  line-height: var(--v4-lh-12);
  color: var(--v4-text-secondary);
  white-space: nowrap;
}

.chat-head .iconbtn {
  margin-left: 4px;
}

/* ---- 3.2 消息区 ---- */
.chat-body {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* 每条绘画一个独立的会话宿主：切会话只切换 visible，进行中的那条继续收流，直播消息不丢 */
.chat-thread-stack {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.chat-thread-host {
  position: absolute;
  inset: 0;
}

.chat-thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px;
  overscroll-behavior: contain;
}

/* 消息列最大 720 居中（:where 零特异性，chat.css 可随时覆盖） */
.chat-thread > :where(*) {
  max-width: var(--v4-msg-max);
  margin-left: auto;
  margin-right: auto;
}

.thread-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  pointer-events: none;
}

.thread-empty > * {
  pointer-events: auto;
}

.thread-empty[data-state="loading"] {
  align-items: stretch;
  justify-content: flex-start;
  padding: 20px 24px;
}

.thread-loading {
  width: 100%;
  max-width: var(--v4-msg-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.thread-skeleton {
  height: 16px;
  border-radius: var(--v4-radius-sm);
  background: var(--v4-bg-skeleton);
  animation: v4-pulse 1.6s ease-in-out infinite;
}

.thread-skeleton[data-w="lg"] {
  width: 62%;
}

.thread-skeleton[data-w="md"] {
  width: 44%;
}

.thread-skeleton[data-w="sm"] {
  width: 30%;
}

/* ---- 3.3 状态条（composer 上方） ---- */
.chat-status {
  flex: none;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 26px;
  padding: 6px 24px 0;
  font-size: var(--v4-fs-12);
  line-height: var(--v4-lh-12);
  color: var(--v4-warn-label);
}

.chat-status-dot {
  width: 5px;
  height: 5px;
  animation: v4-breathe 1.2s ease-in-out infinite;
}

.chat-status-text {
  color: var(--v4-warn-label);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-status-action {
  flex: none;
  margin-left: 4px;
  font-size: var(--v4-fs-11);
  line-height: 16px;
  color: var(--v4-text-secondary);
  text-decoration: underline;
}

.chat-status-action:hover {
  color: var(--v4-text-primary);
}

.chat-status-action.is-accent {
  color: var(--v4-accent);
}

/* ---- 3.4 composer ---- */
.composer {
  flex: none;
  padding: 8px 24px 12px;
  border-top: 1px solid var(--v4-border-l1);
  background: var(--v4-bg);
}

.composer-box {
  width: 100%;
  max-width: var(--v4-msg-max);
  margin: 0 auto;
  padding: 10px 12px 8px;
  background: var(--v4-bg);
  border: 1px solid var(--v4-border-l3);
  border-radius: var(--v4-radius-md);
  box-shadow: var(--v4-elevation-soft);
}

.composer-box:focus-within {
  border-color: var(--v4-border-l4);
}

/* 参考图：输入框上方的缩略图行（最多 5 张，可单张移除） */
.composer-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.composer-attachments[hidden] {
  display: none;
}

.composer-ref {
  position: relative;
  width: 56px;
  height: 56px;
  border: 1px solid var(--v4-border-l2);
  border-radius: var(--v4-radius-xs);
  overflow: hidden;
  background: var(--v4-bg-subtle);
}

.composer-ref img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.composer-ref-x {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 16px;
  height: 16px;
  padding: 0;
  border-radius: 50%;
  background: rgba(23, 21, 18, 0.72);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
}

.composer-input {
  display: block;
  width: 100%;
  min-height: 42px;
  max-height: 132px;
  padding: 0;
  border: 0;
  resize: none;
  overflow-y: auto;
  background: transparent;
  color: var(--v4-text-primary);
  font-family: var(--v4-font-family);
  font-size: var(--v4-fs-14);
  line-height: var(--v4-lh-14);
  outline: none;
}

.composer-input::placeholder {
  color: var(--v4-text-caption);
}

.composer-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.composer-tool {
  height: 22px;
  padding: 0 8px;
  border-radius: var(--v4-radius-xs);
  background: var(--v4-bg-subtle);
  color: var(--v4-text-tertiary);
  font-size: var(--v4-fs-11);
  line-height: 22px;
  white-space: nowrap;
}

.composer-tool:disabled {
  opacity: 0.55;
}

.composer-busy {
  margin-left: 2px;
  font-size: var(--v4-fs-11);
  line-height: 16px;
  color: var(--v4-text-caption);
  white-space: nowrap;
}

.composer-send {
  margin-left: auto;
  height: var(--v4-send-h);
  padding: 0 12px;
  border-radius: var(--v4-radius-sm);
  background: var(--v4-primary-fill);
  color: var(--v4-text-inverse);
  font-size: var(--v4-fs-12);
  line-height: var(--v4-send-h);
  font-weight: var(--v4-fw-medium);
  transition: background-color 120ms var(--v4-ease), opacity 120ms var(--v4-ease);
}

.composer-send:hover:not(:disabled) {
  background: var(--v4-primary-fill-hover);
}

.composer-send:disabled {
  opacity: 0.4;
}

.composer-foot {
  max-width: var(--v4-msg-max);
  margin: 0 auto;
  padding-top: 8px;
  text-align: center;
  font-size: var(--v4-fs-11);
  line-height: var(--v4-lh-11);
  color: var(--v4-text-caption);
}

/* ============================== 4. 空态：门厅 / 新建画册 ============================== */

.chat-empty {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 32px 24px 56px;
}

.door {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.door-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--v4-radius-md);
  background: var(--v4-bg-inverse);
  color: var(--v4-text-inverse);
  display: grid;
  place-items: center;
  font-family: var(--dsw-font-family-brand);
  font-size: 20px;
  line-height: 1;
  font-weight: 500;
}

.door-title {
  margin: 0;
  font-size: var(--v4-fs-20);
  line-height: var(--v4-lh-20);
  font-weight: var(--v4-fw-medium);
  color: var(--v4-text-primary);
  text-align: center;
}

.door-sub {
  margin-top: -8px;
  font-size: var(--v4-fs-12);
  line-height: var(--v4-lh-12);
  color: var(--v4-text-secondary);
  text-align: center;
}

.door-guide-hint {
  margin-top: -6px;
  font-size: var(--v4-fs-11);
  line-height: var(--v4-lh-11);
  color: var(--v4-text-caption);
  text-align: center;
}

.door-box {
  width: 100%;
}

.door-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.door-chip {
  height: 26px;
  padding: 0 10px;
  border-radius: var(--v4-radius-sm);
  border: 1px solid var(--v4-border-l2);
  background: var(--v4-bg);
  color: var(--v4-text-secondary);
  font-size: var(--v4-fs-12);
  line-height: 24px;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.door-chip:hover {
  background: var(--v4-bg-hover);
  color: var(--v4-text-primary);
}

.door-note {
  font-size: var(--v4-fs-11);
  line-height: var(--v4-lh-11);
  color: var(--v4-text-caption);
  text-align: center;
}

.door-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* ============================== 5. 次级视图容器 ============================== */

.alt-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ============================== 6. 右栏 WorkPanel ============================== */

.workpanel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  background: var(--v4-bg);
  border-left: 1px solid var(--v4-border-l1);
  visibility: visible;
}

/* ---- 6.1 标签条（高 44、底 #e1e5ee） ---- */
.wp-top {
  flex: none;
  height: var(--v4-tabs-h);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  background: var(--v4-bg-module);
}

.wp-tabs {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  padding: 0 2px;
}

.wp-tabs::-webkit-scrollbar {
  display: none;
}

.wp-tab {
  flex: none;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border-radius: var(--v4-radius-sm);
  background: transparent;
  color: var(--v4-text-secondary);
  font-size: var(--v4-fs-12);
  line-height: var(--v4-lh-12);
  white-space: nowrap;
}

.wp-tab:hover {
  background: var(--v4-bg-hover);
  color: var(--v4-text-primary);
}

.wp-tab[aria-selected="true"] {
  background: var(--v4-bg);
  color: var(--v4-text-primary);
  font-weight: var(--v4-fw-medium);
  box-shadow: var(--v4-elevation-stroke), var(--v4-shadow-lv1);
}

.wp-tab-label {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wp-tab-x {
  flex: none;
  width: 14px;
  height: 14px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  font-size: 11px;
  line-height: 1;
  color: var(--v4-text-tertiary);
}

.wp-tab-x:hover {
  background: var(--v4-bg-active);
  color: var(--v4-text-primary);
}

.wp-top-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
}

/* ---- 6.2 内容区 ---- */
.wp-views {
  position: relative;
  flex: 1;
  min-height: 0;
}

/* 每个标签一屏：高度确定、内容由 panels.js 自己滚动（契约 §2.4），容器不加 padding */
.wp-view {
  position: absolute;
  inset: 0;
  display: none;
  overflow: hidden;
  padding: 0;
}

.wp-view[data-active="true"] {
  display: block;
}

/* 工作界面加载 / 错误 / 缺模块占位（panels.js 接管前的兜底） */
.wp-placeholder {
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 24px 12px;
}

.wp-empty {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
}

.wp-empty-plus {
  width: 34px;
  height: 34px;
  border-radius: var(--v4-radius-sm);
  border: 1px solid var(--v4-border-l3);
  background: var(--v4-bg);
  color: var(--v4-text-secondary);
  display: grid;
  place-items: center;
  font-size: 16px;
  line-height: 1;
}

.wp-empty-plus:hover {
  background: var(--v4-bg-hover);
  color: var(--v4-text-primary);
}

/* ---- 6.3 收起竖条（24px，hover 出「工作界面 · N」） ---- */
.wp-rail {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  width: var(--v4-rail-w);
  border-left: 1px solid var(--v4-border-l1);
  background: var(--v4-bg);
}

.wp-rail-bar {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1px;
  height: 40px;
  transform: translate(-50%, -50%);
  background: var(--v4-border-l2);
}

.wp-rail-inner {
  position: absolute;
  top: 50%;
  right: calc(100% + 8px);
  transform: translateY(-50%);
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--v4-radius-sm);
  background: var(--v4-bg);
  border: 1px solid var(--v4-border-l2);
  box-shadow: var(--v4-shadow-lv2);
  color: var(--v4-text-secondary);
  font-size: var(--v4-fs-12);
  line-height: var(--v4-lh-12);
  white-space: nowrap;
}

.wp-rail:hover .wp-rail-inner,
.wp-rail:focus-visible .wp-rail-inner {
  display: flex;
}

.wp-rail-dot {
  width: 6px;
  height: 6px;
}

.wp-rail-count {
  font-weight: var(--v4-fw-regular);
}

/* <1200：右栏改为浮层 */
.workpanel[data-overlay="true"] {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: var(--v4-z-drawer);
  width: min(var(--v4-work-w-overlay), calc(100vw - 32px));
  border-left: 1px solid var(--v4-border-l2);
  box-shadow: var(--v4-shadow-lv3);
  transform: translateX(100%);
  transition: transform var(--v4-dur-drawer) var(--v4-ease-drawer);
}

.app[data-work="expanded"] .workpanel[data-overlay="true"] {
  transform: none;
  visibility: visible;
  pointer-events: auto;
}

.app[data-work="collapsed"] .workpanel[data-overlay="true"] {
  visibility: visible;
  pointer-events: none;
}

/* ============================== 7. 遮罩 / 抽屉 ---- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: calc(var(--v4-z-drawer) - 1);
  background: var(--v4-bg-mask);
}

/* ============================== 8. 底部动作条（<900） ============================== */

.mobile-bar {
  display: none;
}

/* ============================== 9. 菜单 / 对话框 / toast ============================== */

.menu-root {
  position: fixed;
  inset: 0;
  z-index: var(--v4-z-popover);
  pointer-events: none;
}

.menu-root > * {
  pointer-events: auto;
}

.menu {
  position: absolute;
  min-width: 200px;
  padding: 4px;
  background: var(--v4-menu-bg);
  border: 1px solid var(--v4-menu-stroke);
  border-radius: var(--v4-radius-md);
  box-shadow: var(--v4-shadow-lv2);
}

.menu[data-width="240"] {
  width: 240px;
}

.menu-item {
  width: 100%;
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  border-radius: var(--v4-radius-sm);
  color: var(--v4-text-primary);
  font-size: var(--v4-fs-13);
  line-height: var(--v4-lh-13);
  text-align: left;
}

.menu-item:hover:not(:disabled),
.menu-item:focus-visible:not(:disabled) {
  background: var(--v4-bg-hover);
}

.menu-item:disabled {
  color: var(--v4-text-caption);
}

.menu-item.is-danger {
  color: var(--v4-error);
}

.menu-hint {
  margin-left: auto;
  font-size: var(--v4-fs-11);
  line-height: 14px;
  color: var(--v4-text-caption);
  font-weight: var(--v4-fw-regular);
}

.menu-item:disabled .menu-hint {
  color: var(--v4-text-caption);
}

.menu-label {
  padding: 6px 8px 4px;
  font-size: var(--v4-fs-11);
  line-height: 14px;
  color: var(--v4-text-caption);
}

.menu-sep {
  height: 1px;
  margin: 4px 6px;
  background: var(--v4-border-l1);
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--v4-z-dialog);
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--v4-bg-mask);
}

.dialog {
  width: min(380px, 100%);
  padding: 20px;
  background: var(--v4-bg);
  border-radius: var(--v4-radius-lg);
  box-shadow: var(--v4-shadow-lv3);
}

.dialog-title {
  margin: 0 0 8px;
  font-size: var(--v4-fs-16);
  line-height: var(--v4-lh-16);
  font-weight: var(--v4-fw-medium);
  color: var(--v4-text-primary);
}

.dialog-text {
  margin: 0;
  font-size: var(--v4-fs-13);
  line-height: var(--v4-lh-13);
  color: var(--v4-text-secondary);
}

.dialog-input {
  width: 100%;
  height: 34px;
  margin-top: 12px;
  padding: 0 10px;
  border: 1px solid var(--v4-border-l3);
  border-radius: var(--v4-radius-sm);
  background: var(--v4-bg);
  color: var(--v4-text-primary);
  font-size: var(--v4-fs-14);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.toast-root {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: var(--v4-z-toast);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  max-width: min(480px, calc(100vw - 32px));
  padding: 7px 12px;
  border-radius: var(--v4-radius-sm);
  background: var(--v4-toast-bg);
  color: var(--v4-toast-text);
  font-size: var(--v4-fs-12);
  line-height: var(--v4-lh-12);
  box-shadow: var(--v4-shadow-lv2);
}

.toast[data-tone="error"] {
  background: var(--v4-error);
}

/* ============================== 10. 通用组件（供 chat/panels/views 复用） ============================== */

.iconbtn {
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--v4-text-secondary);
  font-size: 13px;
  line-height: 1;
}

.iconbtn:hover {
  background: var(--v4-bg-hover);
  color: var(--v4-text-primary);
}

.iconbtn[aria-expanded="true"] {
  background: var(--v4-bg-active);
  color: var(--v4-text-primary);
}

.v4-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--v4-radius-sm);
  font-size: var(--v4-fs-13);
  line-height: var(--v4-lh-13);
  font-weight: var(--v4-fw-medium);
  white-space: nowrap;
}

.v4-btn:disabled {
  opacity: 0.4;
}

.v4-btn-primary {
  background: var(--v4-primary-fill);
  color: var(--v4-text-inverse);
}

.v4-btn-primary:hover:not(:disabled) {
  background: var(--v4-primary-fill-hover);
}

.v4-btn-primary.is-danger {
  background: var(--v4-error);
}

.v4-btn-primary.is-danger:hover:not(:disabled) {
  background: var(--v4-error);
  opacity: 0.88;
}

.v4-btn-secondary {
  background: var(--v4-bg);
  color: var(--v4-text-primary);
  border-color: var(--v4-border-l3);
}

.v4-btn-secondary:hover:not(:disabled) {
  background: var(--v4-bg-hover);
}

.v4-btn-ghost {
  background: transparent;
  color: var(--v4-text-secondary);
}

.v4-btn-ghost:hover:not(:disabled) {
  background: var(--v4-bg-hover);
  color: var(--v4-text-primary);
}

.v4-btn-text {
  height: auto;
  padding: 0;
  background: none;
  color: var(--v4-accent);
  font-weight: var(--v4-fw-medium);
}

.v4-btn-text:hover:not(:disabled) {
  text-decoration: underline;
}

.v4-btn-sm {
  height: 28px;
  padding: 0 10px;
  border-radius: var(--v4-radius-sm);
  font-size: var(--v4-fs-12);
  line-height: var(--v4-lh-12);
}

.v4-btn.is-danger {
  color: var(--v4-error);
  border-color: var(--v4-border-l3);
}

.v4-card {
  background: var(--v4-bg-layer-1);
  border: 1px solid var(--v4-border-l2);
  border-radius: var(--v4-radius-md);
  box-shadow: var(--v4-shadow-lv1);
  padding: 14px;
}

.v4-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--v4-radius-xs);
  background: var(--v4-bg-muted);
  color: var(--v4-text-secondary);
  font-size: var(--v4-fs-12);
  line-height: 22px;
  font-weight: var(--v4-fw-medium);
  white-space: nowrap;
}

.v4-chip[data-tone="accent"] {
  background: var(--v4-accent-soft);
  color: var(--v4-accent);
}

.v4-chip[data-tone="warn"] {
  background: var(--v4-warn-soft);
  color: var(--v4-warn-label);
}

.v4-chip[data-tone="success"] {
  background: var(--v4-success-soft);
  color: var(--v4-text-primary);
}

.v4-chip[data-tone="error"] {
  background: var(--v4-error-soft);
  color: var(--v4-error);
}

.v4-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--v4-idle-dot);
  flex: none;
}

.v4-dot[data-tone="idle"] {
  background: var(--v4-idle-dot);
}

.v4-dot[data-tone="info"] {
  background: var(--v4-accent);
}

.v4-dot[data-tone="warn"] {
  background: var(--v4-warn);
}

.v4-dot[data-tone="success"] {
  background: var(--v4-success);
}

.v4-dot[data-tone="error"] {
  background: var(--v4-error);
}

.v4-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px 16px;
  text-align: center;
}

.v4-empty-icon {
  width: 32px;
  height: 32px;
  color: var(--v4-text-caption);
}

.v4-empty-title {
  font-size: var(--v4-fs-14);
  line-height: var(--v4-lh-14);
  color: var(--v4-text-secondary);
}

.v4-empty-hint {
  font-size: var(--v4-fs-12);
  line-height: var(--v4-lh-12);
  color: var(--v4-text-caption);
}

.v4-skeleton {
  background: var(--v4-bg-skeleton);
  border-radius: var(--v4-radius-sm);
  animation: v4-pulse 1.6s ease-in-out infinite;
}

.v4-error-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--v4-fs-12);
  line-height: var(--v4-lh-12);
  color: var(--v4-text-tertiary);
}

.v4-field-label {
  display: block;
  font-size: var(--v4-fs-11);
  line-height: var(--v4-lh-11);
  color: var(--v4-text-caption);
}

.v4-field-value {
  display: block;
  margin-top: 2px;
  font-size: var(--v4-fs-13);
  line-height: var(--v4-lh-13);
  font-weight: var(--v4-fw-medium);
  color: var(--v4-text-primary);
  overflow-wrap: anywhere;
}

.v4-section-title {
  font-size: var(--v4-fs-11);
  line-height: var(--v4-lh-11);
  color: var(--v4-text-caption);
}

.v4-caption {
  font-size: var(--v4-fs-11);
  line-height: var(--v4-lh-11);
  color: var(--v4-text-caption);
}

.v4-hairline {
  height: 1px;
  background: var(--v4-border-l1);
}

.v4-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v4-scroll {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.v4-link {
  color: var(--v4-accent);
  font-size: var(--v4-fs-12);
}

.v4-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.v4-page-head {
  flex: none;
  height: var(--v4-head-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid var(--v4-border-l1);
}

.v4-page-title {
  font-size: var(--v4-fs-14);
  line-height: var(--v4-lh-14);
  font-weight: var(--v4-fw-medium);
}

.v4-page-count {
  font-size: var(--v4-fs-12);
  line-height: var(--v4-lh-12);
  color: var(--v4-text-caption);
  font-family: var(--v4-font-family-code);
}

.v4-page-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 24px 32px;
}

.v4-page-inner {
  width: 100%;
  max-width: var(--v4-page-max);
  margin: 0 auto;
}

/* ============================== 11. 动效 ============================== */

@keyframes v4-breathe {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

@keyframes v4-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

@keyframes v4-blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

/* ============================== 12. 响应式 ============================== */

/* ---- 12.1 <1200：右栏默认收起、展开为浮层 ---- */
@media (max-width: 1199px) {
  .app {
    grid-template-columns: var(--v4-side-w) minmax(0, 1fr) 0px;
  }

  .app[data-work="collapsed"] .main {
    padding-right: var(--v4-rail-w);
  }

  .app[data-work="expanded"] .main {
    padding-right: 0;
  }

  .wp-resizer {
    display: none;
  }
}

/* ---- 12.2 <900：左右栏抽屉 + 底部动作条 ---- */
@media (max-width: 899px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }

  /* 左栏 → 抽屉 */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: var(--v4-z-drawer);
    width: min(300px, 86vw);
    border-right: 1px solid var(--v4-border-l2);
    box-shadow: var(--v4-shadow-lv3);
    transform: translateX(-100%);
    transition: transform var(--v4-dur-drawer) var(--v4-ease-drawer);
  }

  .app[data-side="expanded"] .sidebar {
    transform: none;
  }

  .app[data-side="collapsed"] .sidebar {
    transform: translateX(-100%);
  }

  /* 抽屉里恢复完整左栏外观（不再用 48px 收起态） */
  .app[data-side="expanded"] .side-brand {
    padding: 0 10px 0 14px;
    justify-content: flex-start;
  }

  .app[data-side="expanded"] .side-brand-name,
  .app[data-side="expanded"] .side-collapse,
  .app[data-side="expanded"] .side-new-label,
  .app[data-side="expanded"] .side-quick-label,
  .app[data-side="expanded"] .side-badge,
  .app[data-side="expanded"] .side-group,
  .app[data-side="expanded"] .side-tree,
  .app[data-side="expanded"] .side-archived-label,
  .app[data-side="expanded"] .side-archived-count {
    display: flex;
  }

  .app[data-side="expanded"] .side-new-wrap {
    display: block;
    padding: 2px 12px 10px;
  }

  .app[data-side="expanded"] .side-new {
    width: 100%;
    height: 40px;
    justify-content: flex-start;
    padding: 0 10px;
  }

  .app[data-side="expanded"] .side-quick {
    padding: 0 8px;
    align-items: stretch;
  }

  .app[data-side="expanded"] .side-quick-row {
    width: auto;
    height: 40px;
    justify-content: flex-start;
    padding: 0 8px;
  }

  .app[data-side="expanded"] .side-covers {
    display: none;
  }

  .app[data-side="expanded"] .side-archived {
    height: 44px;
    justify-content: flex-start;
    padding: 0 16px;
  }

  .app[data-side="expanded"] .side-collapse {
    display: grid;
  }

  .side-resizer {
    display: none;
  }

  /* 抽屉里的行高 ≥40（触控目标，F6.5） */
  .album-row,
  .session-row,
  .new-session,
  .side-quick-row {
    min-height: var(--v4-touch-min);
    height: var(--v4-touch-min);
  }

  .side-archived {
    height: var(--v4-touch-min);
  }

  .side-group {
    height: 32px;
  }

  /* 右栏 → 浮层（底部动作条触发） */
  .workpanel[data-overlay="true"] {
    width: min(560px, 100vw - 24px);
  }

  .wp-rail {
    display: none;
  }

  /* 底部动作条 */
  .mobile-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 56px;
    padding: 0 12px;
    background: var(--v4-bg);
    border-top: 1px solid var(--v4-border-l1);
  }

  .mobile-bar-btn {
    height: var(--v4-touch-min);
    min-width: 64px;
    padding: 0 12px;
    border-radius: var(--v4-radius-sm);
    background: var(--v4-bg-subtle);
    color: var(--v4-text-primary);
    font-size: var(--v4-fs-13);
    line-height: var(--v4-touch-min);
    font-weight: var(--v4-fw-medium);
  }

  .mobile-bar-btn:hover {
    background: var(--v4-bg-hover);
  }

  .mobile-bar-crumb {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: var(--v4-fs-12);
    line-height: var(--v4-lh-12);
    color: var(--v4-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .main {
    padding-bottom: 56px;
    padding-right: 0;
  }

  .app[data-work="collapsed"] .main {
    padding-right: 0;
  }

  /* 中栏紧凑 */
  .chat-head {
    padding: 0 12px;
    gap: 8px;
  }

  .chat-head-album {
    max-width: 42%;
  }

  .chat-head-status {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .chat-head .iconbtn,
  .iconbtn {
    width: 36px;
    height: 36px;
  }

  .chat-thread {
    padding: 16px;
  }

  .thread-empty,
  .thread-empty[data-state="loading"] {
    padding: 16px;
  }

  .chat-status {
    padding: 6px 16px 0;
  }

  .composer {
    padding: 8px 12px 10px;
  }

  .composer-send {
    height: 34px;
    line-height: 34px;
    padding: 0 14px;
  }

  .composer-tool {
    height: 28px;
    line-height: 28px;
  }

  .chat-empty {
    padding: 24px 16px 40px;
  }

  .door {
    gap: 14px;
  }

  .door-title {
    font-size: var(--v4-fs-16);
    line-height: var(--v4-lh-16);
  }

  .door-chip {
    height: 32px;
    line-height: 30px;
  }

  /* 右栏标签条触控 */
  .wp-top {
    height: var(--v4-tabs-h);
    padding: 0 8px;
  }

  .wp-tab {
    height: 30px;
    padding: 0 10px;
  }

  .wp-view {
    padding: 12px;
  }

  .v4-page-body {
    padding: 12px 16px 24px;
  }
}

/* ============================== 13. 减弱动效 ============================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
