/* ===========================================================================
 * 表格专家 · 老板板块（样式）
 * ---------------------------------------------------------------------------
 * 独立文件，**不改 style.css / coach.css / legal.css / contract.css**（并发会话在改它们）。
 * 加载顺序必须排在 style.css / coach.css / legal.css / contract.css 之后。
 *
 * 视觉上要解决的一件事：**页面上看到的表，必须长得像下载下来的那张 Excel**。
 *   所以表头用同一支深棕色（#6B4423，与 xlsx.js 里写死的表头底色一致）、
 *   合计行用同一支浅金（#FDF3E4）、数字右对齐 —— 用户在页面上下判断，
 *   下载后打开发现"和刚才看的一样"，才会信任这个文件。
 *
 * 前缀用 **tge-**（不用 tb-：站内 tb- 已被占了 11 处）。
 * 🔴 含 absolute 装饰的容器必须自带 position: relative（否则手机端整页被撑宽）。
 * =========================================================================== */

/* ---------------------------------------------------------------- 入口卡 */
.boss-entry-table {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #fafcf7 0%, #f1f7ec 55%, #e9f2e2 100%);
  border-color: #d8e4cd;
}
@media (hover: hover) {
  .boss-entry-table:hover { box-shadow: 0 10px 26px rgba(72, 106, 52, 0.16); }
}
.boss-entry-table .boss-entry-glow {
  background: radial-gradient(circle at 78% 18%, rgba(126, 168, 92, 0.30), transparent 62%);
}
.boss-entry-table .boss-entry-ico {
  background: linear-gradient(140deg, #eef6e8, #dcecd2);
  box-shadow: inset 0 0 0 1px #d2e3c4;
}
.boss-entry-table .boss-entry-tag { color: #46652f; background: #edf5e7; }
.boss-entry-table .boss-entry-name { letter-spacing: .5px; }
.boss-entry-table .boss-entry-flow { color: #46652f; }
.boss-entry-table .boss-entry-flow span { background: #fafcf7; border-color: #dbe8d0; }
.boss-entry-table .boss-entry-flow i { color: #b8cfa4; }

/* ---------------------------------------------------------------- 子页 */
#sub-table { padding-bottom: 26px; }

.tge-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 14px;
  margin-bottom: 13px;
  background: linear-gradient(135deg, #fdfefb, #f2f8ee);
  border: 1px solid #dde8d3;
  border-radius: 14px;
  position: relative;
  overflow: hidden;
}
.tge-head::after {
  content: '';
  position: absolute;
  right: -18px; top: -26px;
  width: 96px; height: 96px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(126, 168, 92, 0.18), transparent 68%);
  pointer-events: none;
}
.tge-avatar {
  width: 42px; height: 42px;
  flex: 0 0 42px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 21px;
  background: linear-gradient(140deg, #eef6e8, #dcecd2);
  box-shadow: inset 0 0 0 1px #d2e3c4;
  position: relative;
}
.tge-head-body { min-width: 0; flex: 1 1 auto; }
.tge-head-name { font-size: 15px; font-weight: 800; color: var(--text); }
.tge-head-desc { font-size: 12px; color: var(--text2); margin-top: 3px; line-height: 1.5; }
.tge-reset {
  flex: 0 0 auto;
  font-size: 12px;
  color: #46652f;
  background: #fff;
  border: 1px solid #d5e2c8;
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  position: relative;
}
.tge-reset:active { transform: scale(.96); }

/* ---------------------------------------------------------------- 需求面板 */
.tge-panel {
  background: #fff;
  border: 1px solid #e6efe0;
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 13px;
  box-shadow: 0 2px 10px rgba(72, 106, 52, 0.045);
}
.tge-panel[hidden] { display: none !important; }
.tge-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 9px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.tge-label span { font-weight: 400; color: var(--text2); font-size: 11.5px; }

.tge-kinds { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.tge-kind {
  appearance: none;
  font-size: 12.5px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid #dde8d3;
  background: #fdfefb;
  color: #5c6b50;
  cursor: pointer;
  line-height: 1;
}
.tge-kind.on {
  background: #4f7038;
  border-color: #4f7038;
  color: #fff;
  font-weight: 700;
}
@media (hover: hover) { .tge-kind:not(.on):hover { border-color: #bcd0a8; } }

.tge-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #dde8d3;
  border-radius: 11px;
  background: #fcfdfb;
  padding: 12px 13px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  font-family: inherit;
  resize: vertical;
}
.tge-input:focus { outline: none; border-color: #7ea85c; background: #fff; }
.tge-input::placeholder { color: #a8b59c; line-height: 1.7; }

.tge-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}
.tge-count { font-size: 11.5px; color: #a8b59c; }
.tge-count.warn { color: #b45309; font-weight: 700; }

.tge-go {
  appearance: none;
  border: none;
  border-radius: 11px;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #7ea85c, #5c8440);
  box-shadow: 0 4px 12px rgba(92, 132, 64, 0.28);
  letter-spacing: .5px;
}
.tge-go:disabled { opacity: .5; box-shadow: none; cursor: not-allowed; }
.tge-go:active:not(:disabled) { transform: scale(.97); }

.tge-hint {
  margin-top: 10px;
  font-size: 11.5px;
  line-height: 1.65;
  color: #8d9a82;
}
.tge-hint b { color: #5c703f; }

/* ---------------------------------------------------------------- 表格区 */
.tge-body { display: flex; flex-direction: column; gap: 13px; }
.tge-body:empty { display: none; }

.tge-msg { display: flex; gap: 9px; align-items: flex-start; }
.tge-msg-avatar {
  width: 30px; height: 30px; flex: 0 0 30px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  background: linear-gradient(140deg, #eef6e8, #dcecd2);
  box-shadow: inset 0 0 0 1px #d2e3c4;
}
.tge-bubble {
  min-width: 0;
  max-width: 100%;
  flex: 1 1 auto;
  background: #fff;
  border: 1px solid #e6efe0;
  border-radius: 13px;
  padding: 13px 14px;
  font-size: 13.5px;
  line-height: 1.78;
  color: var(--text);
  word-break: break-word;
}
.tge-msg.me { flex-direction: row-reverse; }
.tge-msg.me .tge-bubble {
  background: #4f7038;
  border-color: #4f7038;
  color: #fff;
  flex: 0 1 auto;
  max-width: 88%;
}
.tge-bubble p { margin: 0 0 9px; }
.tge-bubble p:last-child { margin-bottom: 0; }
.tge-bubble strong { font-weight: 800; }

/* 等待动效（不假造百分比） */
.tge-dots { display: inline-flex; gap: 4px; padding: 3px 0; }
.tge-dots i {
  width: 6px; height: 6px; border-radius: 50%;
  background: #a9c58c; display: block;
  animation: tgeBlink 1.25s ease-in-out infinite;
}
.tge-dots i:nth-child(2) { animation-delay: .18s; }
.tge-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes tgeBlink { 0%, 80%, 100% { opacity: .28; } 40% { opacity: 1; } }
.tge-prog {
  height: 3px; margin-top: 9px; border-radius: 2px; overflow: hidden;
  background: linear-gradient(90deg, #e2ecda 0%, #a9c58c 50%, #e2ecda 100%);
  background-size: 220% 100%;
  animation: tgeFlow 1.6s linear infinite;
}
@keyframes tgeFlow { 0% { background-position: 120% 0; } 100% { background-position: -120% 0; } }
.tge-caret {
  display: inline-block;
  width: 2px; height: 14px;
  background: #7ea85c;
  vertical-align: -2px;
  margin-left: 2px;
  animation: tgeCaret .9s step-end infinite;
}
@keyframes tgeCaret { 50% { opacity: 0; } }

/* ===========================================================================
 * 表格卡片 —— 本功能的门面
 * 页面上的表要长得和下载的 Excel 一样（同表头底色、同合计底色、数字右对齐）
 * =========================================================================== */
.tge-sheet {
  background: #fff;
  border: 1px solid #e2ecda;
  border-radius: 13px;
  overflow: hidden;
  box-shadow: 0 3px 12px rgba(72, 106, 52, 0.06);
  margin-bottom: 12px;
}
.tge-sheet-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 11px 13px;
  background: linear-gradient(135deg, #fbfdf9, #f4f9f0);
  border-bottom: 1px solid #e9f1e2;
}
.tge-sheet-ico {
  font-size: 14px;
  flex: 0 0 auto;
}
.tge-sheet-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tge-sheet-meta { font-size: 11.5px; color: #a3b096; flex: 0 0 auto; }
.tge-sheet-note {
  font-size: 12px;
  color: #7c8a70;
  line-height: 1.65;
  padding: 9px 13px 0;
}
.tge-sheet-more {
  display: inline-block;
  font-size: 11.5px;
  color: #46652f;
  cursor: pointer;
  margin-left: 4px;
  text-decoration: underline;
}

/* 横向滚动容器（手机端表格必然超宽） */
.tge-tablewrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 9px;
  max-width: 100%;
}
.tge-tablewrap::-webkit-scrollbar { height: 6px; }
.tge-tablewrap::-webkit-scrollbar-thumb { background: #cfdfc2; border-radius: 3px; }

.tge-table {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
  min-width: 100%;
}
.tge-table th {
  background: #6B4423;              /* 与 lib/xlsx.js 的表头底色一致 —— 所见即所得 */
  color: #fff;
  font-weight: 800;
  padding: 9px 11px;
  text-align: left;
  white-space: nowrap;
  border-right: 1px solid rgba(255, 255, 255, .14);
}
.tge-table th:last-child { border-right: none; }
.tge-table td {
  padding: 8px 11px;
  border-top: 1px solid #f1ece2;
  border-right: 1px solid #f7f3ea;
  white-space: nowrap;
  color: #4a4238;
}
.tge-table td:last-child { border-right: none; }
.tge-table tbody tr:nth-child(even) td { background: #fdfcfa; }
.tge-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tge-table td.empty { color: #d6cfc4; }
.tge-table tr.total td {
  background: #FDF3E4 !important;   /* 与 xlsx.js 的合计行底色一致 */
  font-weight: 800;
  color: #6B4423;
  border-top: 1px solid #ecdfc9;
}
/* 首列固定：手机横向拖动时还能看清是"哪一行" */
.tge-table th:first-child,
.tge-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  box-shadow: 1px 0 0 #f1ece2;
}
.tge-table th:first-child { background: #6B4423; z-index: 3; box-shadow: none; }
.tge-table tbody tr:nth-child(even) td:first-child { background: #fdfcfa; }
.tge-table tr.total td:first-child { background: #FDF3E4 !important; }
.tge-scroll-hint {
  font-size: 11px;
  color: #a3b096;
  padding: 6px 13px 0;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* 操作区 */
.tge-sheet-acts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 11px 13px 12px;
  border-top: 1px solid #f0f6ec;
  margin-top: 10px;
}
.tge-dl {
  appearance: none;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #7ea85c, #5c8440);
  box-shadow: 0 4px 12px rgba(92, 132, 64, 0.26);
  letter-spacing: .3px;
  flex: 1 1 auto;
}
.tge-dl:disabled { opacity: .5; box-shadow: none; cursor: not-allowed; }
.tge-dl:active:not(:disabled) { transform: scale(.97); }
.tge-ghost {
  appearance: none;
  border: 1px solid #d5e2c8;
  background: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: #46652f;
  cursor: pointer;
  flex: 0 0 auto;
}
.tge-ghost:active { transform: scale(.97); }

/* 版本历史（改来改去时能退回去） */
.tge-versions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 13px;
  background: #fbfdf9;
  border: 1px dashed #dbe8d0;
  border-radius: 11px;
  font-size: 12px;
  color: #6f7d63;
  margin-bottom: 12px;
}
.tge-ver-btn {
  appearance: none;
  border: 1px solid #d5e2c8;
  background: #fff;
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 12px;
  color: #46652f;
  cursor: pointer;
}
.tge-ver-btn:disabled { opacity: .42; cursor: not-allowed; }
.tge-ver-btn:active:not(:disabled) { transform: scale(.97); }

.tge-err {
  font-size: 12.5px;
  color: #b3261e;
  background: #fdeceb;
  border: 1px solid #f6cdc9;
  border-radius: 10px;
  padding: 10px 12px;
  line-height: 1.65;
}
.tge-tip-box {
  font-size: 12px;
  color: #6f7d63;
  background: #f6faf3;
  border: 1px solid #e2ecda;
  border-radius: 10px;
  padding: 10px 12px;
  line-height: 1.7;
}
.tge-tip-box b { color: #46652f; }

/* ---------------------------------------------------------------- 迭代输入 */
.tge-composer {
  position: sticky;
  bottom: 8px;
  background: #fdfefb;
  border: 1px solid #e2ecda;
  border-radius: 13px;
  padding: 10px;
  margin-top: 13px;
  box-shadow: 0 6px 18px rgba(72, 106, 52, 0.09);
}
.tge-composer[hidden] { display: none !important; }
.tge-composer-label {
  font-size: 11.5px;
  color: #7c8a70;
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.tge-composer-row { display: flex; gap: 8px; align-items: flex-end; }
.tge-input-mini {
  flex: 1 1 auto;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid #dde8d3;
  border-radius: 10px;
  background: #fff;
  padding: 10px 12px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text);
  font-family: inherit;
  resize: none;
  max-height: 132px;
}
.tge-input-mini:focus { outline: none; border-color: #7ea85c; }
.tge-send {
  appearance: none;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  background: #4f7038;
  flex: 0 0 auto;
}
.tge-send:disabled { opacity: .5; cursor: not-allowed; }
.tge-tip { font-size: 11px; color: #a8b59c; margin-top: 6px; }

/* 快速改法（chip 式，省得用户想怎么说） */
.tge-quickfix { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.tge-quickfix button {
  appearance: none;
  border: 1px dashed #cfe0c0;
  background: #fbfdf9;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11.5px;
  color: #5c703f;
  cursor: pointer;
  line-height: 1.4;
}
.tge-quickfix button:active { transform: scale(.97); }

/* ---------------------------------------------------------------- 免责 */
.tge-disc {
  margin-top: 14px;
  border-top: 1px dashed #e2ecda;
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.tge-disc-line {
  display: flex;
  gap: 7px;
  font-size: 11.5px;
  line-height: 1.7;
  color: #8d9a82;
}
.tge-disc-ico { flex: 0 0 auto; }
.tge-disc-line b { color: #5c703f; }

/* ---------------------------------------------------------------- 手机端 */
@media (max-width: 480px) {
  .tge-head { padding: 11px 12px; }
  .tge-panel { padding: 12px; }
  .tge-go { width: 100%; }
  .tge-foot { flex-direction: column; align-items: stretch; }
  .tge-foot .tge-count { text-align: right; }
  .tge-table { font-size: 12px; }
  .tge-table th, .tge-table td { padding: 7px 9px; }
  .tge-dl { padding: 11px 14px; }
}
