/* 邮箱页（mailbox / admin_self_mail 等复用） */
.app-h { min-height: calc(100vh - 64px); }
.list-pane { height: 100%; min-height: 420px; overflow: auto; }
.detail-pane { height: 100%; min-height: 420px; overflow: hidden; }
.mail-card { cursor: pointer; transition: box-shadow 0.15s ease; }
.mail-card:hover { box-shadow: var(--x-shadow-hover); }
.mail-card.selected { outline: 2px solid rgba(26, 115, 232, 0.35); background: rgba(26, 115, 232, 0.05); }
.pill-btn { border-radius: 999px; }
.toolbar { position: sticky; top: 0; z-index: 2; background: var(--x-surface); padding-bottom: 0.5rem; margin-bottom: 0.75rem; border-bottom: 1px solid var(--x-border); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.t-small { font-size: 13px; color: var(--x-muted); }
.msg-subject { font-weight: 600; font-size: 1rem; }
.list-pane .mail-card .card-body { font-size: 0.9375rem; }
.detail-mail-card { border: 1px solid var(--x-border); border-radius: var(--x-radius); overflow: hidden; background: var(--x-surface); }
.detail-mail-hdr:not(.conv-card-hdr) { padding: 12px 14px; background: #fff; }
.mail-detail-hdr.conv-card-hdr { border-bottom-color: rgba(26, 115, 232, 0.18) !important; }
.detail-mail-body { padding: 12px 14px; border-top: 1px solid #eee; }

/* 默认 / 对话展开：正文、附件标题栏 — 左对齐、左侧强调条（与全局 .x-section-bar 区分） */
.detail-pane .detail-mail-body > .x-section-bar,
.conv-card-fold .conv-card-body > .x-section-bar,
.conv-card-fold .conv-card-attachments > .x-section-bar {
  justify-content: flex-start;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  padding: 4px 10px 5px 6px;
  margin-bottom: 0.35rem;
  border: none;
  border-radius: 0 6px 6px 0;
  background: linear-gradient(90deg, rgba(26, 115, 232, 0.09), rgba(26, 115, 232, 0.02));
  box-shadow: inset 3px 0 0 rgba(26, 115, 232, 0.45);
}
.detail-pane .detail-mail-body > .x-section-bar .x-subsection-title,
.conv-card-fold .x-section-bar .x-subsection-title {
  font-size: 12px;
  letter-spacing: 0.03em;
  color: #3d5a80;
}
.detail-pane .detail-mail-body > .x-section-bar {
  margin-left: -6px;
  padding-left: 8px;
}
.conv-card-fold .conv-card-body > .x-section-bar,
.conv-card-fold .conv-card-attachments > .x-section-bar {
  margin-left: -4px;
  padding-left: 6px;
}
.conv-card-fold .conv-card-attachments > .x-section-bar {
  padding-top: 8px;
}
.toolbar .input-group { max-width: 420px; }
.mail-toolbar-search { min-width: 160px; max-width: 420px; }
.mail-toolbar-search--narrow { max-width: 360px; }
.text-pre-wrap { white-space: pre-wrap; }
.detail-pane #detailBodyText.small,
.conv-card-fold .conv-card-body-text.small { font-size: 0.9375rem !important; }

/* 默认列表：单封未读主题加粗 */
.mail-card.x-unread .msg-subject { font-weight: 800; }

/* 对话模式：同线程内任一则未读，中间列表主题加粗 */
.mail-card.x-thread-unread .msg-subject { font-weight: 800; }

/* ---------- 默认模式详情：整栏滚动 ---------- */
.detail-default-wrap { overflow: hidden; }

/* ---------- 对话模式：顶搜 + 垂直滚动卡片流 ---------- */
.detail-thread-wrap { overflow: hidden; }
.thread-conv-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}
.thread-conv-list { display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; }

/* 卡片头：与正文/附件区明显区分（Fluent 风格浅强调） */
.conv-card {
  border: 1px solid var(--x-border);
  border-radius: 10px;
  /* 允许“其他”下拉浮层溢出卡片显示，不被正文折叠区裁剪 */
  overflow: visible;
  background: var(--x-surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.conv-card--active { outline: 2px solid rgba(26, 115, 232, 0.35); }
.conv-card--unread .conv-row-title .conv-subject { font-weight: 800; }

.conv-card-hdr {
  /* 折叠预览与展开按钮区同宽，避免 1fr 列在展开/折叠时重算导致时间列跳动 */
  --conv-trailing-w: clamp(10.75rem, 34%, 17.5rem);
  padding: 6px 10px 6px;
  background: linear-gradient(180deg, #e8eef8 0%, #dfe8f5 100%);
  border-bottom: 1px solid rgba(26, 115, 232, 0.18);
  cursor: default;
  user-select: none;
}
.conv-hdr-trailing-slot {
  flex: 0 0 var(--conv-trailing-w);
  min-width: 0;
  max-width: var(--conv-trailing-w);
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 4px;
}
.conv-hdr-trailing-slot > .btn-group {
  flex-shrink: 0;
}
.conv-card-hdr .btn-group,
.conv-card-hdr .dropdown,
.conv-card-hdr a,
.conv-card-hdr button { user-select: none; }
.conv-card-hdr .dropdown-menu {
  z-index: 1085;
}
.dropdown-menu.xysmt-dd-portal {
  /* portal 到 body 后仍按 dropdown-menu 样式展示 */
  display: block;
}
.conv-card-hdr .btn-sm { font-size: 0.8125rem; }

.conv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 1.15rem;
  font-size: 12px;
  line-height: 1.3;
}
.conv-row + .conv-row { margin-top: 2px; }
.conv-row.conv-row-actions {
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
}
.conv-row-actions > .conv-hdr-meta-grid {
  flex: 1 1 0;
  min-width: 0;
}
.conv-row-title { padding-bottom: 0; border-bottom: 1px dashed rgba(26, 115, 232, 0.15); margin-bottom: 2px; }
.conv-subject { font-weight: 600; font-size: 13px; flex: 1; min-width: 0; }
.conv-folder-badge { flex-shrink: 0; font-size: 11px; }
/* 折叠：右侧预览占第 2、3 行，正常换行后最多显示两行高度 */
.conv-preview-2l {
  white-space: normal;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
  width: 100%;
  font-size: 12px;
  line-height: 1.35;
  max-height: calc(2 * 1.35em);
}
/* 展开/默认详情：发件人·收件人一列对齐，发件时间·收件时间一列对齐 */
.conv-hdr-meta-grid {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content minmax(10.5rem, 1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 4px;
  justify-items: start;
  align-items: center;
  text-align: left;
  font-size: 12px;
  line-height: 1.3;
}
.conv-hdr-meta-lbl {
  color: var(--x-muted);
  white-space: nowrap;
  justify-self: start;
  text-align: left;
}
.conv-hdr-meta-val {
  min-width: 0;
  text-align: left;
  color: var(--x-text, #212529);
}
/* 发件人/收件人：与 text-truncate 配合需 inline-block + 宽度约束，悬停 title 显示全文 */
.conv-hdr-meta-val.conv-hdr-meta-addr {
  display: inline-block;
  max-width: 100%;
  vertical-align: bottom;
  box-sizing: border-box;
}
.conv-hdr-meta-val-time {
  min-width: 0;
  text-align: left;
  color: var(--x-muted);
  font-weight: 400;
}

/* 折叠：左侧与展开同一 .conv-hdr-meta-grid；预览宽度固定区间，剩余给左侧 */
.conv-hdr-collapsed-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-top: 2px;
  min-width: 0;
}
.conv-hdr-collapsed-row .conv-hdr-meta-grid {
  flex: 1 1 0;
  min-width: 0;
}
.conv-hdr-collapsed-row .conv-hdr-cpreview {
  flex: 0 0 var(--conv-trailing-w);
  max-width: var(--conv-trailing-w);
  min-width: 0;
  align-self: stretch;
  display: block;
  box-sizing: border-box;
}

/* 正文 + 附件：中性底，与头部区分 */
.conv-card-fold { background: #fafbfc; border-top: 1px solid rgba(0, 0, 0, 0.06); }
.conv-card-body { padding: 10px 12px; font-size: 14px; line-height: 1.5; color: #333; }
.conv-card-attachments { padding: 0 12px 6px; border-top: 1px dashed rgba(0, 0, 0, 0.08); }
.conv-card-attachments .list-group-item { background: transparent; font-size: 12px; }

.conv-collapse-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border: 0;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding: 4px 8px 6px;
  background: #eef1f5;
  color: var(--x-muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}
.conv-collapse-bar:hover { background: #e2e6ec; color: #333; }
.conv-collapse-caret {
  display: block;
  font-weight: 700;
  font-size: 1rem;
  line-height: 0.6;
  transform: scaleY(0.85);
}

.conv-card.conv-search-hide { display: none !important; }
