/* ══════════════════════════════════════════════════════════════
   19-fine-tuning —— 穿模/越界修复与全局精细化（全站最后加载）
   · 记事本输入区贴边拥挤修复
   · 表单控件字体继承统一（button/input/select/textarea 默认不继承 body 字体）
   · 复选框/占位符统一、中宽度顶栏防挤压
   ══════════════════════════════════════════════════════════════ */

/* ───────────────────────── 1. 控件字体继承统一 ───────────────────────── */
/* UA 默认下 button/input/select/textarea 不继承 body 字体栈，
   中文渲染会退回系统默认字体，与界面其余文字不一致 */
button, input, select, textarea { font-family: inherit; }

::placeholder { color: var(--text3); opacity: 1; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }

/* ───────────────────────── 2. 记事本输入区：消除贴边拥挤 ───────────────────────── */
.chatroom-input-area { gap: 10px; }
.chatroom-input-stack { padding: 10px 14px 8px; gap: 8px; }
.chatroom-voice-toolbar { align-items: center; gap: 12px; }
/* 语音状态 → 与对话页一致的胶囊 */
.chatroom-voice-status {
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 0;
  font-size: 11px; color: var(--text3);
  background: color-mix(in srgb, var(--surface2) 55%, transparent);
  border: 1px solid var(--hairline);
  border-radius: 999px; padding: 4px 11px;
  max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chatroom-voice-status.listening {
  color: var(--primary-hover);
  border-color: color-mix(in srgb, var(--primary) 35%, transparent);
  background: var(--primary-a08);
}
.chatroom-voice-status.error {
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 35%, transparent);
  background: color-mix(in srgb, var(--red) 8%, transparent);
}
.chatroom-voice-mode-row { gap: 14px; align-items: center; flex-shrink: 0; }
.chatroom-voice-mode { font-size: 11.5px; }
.chatroom-voice-mode input { flex-shrink: 0; }
/* 输入框本体：卡片内不再自带边框 */
.chatroom-input-area textarea {
  padding: 4px 2px 6px;
  min-height: 26px;
}
/* 语音草稿：与对话页一致的虚线描边样式 */
.chatroom-voice-draft {
  border: 1px dashed color-mix(in srgb, var(--primary) 30%, transparent);
  background: var(--primary-a08);
  border-radius: 12px;
  padding: 10px 12px;
}
.chatroom-voice-draft-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--primary-hover);
}
.chatroom-voice-draft-btn { border-radius: 7px; }
.pending-image-list { padding: 2px 0; }

/* 对话页输入区：工具条与卡片边缘保持相同内边距（对齐视觉） */
.chat-input-stack { padding-left: 14px; padding-right: 14px; }
.chat-voice-toolbar { align-items: center; }

/* ───────────────────────── 3. 中宽度顶栏防挤压（769–1150px） ───────────────────────── */


/* ───────────────────────── 4. 排版与对齐微调 ───────────────────────── */
/* 数字类徽章/计数统一等宽数字 */
.badge, .v2-badge, .kanban-badge, .mc-badge, .mission-pill,
.pl-nav-item small, .library-post-scope, .login-brand-badge { font-variant-numeric: tabular-nums; }

/* 面板内 section 标题行基线对齐 */
.panel-section-head { align-items: baseline; }

/* 顶栏动作区按钮统一垂直居中（部分内联按钮基线偏移） */
.v2-topbar-actions { align-items: center; }
.v2-topbar-actions > * { flex-shrink: 0; }

/* 弹窗内表单 label 与控件间距统一 */
.modal .form-label { letter-spacing: 0.2px; }

/* 滚动容器贴底时留出呼吸位（避免内容顶着窗口下缘） */
.chat-messages { scroll-padding-bottom: 12px; }
.dashboard, .notif-panel { scroll-padding-bottom: 16px; }

/* ───────────────────────── 5. 无障碍：尊重系统"减少动态效果"设置 ───────────────────────── */
@media (prefers-reduced-motion: reduce) {
  /* 装饰性动画/过渡压缩到近乎即时（保留 animationend 等事件语义，不直接 animation:none） */
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  /* 功能性加载指示（spinner）不旋转也不消失，降为静态半透明，保留"正在加载"语义 */
  .library-loading, .wft-rel-loader, .td-checklist-generating {
    animation: none !important;
    opacity: 0.6;
  }
}

/* ───────────────────────── 6. 低性能模式：运行时检测到掉帧时由 JS 加在 <html> 上 ───────────────────────── */
/* 覆盖 Edge 效率模式、增强安全模式（JIT 被禁）、GPU 软渲染等客户端环境，关闭装饰性开销 */
.perf-lite *, .perf-lite *::before, .perf-lite *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}
.perf-lite .panel, .perf-lite .sidebar, .perf-lite .v2-topbar, .perf-lite .chat-sessions-sidebar,
.perf-lite .stat-card, .perf-lite .dashboard-card, .perf-lite .dashboard-live-card,
.perf-lite .node-card, .perf-lite .kanban-card, .perf-lite .member-card, .perf-lite .notif-card,
.perf-lite .nav-item.active, .perf-lite .sidebar-brand-icon, .perf-lite .modal, .perf-lite .td-modal,
.perf-lite .v2-popover, .perf-lite .chat-input-stack, .perf-lite .chat-image,
.perf-lite button, .perf-lite .message-image-button img {
  box-shadow: none !important;
}
