:root {
  --bg: #eef1f6;
  --panel: #ffffff;
  --line: #e3e7ef;
  --line-strong: #cdd5e2;
  --text: #1f2632;
  --muted: #7a8394;
  --primary: #2f6fed;
  --primary-soft: #e9f0ff;
  --head-bg: #f4f6fa;
  --ok: #16a34a;
  --shadow: 0 2px 10px rgba(24, 39, 75, 0.06), 0 16px 40px rgba(24, 39, 75, 0.05);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app { display: flex; height: 100vh; overflow: hidden; }

/* ================= 侧栏 ================= */

#sidebar {
  position: relative;
  width: 228px;
  flex: 0 0 228px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 14px 10px 8px;
}

/* 侧栏收起 / 展开 */
.side-hide {
  position: absolute; top: 6px; right: 6px;
  width: 20px; height: 20px; padding: 0;
  border: 1px solid var(--line); border-radius: 6px;
  background: #fff; color: var(--muted);
  font-size: 13px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.side-hide:hover { background: var(--primary-soft); color: var(--primary); border-color: #c7d8ff; }
.side-rail {
  display: none;
  width: 16px; flex: 0 0 16px;
  background: #eaeef6; border-right: 1px solid var(--line);
  align-items: center; justify-content: center;
  color: var(--muted); font-size: 14px; cursor: pointer; user-select: none;
}
.side-rail:hover { background: #dde4f1; color: var(--primary); }
body.side-hidden #sidebar { display: none; }
body.side-hidden .side-rail { display: flex; }

.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 14px; }

.logo, .modal-logo {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #4a86ff, #2f6fed);
  color: #fff; font-size: 16px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 10px rgba(47, 111, 237, 0.26);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text b { font-size: 15px; letter-spacing: 0.3px; }
.brand-text span { font-size: 11px; color: var(--muted); }

.new-doc {
  width: 100%; height: 36px;
  border: none; border-radius: 8px;
  background: var(--primary); color: #fff;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background 0.15s;
}
.new-doc:hover { background: #2560d8; }

.join-doc {
  margin-top: 8px;
  background: #fff; color: var(--primary);
  border: 1px solid #c9d8f7;
  font-weight: 500;
}
.join-doc:hover { background: #f2f6ff; border-color: #a9c2f2; }

.doc-empty {
  padding: 18px 10px; text-align: center;
  font-size: 12px; color: #8b95a5; line-height: 1.7;
}
.doc-empty.hidden { display: none; }
.doc-empty span { font-size: 11px; color: #a9b1bf; }

.side-label { margin: 16px 6px 8px; font-size: 11.5px; color: var(--muted); }

.doc-list { flex: 1; overflow-y: auto; padding: 0 4px; }

.doc-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px; border-radius: 8px;
  cursor: pointer; position: relative;
  transition: background 0.12s;
}
.doc-item:hover { background: #f4f6fb; }
.doc-item.active { background: var(--primary-soft); }
.doc-item.active .doc-name { color: var(--primary); font-weight: 600; }

.doc-ico {
  width: 20px; height: 20px; flex: 0 0 20px;
  border-radius: 5px;
  background: #eef1f7; color: #99a3b4;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.doc-item.active .doc-ico { background: #dbe6ff; color: var(--primary); }

.doc-main { min-width: 0; flex: 1; }
.doc-name {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; line-height: 1.4; min-width: 0;
}
.doc-name-text {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.doc-unread {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px;
  background: #ff3b30; color: #fff; font-size: 10.5px; font-weight: 700;
  line-height: 1; letter-spacing: 0;
  box-shadow: 0 0 0 0 rgba(255, 59, 48, .55);
  animation: unreadPulse 1.5s ease-out infinite;
}
.doc-time { font-size: 10.5px; color: var(--muted); margin-top: 1px; }

.doc-more {
  width: 20px; height: 20px; border: none; background: transparent;
  color: var(--muted); border-radius: 5px; cursor: pointer;
  opacity: 0; font-size: 13px; line-height: 1;
}
.doc-item:hover .doc-more { opacity: 1; }
.doc-more:hover { background: #e5ebf5; color: #333; }

.side-foot {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 6px 2px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--muted);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: #cbd3e0; flex: 0 0 7px; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.14); }
.dot.off { background: #ef4444; }

/* ================= 主区 ================= */

#main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--panel); position: relative; }

.topbar {
  height: 48px; flex: 0 0 48px;
  display: flex; align-items: center; padding: 0 12px;
  border-bottom: 1px solid var(--line);
  gap: 12px;
}

.sheet-title {
  flex: 1; min-width: 0;
  border: none; outline: none; background: transparent;
  font-size: 15px; font-weight: 600; color: var(--text);
  font-family: inherit; padding: 4px 6px; border-radius: 6px;
}
.sheet-title:hover { background: #f4f6fa; }
.sheet-title:focus { background: #fff; box-shadow: 0 0 0 2px rgba(47, 111, 237, 0.18); }
.sheet-title::placeholder { color: #b3bccb; }

.topbar-right { display: flex; align-items: center; gap: 6px; }

.save-state { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.save-state.saving { color: #b8860b; }

.sheet-code {
  height: 23px; padding: 0 9px;
  border: 1px solid #c9d8f7; border-radius: 6px;
  background: #f2f6ff; color: #2f6fed;
  font-size: 11.5px; font-weight: 600;
  letter-spacing: .6px; cursor: pointer;
  white-space: nowrap; flex: none;
}
.sheet-code:hover { background: #e6efff; border-color: #a9c2f2; }
.sheet-code.hidden { display: none; }

.people { display: flex; align-items: center; padding-left: 2px; }
.avatar {
  width: 25px; height: 25px; border-radius: 50%;
  color: #fff; font-size: 11.5px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  margin-left: -6px; border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(24, 39, 75, 0.16);
}
.people .avatar:first-child { margin-left: 0; }
.people .more {
  margin-left: -6px; background: #eef1f7; color: #67718a;
  border: 2px solid #fff; font-size: 10px;
}

.icon-btn {
  width: 30px; height: 30px; border: none; background: transparent;
  border-radius: 6px; cursor: pointer; font-size: 14px; color: #5b6474;
}
.icon-btn:hover { background: #f1f4fa; }

/* 工具栏 */

.ribbon {
  min-height: 42px; flex: 0 0 auto;
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 4px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  background: #fafbfd;
  overflow: visible;
}

.rb-group { display: flex; gap: 2px; flex-wrap: wrap; }
.rb-sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; flex: 0 0 1px; }
.rb-spacer { flex: 1 1 8px; min-width: 8px; }

.ribbon button {
  height: 28px; padding: 0 9px;
  border: 1px solid transparent; background: transparent;
  border-radius: 6px; color: #414b5c;
  font-size: 12.5px; cursor: pointer; font-family: inherit;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}
.ribbon button:hover { background: #eef2f9; border-color: #e0e6f0; }
.ribbon button:active { background: #e3e9f4; }

/* 字号 / 标注色 */
.rb-label { font-size: 12px; color: var(--muted); margin: 0 2px 0 2px; line-height: 28px; }
.rb-select {
  height: 28px; padding: 0 4px;
  border: 1px solid var(--line-strong); border-radius: 6px;
  background: #fff; color: var(--text); font-size: 12.5px; font-family: inherit;
  cursor: pointer; outline: none;
}
.rb-select:hover { border-color: #b9c4d6; }
.mark-btn { color: #414b5c; }

/* ---- WPS 风格功能区（选项卡 + 分组） ---- */

.ribbon.xls {
  display: block;
  padding: 0;
  background: #f7f9fc;
  min-height: 0;
}

.xls-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 30px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.xls-tab {
  height: 30px;
  padding: 0 14px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #46536b;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.xls-tab:hover { color: var(--primary); }
.xls-tab.on {
  color: var(--primary);
  font-weight: 600;
  border-bottom-color: var(--primary);
  background: #f2f6ff;
}

.xls-pane { display: none; padding: 3px 8px; }
.xls-pane.on { display: block; }

.xls-fold {
  height: 22px;
  margin-left: 6px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: #fff;
  color: #6b7a90;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
}
.xls-fold:hover { color: var(--primary); border-color: #c7d8ff; }
body.ribbon-folded .xls-pane { display: none !important; }

.xp-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  min-height: 26px;
}
.xp-div {
  width: 1px;
  height: 16px;
  background: var(--line-strong);
  margin: 0 5px;
  flex: 0 0 1px;
}

.xp-btn { min-width: 26px; height: 25px; padding: 0 6px; font-size: 11.5px; }
.xp-btn.sq { width: 28px; padding: 0; font-size: 12.5px; }
.xp-btn.bold { font-weight: 700; }
.xp-btn.italic { font-style: italic; }
.xp-btn.underline { text-decoration: underline; }
.xp-btn.strike { text-decoration: line-through; }
.xp-btn.on {
  background: #e8f0ff;
  border-color: #c7d8ff;
  color: var(--primary);
}

.xp-select {
  height: 25px;
  padding: 0 2px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}
.xp-select:hover { border-color: #b9c4d6; }
.xp-select.ff { width: 88px; }
.xp-select.fs { width: 54px; }
.xp-select.nf { width: 76px; }

/* 填色 / 字色：主按钮直接用当前颜色，右侧小箭头选颜色 */
.xp-split {
  display: inline-flex;
  align-items: stretch;
  height: 25px;
}
.xp-split .xp-btn {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  display: inline-flex;
  align-items: center;
}
.xp-caret {
  width: 17px;
  min-width: 17px;
  height: 25px;
  padding: 0;
  border: 1px solid transparent;
  border-left: 1px solid #d3dbe8;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  background: #fff;
  color: #7b8798;
  font-size: 9px;
  line-height: 1;
  cursor: pointer;
}
.xp-caret:hover { background: #eef2f9; color: var(--primary); }
.xp-swatch {
  display: inline-block;
  width: 18px;
  height: 3px;
  border-radius: 2px;
  margin-left: 4px;
  background: #fff3bf;
}

.color-pop-title {
  width: 100%;
  font-size: 11px;
  color: #7b8798;
  padding: 1px 2px 6px;
}

.xp-tip { font-size: 11.5px; color: #8a93a4; line-height: 26px; }
.xp-tip.strong { color: #414b5c; font-weight: 600; font-size: 12.5px; }

.color-pop {
  position: fixed; z-index: 9999;
  width: 178px; padding: 10px;
  background: #fff; border: 1px solid var(--line-strong);
  border-radius: 10px; box-shadow: var(--shadow);
  display: flex; flex-wrap: wrap; gap: 7px;
}
.color-dot {
  width: 28px; height: 28px; border-radius: 7px;
  border: 1px solid rgba(0, 0, 0, .08);
  cursor: pointer; transition: transform .08s;
}
.color-dot:hover { transform: scale(1.08); }
.color-none {
  width: 100%; margin-top: 4px; padding: 6px 0;
  border-top: 1px solid var(--line);
  text-align: center; font-size: 12px; color: var(--muted); cursor: pointer;
}
.color-none:hover { color: var(--primary); }

.typing-hint {
  font-size: 11.5px; color: #8a93a4;
  white-space: nowrap; max-width: 220px;
  overflow: hidden; text-overflow: ellipsis;
  margin-right: 4px;
}

/* 公式栏 */

.formula-bar {
  height: 34px; flex: 0 0 34px;
  display: flex; align-items: center;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding-right: 10px;
}

.cell-ref {
  width: 62px; flex: 0 0 62px;
  text-align: center;
  font-size: 12px; color: #4b566a;
  border-right: 1px solid var(--line);
  line-height: 34px;
  font-family: Consolas, "Courier New", monospace;
}

.fx {
  width: 34px; flex: 0 0 34px;
  text-align: center;
  color: var(--primary);
  font-style: italic;
  font-size: 13px;
  font-weight: 600;
  font-family: Georgia, serif;
}

#formulaInput {
  flex: 1; min-width: 0;
  height: 26px;
  border: none; outline: none;
  font-size: 13px; font-family: inherit;
  color: #263041;
  padding: 0 6px;
  background: transparent;
}
#formulaInput::placeholder { color: #b7c0cf; }

/* 网格 */

.grid-scroll {
  flex: 1;
  overflow: auto;
  background: #fff;
  position: relative;
}

#grid {
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  background: #fff;
}

#grid thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 26px;
  background: var(--head-bg);
  border-bottom: 1px solid var(--line-strong);
  border-right: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 600;
  color: #5c687c;
  cursor: pointer;
  user-select: none;
}

#grid thead th.corner {
  left: 0;
  z-index: 4;
  background: #eef1f7;
}

#grid tbody th {
  position: sticky;
  left: 0;
  z-index: 2;  background: var(--head-bg);
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line-strong);
  font-size: 11.5px;
  font-weight: 500;
  color: #6b7688;
  cursor: pointer;
  user-select: none;
  text-align: center;
}

/* 列宽 / 行高拖动热区 */
.col-grip {
  position: absolute;
  top: 0;
  right: -3px;
  width: 7px;
  height: 100%;
  cursor: col-resize;
  z-index: 6;
}

.row-grip {
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 7px;
  cursor: row-resize;
  z-index: 6;
}

.col-grip:hover, .row-grip:hover { background: rgba(47, 111, 237, 0.45); }

/* 列头上的筛选箭头 */
.col-filt {
  position: absolute;
  right: 6px;
  top: 3px;
  width: 13px;
  height: 13px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: none;
  cursor: pointer;
  z-index: 5;
  opacity: .78;
  border-radius: 3px;
}
.col-filt:hover { opacity: 1; background: rgba(47, 111, 237, .14); }
.col-filt .tri {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #5c687c;
}
.col-filt:hover .tri, #grid thead th.filt .col-filt .tri { border-top-color: var(--primary); }
#grid thead th.filt { background: #dfeaff; color: var(--primary); }
#grid thead th.filt .col-filt { opacity: 1; }

body.resizing { user-select: none; }
body.resizing-col { cursor: col-resize; }
body.resizing-row { cursor: row-resize; }

#grid thead th.hl, #grid tbody th.hl {
  background: #dfeaff;
  color: var(--primary);
  font-weight: 700;
}

#grid td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 0 6px;
  font-size: 12.5px;
  color: #263041;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: cell;
  user-select: none;
  background: #fff;
}

#grid td.num { text-align: right; padding-right: 8px; }
#grid tr:nth-child(even) td { background: #fcfdff; }

#grid td.active {
  background: #fff;
  z-index: 1;
  position: relative;
}

/* 选区整体外框：跟着框选的这一片格子走（单格时就是那一格） */
.sel-frame {
  position: absolute;
  display: none;
  pointer-events: none;
  box-sizing: border-box;
  border: 2px solid var(--primary);
  border-radius: 2px;
  z-index: 3;
}

#grid td.mate {
  background: #eef4ff;
}

#grid td.editing {
  padding: 0;
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.cell-input {
  width: 100%; height: 100%;
  border: none; outline: none;
  padding: 0 5px;
  font-size: 12.5px;
  font-family: inherit;
  color: #263041;
  background: #fff;
}

/* 表内分页：底部页签 */

.sheet-tabs {
  flex: 0 0 32px; height: 32px;
  display: flex; align-items: center; gap: 4px;
  padding: 0 10px;
  border-top: 1px solid var(--line);
  background: #fafbfd;
  overflow-x: auto; overflow-y: hidden;
}
.tab-list { display: flex; align-items: center; gap: 2px; }
.sheet-tab {
  padding: 3px 12px;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.sheet-tab:hover { background: #eef1f7; color: var(--text); }
.sheet-tab.on {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: #c7d8ff;
  font-weight: 600;
}
.sheet-tab.dragging { opacity: 0.45; }
.sheet-tab.drop-before { box-shadow: -2px 0 0 0 var(--primary); }
.tab-name-input {
  width: 92px; font-size: 12px; padding: 2px 4px;
  border: 1px solid #7aa2ff; border-radius: 4px; outline: none;
}
.tab-add {
  width: 26px; height: 24px; flex: 0 0 26px;
  border: 1px solid var(--line-strong); background: #fff;
  border-radius: 6px; cursor: pointer; font-size: 14px; line-height: 1;
  color: var(--text);
}
.tab-add:hover { background: #eef1f7; }

.page-menu {
  position: fixed; z-index: 9999;
  min-width: 132px; padding: 4px;
  background: #fff; border: 1px solid var(--line-strong);
  border-radius: 8px; box-shadow: var(--shadow);
}
.page-menu-item {
  padding: 7px 12px; font-size: 12px; color: var(--text);
  border-radius: 6px; cursor: pointer; white-space: nowrap;
}
.page-menu-item:hover { background: var(--primary-soft); }
.page-menu-item.off { color: #b3b8c2; background: none; cursor: default; }

/* ===== 筛选面板 ===== */
.filt-panel {
  position: fixed;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.filt-panel.hidden { display: none; }
.fp-head { display: flex; align-items: center; padding: 2px 2px 6px; }
.fp-title { font-size: 12px; font-weight: 700; color: var(--text); }
.fp-x {
  margin-left: auto; width: 18px; height: 18px; padding: 0;
  border: 0; background: none; border-radius: 4px;
  color: #98a2b3; font-size: 14px; line-height: 1; cursor: pointer;
}
.fp-x:hover { background: #f1f4f9; color: var(--text); }
.fp-search {
  height: 26px; margin-bottom: 6px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 6px;
  font-family: inherit; font-size: 12px; color: var(--text); outline: none;
}
.fp-search:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(47, 111, 237, .12); }

/* 按颜色筛选 */
.fp-colors { padding: 0 2px 6px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.fp-colors.hidden { display: none; }
.fp-crow { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.fp-clabel { flex: 0 0 auto; font-size: 11.5px; color: #8b93a1; }
.fp-allcolors {
  flex: 0 0 auto;
  height: 20px; padding: 0 6px;
  border: 1px solid var(--line); border-radius: 4px;
  background: #fff; color: #46505f;
  font-family: inherit; font-size: 11px; cursor: pointer;
}
.fp-allcolors:hover { border-color: var(--primary); color: var(--primary); }
.fp-cwrap { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.fp-chip {
  width: 20px; height: 20px; padding: 2px;
  border: 1px solid var(--line-strong); border-radius: 4px;
  background: #fff; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
}
.fp-chip:hover { border-color: var(--primary); }
.fp-chip.on { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(47, 111, 237, .28); }
.fp-chip i { width: 100%; height: 100%; border-radius: 2px; display: block; }
.fp-chip.fp-none {
  position: relative;
  background: repeating-linear-gradient(45deg, #fff 0 3px, #eef1f7 3px 6px);
}
.fp-chip.fp-none::after {
  content: '';
  position: absolute; left: 3px; right: 3px; top: 50%;
  height: 1px; background: #b3bcc9; transform: rotate(-45deg);
}
.fp-list {
  max-height: 206px; overflow: auto;
  border: 1px solid var(--line); border-radius: 6px; padding: 2px;
}
.fp-row {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 6px; border-radius: 5px; cursor: pointer;
}
.fp-row:hover { background: var(--primary-soft); }
.fp-row input { width: 13px; height: 13px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.fp-txt {
  font-size: 12px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fp-txt.blank { color: #98a2b3; font-style: italic; }
.fp-empty { padding: 12px 6px; font-size: 12px; color: #98a2b3; text-align: center; }
.fp-foot { display: flex; align-items: center; gap: 6px; padding-top: 6px; }
.fp-mini {
  height: 24px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 5px; background: #fff;
  font-family: inherit; font-size: 11.5px; color: #334155; cursor: pointer;
}
.fp-mini:hover { border-color: var(--primary); color: var(--primary); }
.fp-ok {
  margin-left: auto; height: 24px; padding: 0 14px;
  border: 1px solid var(--primary); border-radius: 5px;
  background: var(--primary); color: #fff;
  font-family: inherit; font-size: 12px; cursor: pointer;
}
.fp-ok:hover { background: #2560d8; }

/* 状态栏里的筛选提示 */
.st-filter {
  padding: 1px 8px;
  border-radius: 9px;
  background: #e8f0ff;
  color: var(--primary);
  font-size: 11.5px;
  cursor: pointer;
  max-width: 420px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.st-filter:hover { background: #dbe7ff; }

/* 状态栏 */

.statusbar {
  height: 26px; flex: 0 0 26px;
  display: flex; align-items: center; gap: 18px;
  padding: 0 14px;
  border-top: 1px solid var(--line);
  background: #fafbfd;
  font-size: 11.5px;
  color: var(--muted);
}
#statusOnline { margin-left: auto; }

/* ===== 隐藏的行列 ===== */
.hid { display: none !important; }

/* ===== 区域选中 ===== */
#grid td.sel { background: #e8f0ff; box-shadow: inset 0 0 0 100px rgba(47, 111, 237, 0.10); }
#grid tr:nth-child(even) td.sel { background: #e8f0ff; box-shadow: inset 0 0 0 100px rgba(47, 111, 237, 0.10); }

/* ===== 列宽 / 行高数值 ===== */
.size-badge {
  position: absolute;
  right: 4px;
  bottom: 0;
  font-size: 9px;
  line-height: 10px;
  font-weight: 500;
  color: #a5aebc;
  pointer-events: none;
  display: none;
}
body.show-size .size-badge { display: block; }
#grid tbody th { overflow: visible; }

/* ===== 单元格里的图片 ===== */
#grid td.img { padding: 2px; }
#grid td.img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  border-radius: 3px;
}

/* ===== 右键菜单 ===== */
.ctx-menu {
  position: fixed;
  z-index: 60;
  min-width: 176px;
  padding: 5px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(23, 32, 48, 0.16);
  font-size: 12.5px;
  color: #333d4d;
}
.ctx-menu.hidden { display: none; }
.new-doc.hidden { display: none; }
.ctx-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 10px;
  border-radius: 7px;
  cursor: pointer;
}
.ctx-item:hover { background: #eef2f9; }
.ctx-item .k { color: #98a2b3; font-size: 11px; }
.ctx-item .ctx-num {
  width: 54px;
  padding: 2px 5px;
  font: inherit;
  font-size: 12px;
  text-align: center;
  color: #333d4d;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 5px;
}
.ctx-item .ctx-num:focus {
  outline: none;
  border-color: #7aa7ff;
  box-shadow: 0 0 0 2px rgba(122, 167, 255, 0.22);
}
.ctx-item.danger { color: #d94a4a; }
.ctx-sep { height: 1px; margin: 4px 6px; background: var(--line); }
.ctx-title { padding: 5px 10px 3px; font-size: 11px; color: #98a2b3; }

/* ===== 图片大图预览 ===== */
.img-viewer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 11, 18, 0.96);
  backdrop-filter: blur(3px);
}
.img-viewer.hidden { display: none; }

.iv-bar {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 6px;
}
.iv-bar button {
  height: 30px;
  padding: 0 11px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.1);
  color: #e8edf6;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
}
.iv-bar button:hover { background: rgba(255, 255, 255, 0.2); }
.iv-close { width: 32px; padding: 0 !important; font-size: 19px; line-height: 1; }
.iv-zoom {
  padding: 5px 9px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.1);
  color: #cdd8ea;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.iv-stage {
  width: 100%;
  height: 100%;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 52px 20px 44px;
  box-sizing: border-box;
}
.iv-stage img {
  max-width: 100%;
  max-height: calc(100vh - 120px);
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  cursor: zoom-in;
  user-select: none;
  -webkit-user-drag: none;
}
.iv-stage img.zoomed { max-width: none; max-height: none; cursor: zoom-out; }

.iv-tip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  text-align: center;
  color: #9fb0c8;
  font-size: 12px;
  pointer-events: none;
}

body.iv-open { overflow: hidden; }

/* ================= 聊天 ================= */

.chat {
  position: relative;
  width: 316px; flex: 0 0 316px;
  background: #fff;
  border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.chat.hidden { display: none; }

/* 拖文件到聊天面板时的提示层 */
.chat-drop {
  position: absolute; inset: 0; z-index: 70;
  display: none; align-items: center; justify-content: center;
  padding: 18px;
  background: rgba(47, 124, 246, .10);
  pointer-events: none;
}
.chat.dragging .chat-drop { display: flex; }
.chat.dragging::after {
  content: ''; position: absolute; inset: 5px; z-index: 71;
  border: 2px dashed #2f7cf6; border-radius: 10px;
  pointer-events: none;
}
.chat-drop-box {
  text-align: center; color: #1d4ed8;
  background: rgba(255, 255, 255, .88);
  border: 1px solid rgba(47, 124, 246, .45);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 6px 20px rgba(31, 72, 160, .18);
}
.chat-drop-ico { font-size: 26px; line-height: 1; margin-bottom: 8px; }
.chat-drop-t { font-size: 14px; font-weight: 600; }
.chat-drop-s { font-size: 11.5px; color: #5b6b8c; margin-top: 5px; }

.chat-head {
  height: 48px; flex: 0 0 48px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 10px 0 14px;
  border-bottom: 1px solid var(--line);
}
.chat-title { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }

.chat-tabs { display: flex; align-items: center; gap: 2px; }
.chat-tab {
  height: 24px; padding: 0 9px;
  border: none; border-radius: 6px;
  background: transparent; color: #6b7486;
  font-size: 12px; cursor: pointer;
}
.chat-tab:hover { background: #f1f4fa; }
.chat-tab.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

/* 未读红点：每个 tab 一个，红色 + 呼吸光晕 */
.unread-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 5px; margin-left: 6px;
  border-radius: 9px;
  background: #ff3b30; color: #fff;
  font-size: 10.5px; font-weight: 700; line-height: 1;
  vertical-align: 1px;
  animation: unreadPulse 1.5s ease-out infinite;
}
.unread-badge.hidden { display: none; }
@keyframes unreadPulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 59, 48, .5); }
  70%  { box-shadow: 0 0 0 7px rgba(255, 59, 48, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0); }
}

/* 顶栏聊天按钮上的未读角标 */
.chat-toggle { position: relative; }
.chat-dot {
  position: absolute; top: -4px; right: -6px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: #ff3b30; color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px;
  text-align: center; pointer-events: none;
}
.chat-dot.hidden { display: none; }

.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: #eff2f8; color: #77808f; font-size: 10.5px; font-weight: 600;
}
.badge.hot { background: #ff3b30; color: #fff; }
.badge.hidden { display: none; }

.chat-body {
  flex: 1; overflow-y: auto;
  padding: 14px 12px;
  display: flex; flex-direction: column; gap: 11px;
  background: #fbfcfe;
}

.msg { display: flex; gap: 8px; align-items: flex-start; }
.msg.mine { flex-direction: row-reverse; }

.msg-avatar {
  width: 26px; height: 26px; flex: 0 0 26px;
  border-radius: 50%; color: #fff;
  font-size: 11.5px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}

.msg-body { max-width: 208px; }
.msg-name {
  font-size: 10.5px; color: #98a1b0;
  margin-bottom: 3px; display: flex; gap: 6px; align-items: baseline;
}
.msg.mine .msg-name { justify-content: flex-end; }

.msg-bubble {
  background: #fff; border: 1px solid #e9edf5;
  border-radius: 8px; padding: 7px 10px;
  font-size: 12.5px; line-height: 1.55; color: #333c4d;
  white-space: pre-wrap; word-break: break-word;
}
.msg.mine .msg-bubble { background: var(--primary); border-color: var(--primary); color: #fff; }

.sys-line { text-align: center; font-size: 10.5px; color: #a3abb9; }

/* 聊天：多选删除 */

.chat-mini {
  height: 24px; padding: 0 9px;
  border: 1px solid var(--line-strong); border-radius: 6px;
  background: #fff; color: #5b6474;
  font-size: 11.5px; cursor: pointer;
  margin-left: auto; margin-right: 6px;
}
.chat-mini:hover { background: #f1f4fa; border-color: #b9c4d6; }
.chat-mini.on { background: var(--primary); border-color: var(--primary); color: #fff; }

.chat-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 10px;
  background: #f5f8ff;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px; color: #48536a;
}
.chat-bar.hidden { display: none; }
#chatSelInfo { margin-right: auto; }
.chat-bar-btn {
  height: 24px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: 6px;
  background: #fff; color: #48536a;
  font-size: 11.5px; cursor: pointer;
}
.chat-bar-btn:hover { background: #eeF3ff; }
.chat-bar-btn.danger { background: #fff1f1; border-color: #f0c2c2; color: #c93b3b; }
.chat-bar-btn.danger:hover { background: #ffe4e4; }

#chatBody.selecting .msg { cursor: pointer; padding: 3px 4px; border-radius: 8px; }
#chatBody.selecting .msg:hover { background: #f2f6ff; }
#chatBody.selecting .msg.sel { background: #e4edff; box-shadow: inset 0 0 0 1px #b9cdff; }

.msg-check {
  width: 14px; height: 14px; flex: 0 0 14px;
  margin-top: 6px;
  border: 1px solid #c3ccdc; border-radius: 4px;
  background: #fff; position: relative;
}
.msg.sel .msg-check { background: var(--primary); border-color: var(--primary); }
.msg.sel .msg-check::after {
  content: ''; position: absolute; left: 4px; top: 1px;
  width: 4px; height: 8px;
  border-right: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(42deg);
}

.chat-input {
  border-top: 1px solid var(--line);
  padding: 9px 10px 11px;
  display: flex; gap: 7px; align-items: flex-end;
}

/* 聊天：发图片 / 发文件 */

.chat-tools {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 10px 0;
}
.chat-tool {
  height: 25px; padding: 0 11px;
  border: 1px solid var(--line-strong); border-radius: 6px;
  background: #fff; color: #4d586b;
  font-size: 11.5px; cursor: pointer; flex: 0 0 auto;
}
.chat-tool:hover { background: #f1f4fa; border-color: #b9c4d6; }
.chat-tool:disabled { opacity: .55; cursor: default; }
.chat-tip { font-size: 10.5px; color: #a3abb9; margin-left: auto; }

.msg-bubble.img-bubble { padding: 3px; background: #fff; }
.msg.mine .msg-bubble.img-bubble { background: var(--primary); }
.chat-img {
  display: block; max-width: 150px; max-height: 150px;
  border-radius: 6px; cursor: zoom-in; background: #f5f7fb;
}

.msg-bubble.file-bubble { padding: 3px; background: transparent; border: none; }
.chat-file {
  display: flex; align-items: center; gap: 8px;
  max-width: 208px; padding: 7px 9px;
  border: 1px solid #e5eaf3; border-radius: 8px;
  background: #fff; text-decoration: none; color: #333c4d;
}
.chat-file:hover { border-color: #a9c2f7; background: #f7faff; }
.chat-file .cf-ico {
  width: 28px; height: 28px; flex: 0 0 28px;
  border-radius: 7px; background: #edf2fb; color: #4b6bb5;
  font-size: 9.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  text-transform: uppercase;
}
.chat-file .cf-main { min-width: 0; }
.chat-file .cf-name {
  font-size: 12px; line-height: 1.35;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-file .cf-size { font-size: 10.5px; color: #98a1b0; }

.chat-input textarea {
  flex: 1; resize: none;
  border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 7px 9px; font-size: 12.5px;
  font-family: inherit; line-height: 1.5;
  outline: none; color: var(--text);
}
.chat-input textarea:focus { border-color: #a9c2f7; box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.1); }
.chat-input button {
  height: 32px; padding: 0 13px;
  border: none; border-radius: 8px;
  background: var(--primary); color: #fff;
  font-size: 12px; cursor: pointer; flex: 0 0 auto;
}
.chat-input button:hover { background: #2560d8; }

/* ================= 弹窗 ================= */

.modal {
  position: fixed; inset: 0;
  background: rgba(23, 32, 48, 0.45);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}
.modal.hidden { display: none; }

/* 第一道门：没输对的准入ID，什么都看不到 */
.gate {
  position: fixed; inset: 0;
  background: linear-gradient(160deg, #eef3fd 0%, #f7f9fc 55%, #eaf1ff 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 90;
}
.gate.hidden { display: none; }
.gate-card {
  width: 372px; background: #fff; border-radius: 16px;
  padding: 34px 32px 26px; text-align: center;
  box-shadow: 0 26px 60px rgba(16, 33, 66, 0.16);
  border: 1px solid #e6edf9;
}
.gate-logo {
  width: 46px; height: 46px; margin: 0 auto 14px;
  border-radius: 12px; background: var(--primary); color: #fff;
  font-size: 22px; font-weight: 700; line-height: 46px;
  box-shadow: 0 8px 18px rgba(47, 111, 237, 0.32);
}
.gate-card h2 { margin: 0 0 7px; font-size: 17px; letter-spacing: 0.2px; }
.gate-sub { margin: 0 0 20px; font-size: 12.5px; color: var(--muted); }
.gate-card input {
  width: 100%; height: 46px;
  border: 1px solid var(--line-strong); border-radius: 9px;
  padding: 0 12px; outline: none;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 19px; font-weight: 600; letter-spacing: 4px;
  text-align: center; text-transform: uppercase; margin-bottom: 12px;
}
.gate-card input::placeholder { letter-spacing: 1px; font-weight: 400; font-size: 13px; }
.gate-card input:focus { border-color: #a9c2f7; box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12); }
.gate-card button {
  width: 100%; height: 44px; border: none; border-radius: 9px;
  background: var(--primary); color: #fff;
  font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: inherit;
}
.gate-card button:hover { background: #2560d8; }
.gate-err { min-height: 18px; margin-top: 10px; font-size: 12.5px; color: #d93a3a; }
.gate-foot { margin: 14px 0 0; font-size: 11.5px; line-height: 1.7; color: #9aa7bd; }

.modal-box {
  width: 330px; background: #fff; border-radius: 14px;
  padding: 24px 24px 20px; text-align: center;
  box-shadow: 0 20px 50px rgba(10, 20, 40, 0.25);
}
.modal-logo { margin: 0 auto 12px; }
.modal-box h3 { margin: 0 0 6px; font-size: 16.5px; }
.modal-box p { margin: 0 0 15px; font-size: 12.5px; color: var(--muted); }
.modal-box input {
  width: 100%; height: 40px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 0 12px; font-size: 14px; outline: none;
  font-family: inherit; text-align: center; margin-bottom: 13px;
}
.modal-box input:focus { border-color: #a9c2f7; box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12); }
.modal-box button {
  width: 100%; height: 40px; border: none; border-radius: 8px;
  background: var(--primary); color: #fff;
  font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.modal-box button:hover { background: #2560d8; }

.toast {
  position: fixed; left: 50%; bottom: 40px;
  transform: translateX(-50%) translateY(16px);
  background: rgba(31, 38, 50, 0.92); color: #fff;
  font-size: 12.5px; padding: 8px 15px; border-radius: 8px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 60; max-width: 70vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 1200px) {
  .chat { width: 280px; flex-basis: 280px; }
  #sidebar { width: 200px; flex-basis: 200px; }
}

/* 合并单元格：整块居中显示 */
#grid td.merged {
  text-align: center;
  vertical-align: middle;
  white-space: normal;
  overflow: hidden;
}
#grid td.merged.num { text-align: center; }


/* ================= 权限：只看徽章 / 只读态 / 成员面板 ================= */

.role-tag {
  font-size: 12px; padding: 2px 9px; border-radius: 999px;
  background: #fff4e5; color: #b45309; border: 1px solid #ffd9a8;
  white-space: nowrap;
}
.role-tag.owner { background: #e9f0ff; color: #2f6fed; border-color: #c7dbff; }

#grid.readonly td { cursor: default; }
#grid.readonly th { cursor: default; }

.mem-box { width: 560px; max-width: 92vw; max-height: 86vh; display: flex; flex-direction: column; }
.mem-head { display: flex; align-items: center; justify-content: space-between; }
.mem-head h3 { margin: 0; }
.mem-hint { color: var(--muted); font-size: 12.5px; line-height: 1.7; margin: 8px 0 12px; }
.mem-codes { display: flex; gap: 10px; flex-wrap: wrap; }
.mem-code {
  flex: 1 1 200px; background: var(--head-bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; display: flex; align-items: center; gap: 8px;
}
.mem-code-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.mem-code b { font-size: 15px; letter-spacing: 1px; font-family: ui-monospace, Consolas, monospace; flex: 1; }
.mem-copy {
  border: 1px solid var(--line-strong); background: #fff; color: var(--text);
  font-size: 12px; padding: 3px 10px; border-radius: 6px; cursor: pointer;
}
.mem-copy:hover { background: var(--primary-soft); }
.mem-list-head { font-size: 12px; color: var(--muted); margin: 14px 0 6px; }
.mem-list { overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.mem-banned { margin-top: 8px; }
.mem-banned .mem-list { border-style: dashed; }
.mem-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 13px;
}
.mem-row:last-child { border-bottom: none; }
.mem-row .mem-who { flex: 1; min-width: 0; }
.mem-row .mem-name { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.mem-row .mem-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #cbd5e1; }
.mem-row .mem-dot.on { background: #16a34a; }
.mem-row .mem-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.mem-badge {
  font-size: 11.5px; padding: 2px 7px; border-radius: 6px;
  background: var(--primary-soft); color: var(--primary); white-space: nowrap;
}
.mem-badge.view { background: #fff4e5; color: #b45309; }
.mem-badge.owner { background: #eaf7ee; color: #15803d; }
.mem-act { display: flex; gap: 6px; }
.mem-act button {
  border: 1px solid var(--line-strong); background: #fff; font-size: 12px;
  padding: 3px 9px; border-radius: 6px; cursor: pointer; color: var(--text);
}
.mem-act button:hover { background: var(--primary-soft); }
.mem-act button.danger { color: #dc2626; border-color: #f4c7c7; }
.mem-act button.danger:hover { background: #fdecec; }
@media (max-width: 640px) { .mem-row { flex-wrap: wrap; } }
.role-tag.hidden { display: none; }
.icon-btn.hidden { display: none; }
.mem-codes.hidden { display: none; }
.mem-banned.hidden { display: none; }
.mem-empty { padding: 14px 12px; color: var(--muted); font-size: 12.5px; }
/* 面板内按钮：压过 .modal-box button 的全局蓝底大按钮样式 */
.mem-box .mem-head h3 { white-space: nowrap; }
.mem-box .mem-head .icon-btn {
  background: transparent; color: var(--muted); font-size: 18px; line-height: 1;
  padding: 2px 8px; border-radius: 8px; box-shadow: none; border: none;
}
.mem-box .mem-head .icon-btn:hover { background: var(--head-bg); color: var(--text); }
/* 弹窗右上角的关闭叉：一整块红底、黑色叉，点按区域做大 */
.mem-box .mem-head .close-x {
  width: 48px;
  height: 36px;
  min-width: 48px;
  padding: 0;
  border: 1px solid #e0434a;
  border-radius: 6px;
  background: #e0434a;
  color: #141414;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
}
.mem-box .mem-head .close-x:hover {
  background: #c9343b;
  border-color: #c9343b;
  color: #141414;
}
.mem-box .mem-copy {
  background: #fff; color: var(--text); font-size: 12px; font-weight: 500;
  padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: 6px; box-shadow: none;
  cursor: pointer;
}
.mem-box .mem-copy:hover { background: var(--primary-soft); }
.mem-box .mem-act button {
  background: #fff; color: var(--text); font-size: 12px; font-weight: 500;
  padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: 6px; box-shadow: none;
  cursor: pointer;
}
.mem-box .mem-act button:hover { background: var(--primary-soft); }
.mem-box .mem-act button.danger { color: #dc2626; border-color: #f4c7c7; }
.mem-box .mem-act button.danger:hover { background: #fdecec; }
/* 只读时工具按钮的样子：能点，但点下去会提示没权限 */
.ro-dim { opacity: 0.5; cursor: not-allowed; }

/* ---------- 冻结首行 ---------- */
#grid.freeze1 tbody tr:first-child td {
  position: sticky;
  top: 26px;
  z-index: 2;
  background: #fff;
  box-shadow: 0 2px 0 -1px rgba(30, 41, 59, .16);
}
#grid.freeze1 tbody tr:first-child th {
  position: sticky;
  left: 0;
  top: 26px;
  z-index: 3;
  box-shadow: 0 2px 0 -1px rgba(30, 41, 59, .16);
}
#grid.freeze1 tbody tr:first-child td.sel,
#grid.freeze1 tbody tr:first-child td.range {
  background: var(--primary-soft);
}

/* ---------- 工具按钮状态 ---------- */
.rb-group button.off { opacity: .42; cursor: default; }
.rb-group button.on {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
/* ---------- 私聊 ---------- */
.dm-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-bottom: 1px solid var(--line); background: #f7f9fd;
}
.dm-bar.hidden { display: none; }
.dm-pick {
  height: 22px; padding: 0 9px; border: 1px solid #c9d8f7; border-radius: 6px;
  background: #fff; color: var(--primary); font-size: 11.5px; cursor: pointer; flex: none;
}
.dm-pick:hover { background: #eef4ff; }
.dm-peer {
  font-size: 12px; font-weight: 600; color: #1f2d3d; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dm-state { font-size: 10.5px; color: var(--muted); flex: none; }
.dm-state.on { color: #16a34a; }

.dm-sheet {
  position: absolute; left: 8px; right: 8px; top: 42px; z-index: 8;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 30px rgba(20, 35, 70, .2);
  display: flex; flex-direction: column; max-height: 60%;
}
.dm-sheet.hidden { display: none; }
.dm-sheet-head {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-bottom: 1px solid var(--line);
}
.dm-sheet-head b { font-size: 13px; color: #1f2d3d; }
.dm-sheet-sub { flex: 1; font-size: 10.5px; color: var(--muted); }
.dm-add { display: flex; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.dm-add input {
  flex: 1; min-width: 0; height: 26px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 6px; font-size: 12px; outline: none;
}
.dm-add input:focus { border-color: #a9c2f2; box-shadow: 0 0 0 2px rgba(47, 111, 237, .1); }
.dm-add button {
  height: 26px; padding: 0 10px; border: 1px solid var(--primary); border-radius: 6px;
  background: var(--primary); color: #fff; font-size: 12px; cursor: pointer; flex: none;
}
.dm-add button:hover { filter: brightness(1.05); }
.dm-list { overflow: auto; padding: 4px; min-height: 60px; flex: 1; }
.dm-row {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 8px; border-radius: 8px; cursor: pointer;
}
.dm-row:hover { background: #f2f6fe; }
.dm-row.on { background: var(--primary-soft); }
.dm-dot { width: 7px; height: 7px; border-radius: 50%; background: #cfd7e2; flex: none; }
.dm-dot.on { background: #16a34a; }
.dm-row-main { flex: 1; min-width: 0; }
.dm-row-name { font-size: 12.5px; color: #1f2d3d; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-row-sub { font-size: 10px; color: var(--muted); letter-spacing: .3px; }
.dm-row-badge {
  flex: none; min-width: 16px; height: 16px; padding: 0 5px; border-radius: 8px;
  background: #ff3b30; color: #fff; font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.dm-row-del {
  border: none; background: transparent; color: #c3cedd;
  font-size: 14px; line-height: 1; cursor: pointer; padding: 2px 3px; border-radius: 5px;
}
.dm-row-del:hover { color: #ef4444; background: #fdecec; }
.dm-empty { padding: 16px 12px; font-size: 12px; color: var(--muted); text-align: center; line-height: 1.7; }
.dm-tip { padding: 7px 10px; font-size: 10.5px; color: var(--muted); border-top: 1px solid var(--line); }

/* ===== 历史版本 / 协作记录 面板 ===== */
.hist-open { font-size: 11.5px; padding: 0 8px; letter-spacing: .5px; }
.hist-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 322px;
  background: #fff;
  border-left: 1px solid #dfe6f0;
  box-shadow: -10px 0 26px rgba(15, 30, 60, .10);
  z-index: 70;
  display: flex;
  flex-direction: column;
}
.hist-panel.hidden { display: none; }
.hist-head { display: flex; align-items: center; gap: 4px; padding: 10px 10px 7px; border-bottom: 1px solid #eef1f6; }
.hist-tab { border: 0; background: #f2f5fa; color: #51607a; font-size: 12px; padding: 5px 10px; border-radius: 6px; cursor: pointer; }
.hist-tab.on { background: #e8f0ff; color: #2f6fed; font-weight: 600; }
.hist-x { margin-left: auto; border: 0; background: none; font-size: 17px; color: #93a0b4; cursor: pointer; padding: 0 4px; line-height: 1; }
.hist-note { font-size: 11px; color: #93a0b4; padding: 6px 12px 2px; line-height: 1.5; }
.hist-body { flex: 1; overflow: auto; padding: 4px 10px 18px; }
.hist-row { border-bottom: 1px solid #f1f4f9; padding: 8px 2px; }
.hist-time { font-size: 11px; color: #93a0b4; }
.hist-action { font-size: 12.5px; color: #26303f; margin: 2px 0 3px; line-height: 1.45; }
.hist-meta { font-size: 11px; color: #7b8798; }
.hist-btn { margin-top: 6px; border: 1px solid #cfdcf0; background: #fff; color: #2f6fed; font-size: 11.5px; padding: 3px 10px; border-radius: 6px; cursor: pointer; }
.hist-btn:hover { background: #f2f7ff; }
.hist-btn + .hist-btn { margin-left: 6px; }
.hist-btn-ghost { border-color: #dbe3f1; color: #5b677f; }
.hist-btn-ghost:hover { background: #f6f8fd; }
.hist-empty { color: #93a0b4; font-size: 12px; padding: 22px 4px; text-align: center; line-height: 1.8; }
.hist-evt { display: flex; gap: 8px; padding: 7px 2px; border-bottom: 1px solid #f1f4f9; }
.hist-edot { width: 7px; height: 7px; border-radius: 50%; background: #2f6fed; margin-top: 6px; flex: none; }
.hist-emain { flex: 1; }
.hist-ename { font-size: 12px; color: #26303f; font-weight: 600; }
.hist-etext { font-size: 12px; color: #51607a; margin-top: 1px; line-height: 1.45; }
.hist-etime { font-size: 10.5px; color: #93a0b4; margin-top: 2px; }

/* 谁正在这一格里编辑：格子描一圈对方的颜色，右上角贴名字 */
#grid td.peer-editing {
  position: relative;
  outline: 2px solid var(--pm, #2f6fed);
  outline-offset: -2px;
}
.peer-mark {
  position: absolute;
  top: 0;
  right: 0;
  max-width: 100%;
  padding: 1px 5px;
  border-radius: 0 0 0 5px;
  color: #fff;
  font-size: 10px;
  line-height: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  z-index: 5;
  opacity: 0.95;
}

/* 别人选中的那片区域：他的颜色虚线框 + 左上角名字 */
.peer-sel {
  position: absolute;
  pointer-events: none;
  border: 2px dashed var(--ps, #e8590c);
  box-sizing: border-box;
  border-radius: 2px;
  z-index: 2;
}
.peer-sel-tag {
  position: absolute;
  left: 0;
  top: 0;
  padding: 1px 5px;
  border-radius: 2px 0 4px 0;
  color: #fff;
  font-size: 10px;
  line-height: 14px;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 侧栏里的财务入口，用描边区分于两个实心按钮 */
.fin-doc {
  margin-top: 6px;
  background: #fff;
  color: #2f6fed;
  border: 1px solid #b9cdff;
}
.fin-doc:hover { background: #f1f6ff; }

/* 侧栏里的共享文件入口 */
.share-doc {
  margin-top: 6px;
  background: #fff;
  color: #4b5563;
  border: 1px dashed #cfd8e3;
}
.share-doc:hover { background: #f6f8fb; color: #2f6fed; border-color: #b9cdff; }

/* 共享文件面板 */
.share-box { width: 640px; }
.share-box .mem-head h3 { white-space: nowrap; }
.share-ops { display: flex; align-items: center; gap: 10px; margin: 10px 0 6px; }
.share-ops .share-pick { width: auto; flex: 0 0 auto; }
.share-pick {
  width: auto;
  height: 32px;
  padding: 0 14px;
  border-radius: 6px;
  border: 0;
  background: #2f6fed;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.share-pick:hover { background: #2459c9; }
.share-pick:disabled { background: #9db4e3; cursor: default; }
.share-status { color: #6b7280; font-size: 12px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-prog {
  height: 6px;
  background: #e8eef7;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}
.share-prog.hidden { display: none; }
.share-prog > div { height: 100%; width: 0; background: #2f6fed; transition: width 0.15s linear; }
.share-list { max-height: 46vh; overflow: auto; border-top: 1px solid #eef1f6; }
.share-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 2px;
  border-bottom: 1px solid #f1f4f9;
}
.share-row .sf-name {
  flex: 1;
  min-width: 0;
  text-align: left;
  font-size: 13px;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.share-row .sf-meta { color: #8b93a1; font-size: 12px; white-space: nowrap; }
.share-row .sf-btn {
  width: auto;
  height: 26px;
  padding: 0 10px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 400;
  cursor: pointer;
  border: 1px solid #d8e0ec;
  background: #fff;
  color: #334155;
}
.share-row .sf-btn:hover { background: #f6f8fb; border-color: #2f6fed; color: #2f6fed; }
.share-row .sf-del { color: #b91c1c; border-color: #f0d3d3; }
.share-row .sf-del:hover { background: #fdf2f2; border-color: #dc2626; color: #dc2626; }
.share-empty { color: #9aa3af; text-align: center; padding: 22px 0; font-size: 13px; }
.share-empty.hidden { display: none; }

/* 邮编查城市面板 */
.postcode-box { width: 560px; }
.postcode-ops { display: flex; align-items: center; gap: 8px; margin: 10px 0 8px; }
.postcode-select {
  height: 32px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid #d8e0ec;
  background: #fff;
  color: #334155;
  font-size: 13px;
  outline: none;
}
.postcode-select:focus { border-color: #2f6fed; }
.postcode-ops .share-pick { height: 32px; }
.postcode-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 76px;
  max-height: 30vh;
  padding: 8px 10px;
  border: 1px solid #d8e0ec;
  border-radius: 6px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.6;
  color: #111827;
  resize: vertical;
  outline: none;
}
.postcode-input:focus { border-color: #2f6fed; }
.postcode-list { max-height: 38vh; overflow: auto; margin-top: 8px; }
.pc-row {
  display: grid;
  grid-template-columns: 110px 1fr 180px;
  gap: 8px;
  align-items: center;
  padding: 8px 6px;
  border-bottom: 1px solid #f1f4f9;
  font-size: 13px;
  cursor: pointer;
}
.pc-row:hover { background: #f7f9ff; }
.pc-row-fail { cursor: default; }
.pc-row-fail:hover { background: transparent; }
.pc-code { font-family: Consolas, "Courier New", monospace; color: #111827; }
.pc-city { color: #1f2a37; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-row-fail .pc-city { color: #b91c1c; font-weight: 400; }
.pc-rest { color: #8b93a1; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.postcode-foot { display: flex; justify-content: flex-end; margin-top: 10px; }
.postcode-foot .sf-btn {
  width: auto;
  height: 28px;
  padding: 0 12px;
  border-radius: 5px;
  border: 1px solid #d8e0ec;
  background: #fff;
  color: #334155;
  font-size: 12px;
  cursor: pointer;
}
.postcode-foot .sf-btn:hover { border-color: #2f6fed; color: #2f6fed; background: #f6f8fb; }

/* 随机地址面板 */
.rand-box { width: 680px; }
.rand-ops { display: flex; align-items: center; gap: 8px; margin: 10px 0 8px; }
.rand-count {
  width: 76px;
  height: 32px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid #d8e0ec;
  font-size: 13px;
  color: #334155;
  outline: none;
}
.rand-count:focus { border-color: #2f6fed; }
.rand-ops .share-pick { height: 32px; }
.rand-list { max-height: 44vh; overflow: auto; margin-top: 6px; border-top: 1px solid #eef1f6; }
.ra-row {
  padding: 9px 8px 10px;
  border-bottom: 1px solid #f1f4f9;
  text-align: left;
}
.ra-row:hover { background: #fafbff; }
.ra-head { display: flex; align-items: baseline; gap: 8px; }
.ra-line {
  flex: 0 1 auto;
  color: #1f2a37;
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
  cursor: pointer;
}
.ra-line:hover { color: #2f6fed; }
.ra-cc { margin-left: auto; color: #9aa3af; font-size: 12px; white-space: nowrap; }
.ra-fields { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.rand-box .ra-f {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: auto;
  height: 22px;
  padding: 0 7px;
  border: 1px solid #e2e8f2;
  border-radius: 4px;
  background: #fff;
  font-size: 12px;
  font-weight: 400;
  line-height: 20px;
  color: #334155;
  cursor: pointer;
}
.rand-box .ra-f:hover { border-color: #2f6fed; background: #f2f6ff; color: #1d4ed8; }
.ra-k { color: #9aa3af; font-size: 11px; font-weight: 400; }
.ra-v { font-weight: 500; }

.rand-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.rand-cols { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 1 1 auto; min-width: 0; }
.rand-cols-tip { color: #9aa3af; font-size: 12px; }
.rand-box .ra-col {
  width: auto;
  height: 26px;
  padding: 0 10px;
  border: 1px solid #e2e8f2;
  border-radius: 4px;
  background: #fff;
  font-size: 12px;
  font-weight: 400;
  color: #334155;
  cursor: pointer;
}
.rand-box .ra-col:hover { border-color: #2f6fed; color: #1d4ed8; background: #f2f6ff; }
.rand-foot .sf-btn {
  width: auto;
  height: 28px;
  padding: 0 12px;
  border-radius: 5px;
  border: 1px solid #d8e0ec;
  background: #fff;
  font-size: 12px;
  font-weight: 400;
  color: #334155;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
}
.rand-foot .sf-btn:hover { border-color: #2f6fed; color: #2f6fed; background: #f6f8fb; }

/* 单独浮窗：不盖遮罩、不挡表格，可拖动到一边 */
#randModal { background: transparent; backdrop-filter: none; pointer-events: none; }
#randModal .rand-box {
  position: fixed;
  top: 88px;
  right: 28px;
  left: auto;
  margin: 0;
  width: 420px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 140px);
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  border: 1px solid #e3e8f0;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.22);
  z-index: 70;
}
#randModal .rand-box .mem-head { flex: 0 0 auto; cursor: move; user-select: none; touch-action: none; }
#randModal .rand-box .mem-head .close-x { cursor: pointer; }
#randModal .rand-box .mem-hint { flex: 0 0 auto; }
#randModal .rand-box .rand-ops { flex: 0 0 auto; }
#randModal .rand-box .rand-list { flex: 1 1 auto; min-height: 0; max-height: none; }
#randModal .rand-box .rand-foot { flex: 0 0 auto; }
#randModal.dragging { user-select: none; }

/* 2FA 验证码弹窗 */
.totp-box { width: 340px; }
.totp-code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 4px;
  color: #1f2937;
  margin: 4px 0 12px;
  user-select: all;
}
.totp-bar { height: 6px; background: #eef2f8; border-radius: 3px; overflow: hidden; }
.totp-bar > div { height: 100%; width: 100%; background: #2f6fed; transition: width 0.25s linear; }
.totp-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}
.totp-left { color: #6b7280; font-size: 12px; }
.totp-actions .totp-copy {
  width: auto;
  height: 32px;
  padding: 0 14px;
  border-radius: 6px;
  border: 0;
  background: #2f6fed;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.totp-actions .totp-copy:hover { background: #2459c9; }

/* 售后命中格子：单号后面挂一个红字标记 */
.sale-mark {
  color: #e5484d;
  font-size: calc(1em + 1px);
  font-weight: 700;
  white-space: nowrap;
  margin-left: 1px;
  text-decoration: none;
}

/* 品牌图标：蓝色方块「表」换成「十二」书法图，透明底 */
.logo, .modal-logo, .gate-logo {
  width: auto;
  height: 34px;
  padding: 0;
  background: none;
  border-radius: 0;
  box-shadow: none;
  color: transparent;
  font-size: 0;
  line-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gate-logo { height: 40px; }
.logo img, .modal-logo img, .gate-logo img {
  height: 100%;
  width: auto;
  display: block;
}

/* 侧栏品牌：去掉「十二电商 / 在线协作表格」两行文字，只用「十二电商」书法图 */
.brand { padding: 2px 6px 12px; }
.brand .logo {
  height: 52px;
  width: 100%;
  justify-content: center;
}

/* 表名：平时只读，双击左键才进编辑；平常不做出“点进去改”的样子 */
.sheet-title { cursor: default; }
.sheet-title:not(.title-editing) { background: transparent; }
.sheet-title:not(.title-editing):hover { background: transparent; }
.sheet-title:not(.title-editing):focus { background: transparent; box-shadow: none; }
.sheet-title.title-editing { cursor: text; }
.sheet-title.title-editing:focus { background: #fff; box-shadow: 0 0 0 2px rgba(47, 111, 237, 0.18); }
.sheet-title.readonly { cursor: not-allowed; }

/* 填色 / 字色的当前颜色块：由“一横”改成正方形，浅色也能看清 */
.xp-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  min-width: 12px;
  border-radius: 3px;
  margin-left: 5px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.22);
  background: #fff3bf;
}

/* 色块再加长一个字的宽度，浅色更醒目 */
.xp-swatch {
  width: 24px;
  min-width: 24px;
  height: 12px;
}

/* ---------- 颜色面板右上角“快捷键” + 快捷键设置面板 ---------- */
.color-pop-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.color-pop-hk {
  flex: 0 0 auto;
  height: 20px;
  padding: 0 8px;
  border: 1px solid #d7dfea;
  border-radius: 10px;
  background: #fff;
  color: #5c6b7f;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
}
.color-pop-hk:hover { border-color: #2f6fed; color: #2f6fed; background: #f3f7ff; }

.hk-pop {
  position: fixed;
  z-index: 9000;
  width: 320px;
  max-height: 72vh;
  overflow: auto;
  background: #fff;
  border: 1px solid #dfe5ee;
  border-radius: 10px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.18);
  padding: 10px 12px 12px;
  font-size: 12.5px;
  color: var(--text);
}
.hk-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.hk-title { font-size: 13px; font-weight: 700; }
.hk-x {
  width: 20px; height: 20px; padding: 0; border: 0; background: none;
  color: #8a94a6; font-size: 15px; line-height: 1; cursor: pointer;
}
.hk-x:hover { color: #e5484d; }
.hk-tip { color: #7b8798; font-size: 11.5px; line-height: 1.55; margin-bottom: 6px; }
.hk-sec {
  margin: 10px 0 4px; padding-top: 8px;
  border-top: 1px solid #eef2f7;
  color: #5c6b7f; font-size: 11.5px; font-weight: 700;
}
.hk-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.hk-dot {
  flex: 0 0 auto; width: 14px; height: 14px; border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}
.hk-dot-none {
  background: #fff;
  background-image: linear-gradient(45deg, #e2e6ee 25%, transparent 25%, transparent 75%, #e2e6ee 75%),
    linear-gradient(45deg, #e2e6ee 25%, transparent 25%, transparent 75%, #e2e6ee 75%);
  background-size: 6px 6px;
  background-position: 0 0, 3px 3px;
}
.hk-name {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: #46536a;
}
.hk-key {
  flex: 0 0 auto;
  width: 104px;
  height: 24px;
  border: 1px solid #d7dfea;
  border-radius: 6px;
  background: #fbfcfe;
  color: #334155;
  font-family: inherit;
  font-size: 11.5px;
  text-align: center;
  outline: none;
  cursor: pointer;
}
.hk-key::placeholder { color: #b3bccb; }
.hk-key.rec { border-color: #2f6fed; background: #fff; box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12); }
.hk-clear {
  width: 100%;
  margin-top: 10px;
  height: 28px;
  border: 1px dashed #dfe5ee;
  border-radius: 7px;
  background: #fff;
  color: #8a94a6;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}
.hk-clear:hover { border-color: #e5484d; color: #e5484d; }

/* ================= 顶栏闹钟（倒计时，三个独立） ================= */
.top-timers {
  flex: 0 0 auto;
  align-self: stretch;
  display: flex;
  align-items: stretch;
  gap: 5px;
}
.top-timer {
  flex: 0 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 4px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fafbfd;
}
.tm-time {
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .3px;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 3px;
  min-width: 46px;
  text-align: center;
  cursor: pointer;
}
.tm-time:hover { background: #f1f5fd; border-color: #dfe6f3; }
.tm-time.hidden, .tm-edit.hidden { display: none; }
.top-timer.run .tm-time { color: var(--primary); }
.top-timer.warn .tm-time { color: #c92a2a; }
.top-timer.alarm .tm-time { color: #c92a2a; animation: tm-blink .7s steps(2, start) infinite; }
@keyframes tm-blink { 50% { opacity: .18; } }
.tm-edit {
  width: 62px;
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--primary);
  border-radius: 6px;
  padding: 3px 3px;
  outline: none;
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}
.tm-ico {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  border: 1px solid transparent;
}
.tm-play { background: var(--primary); color: #fff; border-color: var(--primary); }
.tm-play:hover { background: #2260d8; border-color: #2260d8; }
.tm-reset { background: #fff; color: #55617a; border-color: var(--line-strong); }
.tm-reset:hover { color: var(--primary); border-color: var(--primary); }
.tm-ic { width: 13px; height: 13px; display: block; }
.tm-ic-pause { display: none; }
.tm-play.on .tm-ic-play { display: none; }
.tm-play.on .tm-ic-pause { display: block; }

/* 时间到：整页不停闪烁（点重置/开始/时间就停） */
.tm-flash {
  position: fixed;
  inset: 0;
  z-index: 9990;
  pointer-events: none;
  display: none;
  background: rgba(220, 38, 38, 0.26);
  box-shadow: inset 0 0 0 6px rgba(220, 38, 38, 0.45);
}
.tm-flash.on { display: block; animation: tm-flash-blink 0.8s steps(1, end) infinite; }
@keyframes tm-flash-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
