/* QuantDesk Web — styles.css
 * 全部色值与几何逐项照抄 ExcelWorkspace.cpp：
 *  - UiTokens kLight / kDark（ExcelWorkspace.cpp 111-126 行）
 *  - 标题栏 30px / 页签栏 28px / Ribbon 83px(内容76) / 公式栏 24px / Sheet栏 22px / 状态栏 22px
 *  - 表格：行高 19px、列头 20px、默认列宽 56(C=96,E=76,I=68,K=92)、
 *          选区 #ededed（深色 #2b352f）+ 2px 标题绿外框
 */
:root {
  /* kLight */
  --title: #107c41;
  --title-deep: #0b6a36;
  --table-green: #217346;
  --title-text: #1d3d2d;
  --grid-line: #e8e8e8;
  --header-gray: #f3f3f3;
  --ribbon-bg: #fafafa;
  --text-main: #202020;
  --text-muted: #696969;
  --surface: #ffffff;
  --surface-alt: #f8f8f8;
  --tab-bar-bg: #f8f8f8;
  --tab-hover: #e8f1eb;
  --selected-bg: #e2f0e7;
  --selected-border: #107c41;
  --border-strong: #bfbfbf;
  --sheet-bar-bg: #f3f3f3;
  --accent-text: #286c4a;
  --sel-fill: #ededed;
  --rb-accent: #e8a33d;        /* rebuildRibbonForTab rs.accent */
  --up: #d9382c;               /* A股习惯：涨红 */
  --down: #1a9e57;             /* 跌绿 */
  --link: #1a73c8;
  --del: #c0392b;
}
body.dark {
  /* kDark */
  --title: #0f6b39;
  --title-deep: #0b5730;
  --table-green: #1b7047;
  --title-text: #d7e8dc;
  --grid-line: #39443e;
  --header-gray: #2c3630;
  --ribbon-bg: #202724;
  --text-main: #e6ece8;
  --text-muted: #9fada5;
  --surface: #1c2220;
  --surface-alt: #252d28;
  --tab-bar-bg: #252d28;
  --tab-hover: #344a3d;
  --selected-bg: #2f5c43;
  --selected-border: #5ec08a;
  --border-strong: #4a5a51;
  --sheet-bar-bg: #242b27;
  --accent-text: #8ed3a8;
  --sel-fill: #2b352f;
  --up: #ff6b5e;
  --down: #4ade80;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: 12px;
  color: var(--text-main);
  background: var(--surface);
  overflow: hidden;
}
button { font-family: inherit; cursor: default; }

#excelCentral { display: flex; flex-direction: column; height: 100vh; background: var(--surface); }

/* ===================== 标题栏 30px ===================== */
#titleBar {
  height: 30px; flex: 0 0 30px;
  background: var(--title);
  display: flex; align-items: center;
  margin: 0; padding: 0;
}
#titleBar .tb-btn, .tb-quick {
  background: transparent; border: 0; color: #fff; font-size: 12px;
}
#btnSettings {
  width: 28px; height: 30px; flex: 0 0 28px; position: relative;
}
#btnSettings:hover { background: rgba(255,255,255,.16); }
/* 3x3 圆点图标（buildTitleBar 里的九点 pixmap） */
#btnSettings::before {
  content: ""; width: 18px; height: 18px; margin: auto;
  background-image: radial-gradient(circle, rgba(255,255,255,235) 1.6px, transparent 1.8px);
  background-size: 6px 6px; background-position: 0 0;
  display: block;
}
.tb-logo {
  width: 108px; flex: 0 0 108px; text-align: center;
  color: #fff; font-size: 11px; font-weight: 600;
}
.tb-doc {
  height: 30px; background: rgba(255,255,255,.14);
  display: flex; align-items: center; gap: 8px;
  padding: 0 6px 0 10px;
}
.tb-doc span { color: #fff; font-size: 11px; white-space: nowrap; }
.tb-close {
  width: 18px; height: 18px; border: 0; background: transparent;
  color: rgba(255,255,255,.85); font-size: 12px; line-height: 1;
}
.tb-close:hover { background: rgba(255,255,255,.2); }
.tb-plus { width: 30px; height: 30px; flex: 0 0 30px; font-size: 14px; }
.tb-plus:hover { background: rgba(255,255,255,.14); }
.tb-spring, .sheet-spring, .st-spring, .rtab-spring { flex: 1 1 auto; }
.tb-quick { width: 22px; height: 22px; flex: 0 0 22px; }
.tb-quick:hover { background: rgba(255,255,255,.14); }
.tb-gap { width: 6px; flex: 0 0 6px; }
.tb-gap-s { width: 4px; flex: 0 0 4px; }
#titleSearch {
  width: 150px; height: 20px;
  color: #fff; background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.18); border-radius: 3px;
  font-size: 11px; padding: 0 8px; outline: none;
}
#titleSearch::placeholder { color: rgba(255,255,255,.72); }
.tb-theme {
  width: 22px; height: 22px;
  color: #fff; background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.22); border-radius: 4px;
  font-size: 12px; line-height: 1;
}
.tb-theme:hover { background: rgba(255,255,255,.28); }
.tb-account { width: 24px; height: 26px; border: 0; background: transparent; color: #fff; font-size: 11px; }
.tb-account:hover { background: rgba(255,255,255,.14); }
.tb-share {
  width: 56px; height: 22px; flex: 0 0 56px;
  color: #fff; background: #2ea56a;
  border: 1px solid rgba(255,255,255,.3); border-radius: 3px;
  font-size: 11px; line-height: 1;
}
.tb-share:hover { background: #3ab77a; }
.tb-winctrl { width: 102px; flex: 0 0 102px; display: flex; }
.tb-winctrl .wc {
  width: 34px; height: 30px; flex: 1 1 34px;
  background: transparent; border: 0; color: #fff; font-size: 12px;
}
.tb-winctrl .wc:hover { background: rgba(255,255,255,.14); }
.tb-winctrl .wc-close:hover { background: #c42b1c; }

/* ===================== 设置面板（九点按钮弹出，原版插件 UI） ===================== */
#settingsPanel {
  position: fixed; top: 32px; left: 6px; z-index: 90;
  width: 400px; max-height: 88vh; overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: 0 6px 24px rgba(0,0,0,.25);
  border-radius: 8px; padding: 14px 18px 12px;
}
.sp-title { font-size: 17px; font-weight: 700; color: var(--text-main); margin-bottom: 8px; }
.sp-section { font-size: 12.5px; font-weight: 600; color: var(--text-main); margin: 2px 0 8px; }
.sp-func-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 4px; }
.sp-func {
  height: 36px; font-size: 13.5px;
  background: var(--surface); color: var(--text-main);
  border: 1px solid var(--border-strong); border-radius: 6px;
}
.sp-func:hover { background: var(--tab-hover); }
.sp-func.primary { background: var(--title); border-color: var(--title); color: #fff; font-weight: 600; }
.sp-func.primary:hover { background: #1a8a54; }
.sp-check { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-main); margin: 10px 0 8px; }
.sp-check input { width: 14px; height: 14px; accent-color: var(--title); }
.sp-line { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.sp-line label { flex: 0 0 78px; font-size: 12.5px; color: var(--text-main); }
.sp-btn {
  background: var(--surface); color: var(--text-main);
  border: 1px solid var(--border-strong); border-radius: 4px;
  padding: 4px 10px; font-size: 12.5px;
}
.sp-btn:hover { background: var(--tab-hover); }
.sp-btn.sp-wide { flex: 1 1 auto; height: 30px; font-size: 13px; }
.sp-ic {
  width: 30px; height: 30px; border-radius: 6px; font-size: 14px; font-weight: 700;
  background: var(--surface); color: var(--text-main); border: 1px solid var(--border-strong);
}
.sp-ic:hover { background: var(--tab-hover); }
.sp-ic.active { background: var(--title); border-color: var(--title); color: #fff; }
.sp-spin { flex: 1 1 auto; display: flex; align-items: stretch; }
.sp-spin input {
  flex: 1 1 auto; height: 30px; text-align: right;
  background: var(--surface); color: var(--text-main);
  border: 1px solid var(--border-strong); border-radius: 4px 0 0 4px;
  padding: 0 8px; font-size: 12.5px; outline: none;
}
.sp-unit {
  padding: 0 10px; font-size: 12.5px; color: var(--text-main);
  border: 1px solid var(--border-strong); border-left: 0; border-radius: 0 4px 4px 0;
  background: var(--surface-alt); line-height: 28px;
}
.sp-name-mode { margin: 10px 0 2px; font-size: 12.5px; color: var(--text-main); }
.sp-radio { display: flex; align-items: center; gap: 7px; margin: 6px 0 0; font-size: 12.5px; color: var(--text-main); }
.sp-radio input { width: 14px; height: 14px; accent-color: var(--title); }
.sp-hr { height: 1px; background: var(--grid-line); margin: 12px 0 10px; }
.sp-support { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.sp-donate {
  width: 100%; height: 40px; font-size: 15px; font-weight: 600; color: #fff;
  background: #f5921e; border: 0; border-radius: 6px;
}
.sp-donate:hover { background: #e8860f; }
.sp-contact { font-size: 12.5px; color: var(--text-main); margin: 10px 0 3px; }
.sp-contact a { color: #107c41; text-decoration: none; }
.sp-version { text-align: center; font-size: 11px; color: var(--text-muted); margin-top: 8px; }

/* 打赏弹窗（照原版：头部说明 + 双卡片 + 联系邮箱 + 完成按钮） */
.donate-card {
  width: 780px; max-width: 94vw; max-height: 92vh; overflow: auto;
  padding: 20px 28px 18px; position: relative;
  border-radius: 12px;
}
.dn-close {
  position: absolute; top: 16px; right: 18px;
  width: 30px; height: 30px; font-size: 18px;
  background: transparent; border: 0; border-radius: 6px;
  color: var(--text-muted); cursor: pointer;
}
.dn-close:hover { background: var(--tab-hover); color: var(--text-main); }
.dn-eyebrow { font-size: 12.5px; color: var(--text-muted); }
.dn-title { font-size: 22px; font-weight: 700; color: var(--text-main); margin: 2px 0 16px; }
.dn-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.dn-card {
  border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 14px 18px 18px;
  display: flex; flex-direction: column; align-items: center;
}
.dn-card-title {
  font-size: 15px; font-weight: 700; color: var(--text-main);
  width: 100%; text-align: center; padding-bottom: 12px;
  border-bottom: 1px solid var(--grid-line); margin-bottom: 12px;
}
.dn-qr { width: 320px; max-width: 100%; height: auto; }
.dn-card-cap { font-size: 13px; color: var(--text-muted); margin-top: 8px; }
.dn-cup { font-size: 54px; line-height: 1; margin: 26px 0 12px; }
.dn-coffee-title { font-size: 16px; font-weight: 700; color: var(--text-main); }
.dn-coffee-body {
  font-size: 13px; color: var(--text-main); text-align: center;
  line-height: 1.7; margin: 8px 0 6px; white-space: pre-line;
}
.dn-kofi { color: #1a9e57; font-size: 13.5px; text-decoration: none; margin: 2px 0 14px; }
.dn-kofi:hover { text-decoration: underline; }
.dn-kofi-btn {
  display: block; width: 100%; height: 44px; line-height: 44px;
  text-align: center; background: #1a9e57; color: #fff;
  font-size: 15px; font-weight: 600; border-radius: 8px;
  text-decoration: none; margin-top: auto;
}
.dn-kofi-btn:hover { background: #178c4d; }
.dn-contact { font-size: 13.5px; color: var(--text-main); margin: 16px 0 4px; }
.dn-contact a { color: #107c41; text-decoration: none; font-weight: 600; }
.dn-support { font-size: 12.5px; color: var(--text-muted); margin-bottom: 14px; }
.dn-done {
  width: 100%; height: 46px; background: #1a9e57; color: #fff;
  font-size: 16px; font-weight: 600; border: 0; border-radius: 8px; cursor: pointer;
}
.dn-done:hover { background: #178c4d; }

/* ===================== 首启说明卡（IntroDialog） ===================== */
.intro-card {
  width: 520px; max-width: 92vw; max-height: 86vh; overflow: auto;
  padding: 0 26px 20px; position: relative;
}
.intro-bar { height: 3px; background: #1a9e57; border-radius: 1px; margin: 18px -26px 14px; }
.intro-title { font-size: 20px; font-weight: 700; color: var(--text-main); }
.intro-sub { font-size: 12.5px; color: var(--text-muted); margin: 4px 0 14px; }
.intro-head { font-size: 13.5px; font-weight: 700; color: #1a9e57; margin: 14px 0 6px; }
.intro-body { font-size: 12.5px; line-height: 1.7; color: var(--text-main); margin: 2px 0; }
.intro-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.intro-chip {
  font-size: 12px; color: var(--text-main);
  border: 1px solid var(--border-strong); border-radius: 12px; padding: 3px 12px;
  background: var(--surface-alt);
}
.intro-note { font-size: 11.5px; color: var(--text-muted); margin-top: 14px; line-height: 1.6; }
.intro-start {
  width: 100%; height: 38px; margin-top: 12px;
  background: #1a9e57; color: #fff; font-size: 14px; font-weight: 600;
  border: 0; border-radius: 6px;
}
.intro-start:hover { background: #15884a; }

/* ===================== 新手引导浮层（TutorialOverlay） ===================== */
#tutorialOverlay { position: fixed; inset: 0; z-index: 200; }
#tutorialOverlay[hidden] { display: none; }
#tutSpot {
  position: absolute; pointer-events: none;
  border-radius: 8px; border: 2px solid #1a9e57;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.45);
  transition: all .18s ease;
}
#tutSpot.full { border-color: transparent; box-shadow: none; background: rgba(0,0,0,.35); }
#tutCard {
  position: absolute; width: 360px; max-width: 90vw;
  background: var(--surface); color: var(--text-main);
  border: 1px solid #dcdcdc; border-radius: 10px;
  box-shadow: 0 10px 32px rgba(0,0,0,.3);
  padding: 18px 22px 16px; z-index: 201;
}
.tut-top { display: flex; align-items: center; }
.tut-stepnum { color: #1a9e57; font-size: 12px; font-weight: 600; letter-spacing: 1px; }
.tut-close {
  margin-left: auto; width: 22px; height: 22px; border-radius: 11px;
  background: transparent; border: 0; color: #8a8a8a; font-size: 16px; line-height: 1;
}
.tut-close:hover { background: #f0f0f0; color: #333; }
#tutCard.dark .tut-close:hover { background: var(--tab-hover); }
#tutTitle { font-size: 16px; font-weight: 700; margin: 10px 0 8px; }
.tut-body { font-size: 12.5px; line-height: 1.75; color: #4a4a4a; max-height: 40vh; overflow: auto; }
.tut-body p { margin: 0 0 10px; }
body.dark .tut-body { color: var(--text-main); }
.tut-btns { display: flex; justify-content: space-between; margin-top: 12px; }
.tut-prev, .tut-next {
  height: 34px; font-size: 13px; border-radius: 6px;
  background: var(--surface); color: var(--text-main);
  border: 1px solid var(--border-strong);
}
.tut-prev { width: 92px; }
.tut-next { width: 100px; background: #1a9e57; border-color: #1a9e57; color: #fff; font-weight: 600; }
.tut-next:hover { background: #15884a; }
.tut-prev:disabled { opacity: .4; }
.sp-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.sp-row input {
  flex: 1 1 auto; height: 28px;
  background: var(--surface); color: var(--text-main);
  border: 1px solid var(--border-strong); border-radius: 4px; padding: 0 8px;
  font-size: 12.5px; outline: none;
}
#addName { flex: 0 0 150px; }
.sp-hint { color: var(--text-muted); font-size: 11px; line-height: 1.5; }
.sp-results { margin: 6px 0; max-height: 220px; overflow: auto; }
.ar-item {
  display: flex; gap: 10px; padding: 5px 8px; cursor: pointer;
  border-bottom: 1px solid var(--grid-line); font-size: 12px;
}
.ar-item:hover { background: var(--tab-hover); }
.ar-item .ar-mkt { margin-left: auto; color: var(--text-muted); font-size: 11px; }

/* ===================== Ribbon 页签栏 28px ===================== */
#ribbonTabBar {
  height: 28px; flex: 0 0 28px;
  background: var(--tab-bar-bg);
  border-bottom: 1px solid var(--border-strong);
  display: flex; align-items: stretch;
}
.rtab-file {
  width: 52px; flex: 0 0 52px;
  color: #fff; background: var(--title-deep);
  border: 0; font-size: 11px;
}
.rtab-file:hover { background: var(--title-deep); }
.rtab {
  background: transparent; border: 0; border-bottom: 2px solid transparent;
  color: var(--text-main); font-size: 11px;
  padding: 0 10px; min-width: 38px;
}
.rtab:hover { background: var(--tab-hover); }
.rtab.active {
  color: var(--title); font-weight: 600;
  border-bottom: 2px solid var(--title);
}
.rtab-spring { display: flex; align-items: center; justify-content: flex-end; }
#shareLabel { color: var(--text-muted); padding-right: 18px; font-size: 11px; }

/* ===================== Ribbon 内容 83px（内容 76 + 底部滚动条） ===================== */
#ribbonViewport {
  height: 83px; flex: 0 0 83px;
  background: var(--ribbon-bg);
  border-bottom: 1px solid var(--border-strong);
  overflow-x: auto; overflow-y: hidden;
}
#ribbonViewport::-webkit-scrollbar { height: 6px; }
#ribbonViewport::-webkit-scrollbar-track { background: transparent; }
#ribbonViewport::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }
#ribbonContent {
  height: 76px;
  display: flex; align-items: stretch;
  padding: 2px 4px 0 4px;
  width: max-content; min-width: 100%;
}
.rb-group {
  display: flex; align-items: stretch; gap: 1px;
  padding: 3px 6px 3px 5px;
  border-right: 1px solid var(--border-strong);
}
.rb-col { display: flex; flex-direction: column; justify-content: center; gap: 1px; }
/* 大按钮：图标上 26px + 文字下 11px，高 70，顶对齐 */
.rb-big {
  height: 70px; min-width: 58px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 3px; padding-top: 9px;
  background: transparent; border: 0; border-radius: 3px;
  color: var(--accent-text); font-size: 11px; white-space: nowrap;
}
.rb-big:hover { background: var(--selected-bg); }
.rb-big .rb-lb { display: inline-flex; align-items: center; gap: 4px; height: 14px; line-height: 14px; }
/* 小按钮：图标左 16px + 文字右 10px，行高 22 */
.rb-s {
  height: 22px; min-width: 48px;
  display: flex; align-items: center; gap: 4px;
  padding: 0 6px;
  background: transparent; border: 0; border-radius: 3px;
  color: var(--accent-text); font-size: 10px; white-space: nowrap;
}
.rb-s:hover { background: var(--selected-bg); }
.rb-lb { pointer-events: none; }
.rb-arrow {
  width: 0; height: 0; display: inline-block;
  border-left: 3.5px solid transparent; border-right: 3.5px solid transparent;
  border-top: 3px solid var(--text-muted);
}
.rb-arrow.big { border-top-width: 2.5px; }
.rb-chk .chk-box {
  width: 14px; height: 14px; flex: 0 0 14px;
  border: 1px solid currentColor; border-radius: 2px;
  display: inline-flex; align-items: center; justify-content: center;
  color: inherit;
}
/* 字体工具条（buildFontBar）：两行 21px 高 */
.fontbar {
  display: flex; flex-direction: column; justify-content: center; gap: 3px;
  padding: 0 2px;
}
.fb-row { display: flex; gap: 2px; align-items: center; }
.fb-row:first-child { margin-bottom: 0; }
#fbFont { width: 104px; }
#fbSize { width: 38px; }
.fb-font, .fb-size {
  height: 21px;
  background: var(--surface); color: var(--text-main);
  border: 1px solid var(--border-strong); border-radius: 2px;
  font-size: 11px; padding: 0 3px 0 4px; outline: none;
}
.fb-btn {
  width: 22px; height: 21px;
  background: transparent; border: 1px solid transparent; border-radius: 2px;
  color: var(--accent-text); font-size: 12px; padding: 0; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.fb-btn:hover { background: var(--selected-bg); border-color: var(--selected-border); }
.fb-btn.fb-b { font-weight: 700; }
.fb-btn.fb-i { font-style: italic; font-family: Georgia, serif; }
.fb-btn.fb-u { text-decoration: underline; }
#fbBorder { width: 30px; }
.fb-color { width: 28px; font-weight: 700; border-bottom: 3px solid var(--text-main); }
#fbFontColor { border-bottom-color: var(--text-main); }
#fbFillColor { border-bottom-color: #fff2cc; }

/* ===================== 公式栏 24px ===================== */
#formulaBar {
  height: 24px; flex: 0 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-strong);
  display: flex; align-items: stretch;
}
#nameBox {
  width: 85px; flex: 0 0 85px;
  border-right: 1px solid var(--border-strong);
  padding-left: 6px; font-size: 10px; color: var(--text-muted);
  display: flex; align-items: center;
}
.fx-btn {
  width: 20px; border: 0; background: transparent;
  color: var(--text-muted); font-size: 11px;
}
.fx-btn:hover { background: var(--tab-hover); }
#fxLabel {
  width: 34px; flex: 0 0 34px;
  color: var(--text-muted); border-right: 1px solid var(--border-strong);
  font-family: Georgia, serif; font-style: italic; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
}
#formulaInput {
  flex: 1 1 auto; border: 0; outline: none;
  padding: 0 6px; background: var(--surface); color: var(--text-main);
  font-size: 11px; font-family: inherit;
}
#formulaInput[readonly] { color: var(--text-muted); }

/* ===================== 网格区 ===================== */
#gridShell { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
#gridBody { flex: 1 1 auto; display: flex; min-height: 0; }
#sheetStack { flex: 1 1 auto; min-width: 0; display: flex; }
.sheet { flex: 1 1 auto; min-width: 0; display: flex; }
.sheet[hidden] { display: none; }
.grid-scroll {
  flex: 1 1 auto; overflow: auto; position: relative;
  background: var(--surface);
}
/* 表格：行高 19、列头 20、网格线 #e8e8e8 */
table.qtable {
  border-collapse: separate; border-spacing: 0;
  table-layout: fixed; font-size: 11px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  user-select: none;
}
table.qtable thead th {
  position: sticky; top: 0; z-index: 3;
  height: 20px; background: var(--header-gray); color: var(--text-main);
  border: 1px solid var(--border-strong);
  font-weight: normal; padding: 0 4px;
  text-align: center;
}
table.qtable thead th.rownum {
  width: 34px; min-width: 34px; max-width: 34px; z-index: 4;
}
table.qtable tbody td {
  height: 19px; padding: 0 4px;
  border-right: 1px solid var(--grid-line);
  border-bottom: 1px solid var(--grid-line);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
table.qtable tbody td.rownum {
  width: 34px; min-width: 34px; max-width: 34px;
  background: var(--header-gray); color: var(--text-muted);
  text-align: center; font-size: 11px;
  border-right: 1px solid var(--border-strong);
  position: sticky; left: 0; z-index: 2;
}
table.qtable tbody td.title-cell {
  font-size: 14pt; font-weight: 700; color: var(--title-text);
  padding: 4px 8px;
}
table.qtable tbody td.head-cell {
  background: var(--table-green); color: #fff; font-weight: 700;
  text-align: center;
}
table.qtable tbody td.sel { background: var(--sel-fill); color: var(--text-main); }
table.qtable tbody td.center { text-align: center; }
table.qtable tbody td.num { text-align: right; }
td.up { color: var(--up); }
td.down { color: var(--down); }
td.link-cell { color: var(--link); text-decoration: underline; text-align: center; cursor: pointer; }
td.del-cell { color: var(--del); font-weight: 700; font-size: 12px; text-align: center; cursor: pointer; }
table.qtable.no-grid tbody td { border-right-color: transparent; border-bottom-color: transparent; }
/* 选区外围 2px 绿框（SheetTable::paintEvent） */
.sel-outline {
  position: absolute; pointer-events: none; z-index: 5;
  border: 2px solid var(--title);
  box-sizing: border-box;
}
/* 可编辑单元格（工作记录 / 用户新建表） */
table.qtable.editable tbody td[data-edit="1"] { cursor: text; }
table.qtable.editable tbody td[data-edit="1"]:focus {
  outline: 1px solid var(--title);
  outline-offset: -1px;
  background: var(--surface);
  user-select: text;
}

/* 趋势分析占位页（makeTrendSheet + QSS 网格底纹） */
.trend-sheet {
  flex: 1 1 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background-color: var(--surface);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 19px;
}
.trend-title { color: var(--title-text); font-size: 16px; font-weight: 600; }
.trend-hint { color: var(--text-muted); font-size: 12px; max-width: 560px; text-align: center; }

/* 右侧竖排工具栏 28px */
#sideBar {
  width: 28px; flex: 0 0 28px;
  background: var(--sheet-bar-bg);
  border-left: 1px solid var(--border-strong);
  display: flex; flex-direction: column; align-items: center;
  padding: 4px 0; gap: 2px;
}
.side-tool {
  width: 26px; height: 26px;
  background: transparent; border: 0; border-radius: 3px;
  color: var(--text-main); font-size: 12px;
}
.side-tool:hover { background: var(--tab-hover); color: var(--title); }

/* ===================== Sheet 栏 22px ===================== */
#sheetBar {
  height: 22px; flex: 0 0 22px;
  background: var(--sheet-bar-bg);
  border-top: 1px solid var(--border-strong);
  display: flex; align-items: stretch;
}
.sheet-nav {
  width: 18px; flex: 0 0 18px;
  background: transparent; border: 0; color: var(--text-main); font-size: 10px;
}
.sheet-tab {
  background: transparent; border: 0;
  border-right: 1px solid var(--border-strong);
  border-bottom: 2px solid transparent;
  color: var(--text-main); font-size: 11px;
  padding: 0 10px; min-width: 64px;
}
.sheet-tab.active {
  color: var(--title); font-weight: 600;
  background: var(--tab-hover);
  border-bottom: 2px solid var(--title);
}
.sheet-add {
  width: 18px; flex: 0 0 18px;
  background: transparent; border: 0;
  color: var(--text-main); font-size: 13px;
}

/* ===================== 状态栏 22px ===================== */
#statusBar {
  height: 22px; flex: 0 0 22px;
  background: var(--sheet-bar-bg);
  border-top: 1px solid var(--border-strong);
  display: flex; align-items: center;
  padding: 0 8px 0 10px;
  gap: 0;
}
#stText { color: var(--text-muted); font-size: 11px; white-space: nowrap; }
#stSummary { color: var(--text-muted); font-size: 11px; margin-left: 24px; white-space: nowrap; }
.st-view {
  width: 22px; height: 22px;
  background: transparent; border: 0; color: var(--text-muted); font-size: 11px;
}
.st-view:hover { background: var(--header-gray); }
.st-zoom {
  width: 20px; height: 22px;
  background: transparent; border: 0; color: var(--text-muted); font-size: 11px;
}
.st-zoom:hover { background: var(--header-gray); }
#zoomSlider {
  width: 70px; accent-color: var(--title); height: 14px;
}
#zoomLabel { width: 34px; text-align: right; color: var(--text-muted); font-size: 11px; }

/* ===================== 弹窗 ===================== */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  box-shadow: 0 10px 40px rgba(0,0,0,.4);
  padding: 12px 14px;
}
.detail-card { width: 900px; max-width: 94vw; }
.detail-head {
  display: flex; align-items: center; gap: 12px;
  font-size: 14px; font-weight: 600; color: var(--title-text);
  margin-bottom: 8px;
}
.detail-quote { font-size: 14px; font-weight: 700; }
.detail-quote.up { color: var(--up); }
.detail-quote.down { color: var(--down); }
.m-close {
  margin-left: auto; width: 24px; height: 24px;
  background: transparent; border: 0; color: var(--text-muted); font-size: 14px;
}
.m-close:hover { background: var(--tab-hover); }
.chart-tabs { display: flex; gap: 2px; margin-bottom: 6px; }
.ctab {
  background: transparent; border: 0; border-bottom: 2px solid transparent;
  color: var(--text-muted); font-size: 12px; padding: 4px 12px;
}
.ctab.active { color: var(--title); border-bottom-color: var(--title); font-weight: 600; }
#detailCanvas { width: 100%; background: var(--surface); }
.detail-stats { color: var(--text-muted); font-size: 11px; min-height: 16px; margin-top: 4px; }
.ai-card { width: 640px; max-width: 92vw; }
.ai-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; font-weight: 600; color: var(--title-text); margin-bottom: 8px;
}
.ai-body { font-size: 12px; line-height: 1.7; max-height: 60vh; overflow: auto; }
.ai-body h4 { margin: 10px 0 4px; color: var(--accent-text); font-size: 12px; }
.ai-body .ai-disclaimer { color: var(--text-muted); font-size: 11px; border-top: 1px solid var(--grid-line); margin-top: 10px; padding-top: 6px; }

/* 右键菜单 */
#ctxMenu {
  position: fixed; z-index: 120; min-width: 140px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  padding: 2px;
}
#ctxMenu .ctx-item {
  padding: 5px 16px; font-size: 12px; color: var(--text-main); cursor: pointer;
}
#ctxMenu .ctx-item:hover { background: var(--title); color: #fff; }

/* 老板键伪装层 */
#bossMask {
  position: fixed; inset: 0; z-index: 200;
  background: #fff; overflow: auto; padding: 24px;
}
.boss-table { border-collapse: collapse; font-size: 13px; color: #222; }
.boss-table th, .boss-table td {
  border: 1px solid #bbb; padding: 6px 14px; text-align: left;
}
.boss-table th { background: #4472c4; color: #fff; }
.boss-table tbody tr:nth-child(even) { background: #f2f6fc; }

/* 缩放（状态栏滑条 75–125%，QSlider→onZoomChanged） */
#excelCentral { zoom: 1; }

/* 覆盖 .m-close 对打赏弹窗控件的影响（.m-close 定义在后会覆盖同权重规则） */
.donate-card .dn-close {
  position: absolute; top: 16px; right: 18px;
  width: 30px; height: 30px; margin-left: 0; font-size: 18px;
}
.donate-card .dn-done {
  width: 100%; height: 46px; margin-left: 0;
  font-size: 16px; font-weight: 600;
  background: #1a9e57; color: #fff; border: 0; border-radius: 8px; cursor: pointer;
}
.donate-card .dn-done:hover { background: #178c4d; }
