/* 39-table-viewer.css — 对话表格:横滑 + 全屏查看(table-viewer.js)
   对话里保持轻:样式不变(只有行线),放不下就横滑(可横滑的边缘提示待定,原写法只有遮罩没有阴影、从未生效,已删);
   每个表格下方右侧一行"全屏查看"(按行列数时有时无会让人困惑,已否决)。全屏 PC 沿用 24-work-layer 漂浮窗口外观,手机整页。
   两种主题共用同一套令牌,不新增颜色。 */

/* ── 对话里的表格 ── */
.msg-ai-content .md-table { margin: 32px 0; }
.msg-ai-content .md-table > .md-table-scroll > table { margin: 0; }
.msg-ai-content .md-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
/* 表头不折行:每列至少有表头宽,中文不再被挤成一两个字一行;合计放不下时整表横滑 */
.msg-ai-content .md-table th { white-space: nowrap; }
/* 中文只在标点/空格处折行,"恩纳村""另付"这类短词不再被拆;过长内容整表横滑 */
.msg-ai-content .md-table td { word-break: keep-all; overflow-wrap: break-word; }

@media (max-width: 768px) {
  .msg-ai-content .md-table { margin: 16px 0 8px; }
}

/* ── 全屏入口:每个表格下方右侧一行"全屏查看",电脑手机一致、常驻显示 ── */
.msg-ai-content .md-table { display: flex; flex-direction: column; }
.md-table-expand {
  align-self: flex-end; margin-top: 6px;
  display: inline-flex; align-items: center; gap: 5px;
  height: 28px; padding: 0 8px; margin-right: -8px;
  border: 0; border-radius: 8px; background: none; cursor: pointer;
  font: inherit; font-size: 13px; line-height: 1; color: var(--text-muted);
  transition: background-color .15s ease, color .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.md-table-expand:hover, .md-table-expand:active { background: var(--bg-hover); color: var(--text-bright); }
.md-table-expand:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 2px; }

/* ── 全屏:PC 漂浮窗口(外壳用 .work-layer*)── */
.tv-window { display: flex; flex-direction: column; }
.tv-head {
  display: flex; align-items: baseline; gap: 10px;
  padding: 14px 20px; border-bottom: 1px solid var(--border-light);
}
.tv-head b, .tv-title b { font-size: 15px; font-weight: 600; color: var(--text-bright); }
.tv-head span, .tv-title span { font-size: 12.5px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.tv-window .tv-body { border-radius: 0 0 var(--radius-md) var(--radius-md); }
.tv-window .tv-head { flex: none; }

/* ── 全屏:手机整页 ── */
.tv-page {
  position: fixed; inset: 0; z-index: 8000;
  display: flex; flex-direction: column;
  background: var(--bg-base); color: var(--text-main);
  animation: wl-fade-in .18s ease;
}
.tv-page-head {
  flex: none;
  height: calc(56px + var(--app-top-inset));
  padding: var(--app-top-inset) 6px 0;
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center;
  border-bottom: 1px solid var(--border-light);
}
.tv-back {
  width: 44px; height: 44px; padding: 0; border: 0; background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: var(--text-main);
  -webkit-tap-highlight-color: transparent;
}
.tv-title { text-align: center; line-height: 1.3; }
.tv-title b, .tv-title span { display: block; }

/* ── 全屏里的表格:表头与第一列固定、列宽按内容、所在行高亮 ── */
.tv-body {
  flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tv-body table {
  border-collapse: separate; border-spacing: 0;
  width: max-content; min-width: 100%;
  font-size: 14px; line-height: 1.6;
}
.tv-body th, .tv-body td {
  padding: 11px 22px 11px 0; text-align: left; vertical-align: top;
  white-space: nowrap; background: var(--bg-base);
  border-bottom: 1px solid var(--border-light);
}
.tv-body th {
  position: sticky; top: 0; z-index: 2;
  font-weight: 600; color: var(--text-bright);
}
.tv-body td { color: var(--text-body); font-variant-numeric: tabular-nums; }
.tv-body th:first-child, .tv-body td:first-child {
  position: sticky; left: 0; z-index: 1;
  padding-left: 20px; box-shadow: 1px 0 0 var(--border-light);
}
.tv-body th:first-child { z-index: 3; }
.tv-body td:first-child { color: var(--text-bright); font-weight: 500; }
.tv-body th:nth-child(2), .tv-body td:nth-child(2) { padding-left: 20px; }
.tv-body tbody tr:hover td { background: color-mix(in srgb, var(--text-main) 6%, var(--bg-base)); }
/* 长文字单元格不拉成一整行:内容包在 .tv-cell 里,约 20 字宽后折行(表格单元格本身不认 max-width) */
.tv-body .tv-cell { max-width: 20em; white-space: normal; }

@media (max-width: 1023px) {
  .tv-body th, .tv-body td { padding: 10px 16px 10px 0; }
  .tv-body th:first-child, .tv-body td:first-child { padding-left: 16px; }
  .tv-body th:nth-child(2), .tv-body td:nth-child(2) { padding-left: 14px; }
}
