/* ============================================================
   音乐表格视图 · 样式（合并后挂在 public/index.html 的 #view-table 容器上）
   ------------------------------------------------------------
   来源：原单文件工具「原神音乐表格.html」的 <style>（L27-200）+ body 骨架里的
   Tailwind 工具类。迁移到本系统后：
     · 颜色一律改用 theme.css 的设计令牌（var(--…)），浅色为默认、
       深色走 [data-theme="dark"]，不再写死深色面板；
     · 不再依赖 Tailwind CDN 与 Font Awesome 在线 CSS —— 工具类用本文件
       「垫层」精确复刻，图标用 mask-image + 内联 SVG 复刻；
     · 新增两个本项目专属组件：#sync-status 同步状态条、.btn-menu 导出下拉。

   作用域：除组件外，全部规则挂在 #view-table 下，避免影响「更新分析」页。
   ============================================================ */

/* ============================================================
   1. 视图容器（替代原 body 上的 bg-gray-900 text-gray-100 min-h-screen flex flex-col）
   ------------------------------------------------------------
   合并到单一页面后，页面骨架（.shell / .pagehead / 页尾）由 theme.css 负责，
   这里只保证 #view-table 自己是个普通的块级容器、文字色跟随主题。
   ============================================================ */
#view-table {
    color: var(--text-primary);
}

/* ============================================================
   2. 原 <style>（L27-200）自定义类 —— 结构原样保留，颜色改为令牌
   ============================================================ */
#view-table .scrollbar-thin {
    scrollbar-width: thin;
}

#view-table .scrollbar-thumb-rounded {
    scrollbar-color: var(--scroll-thumb) transparent;
}

#view-table .dark-glass-effect {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border);
}

#view-table .cell-content {
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.5;
}

#view-table .copy-btn {
    opacity: 0;
    transition: opacity 0.2s ease;
}

#view-table tr:hover .copy-btn {
    opacity: 1;
}

#view-table .paste-area {
    min-height: 120px;
    font-family: inherit;
    transition: all 0.3s ease;
    scrollbar-width: none;
}

#view-table .paste-area::-webkit-scrollbar {
    display: none;
}

#view-table .paste-area:focus {
    outline: none;
    border-color: var(--action);
    box-shadow: 0 0 0 3px var(--glow-action);
}

#view-table .paste-area.drag-over {
    border-color: var(--action);
    background-color: var(--action-soft);
}

#view-table .table-tab-btn {
    display: inline-flex;
    align-items: center;
}

#view-table .table-tab-btn .delete-icon {
    display: none;
    margin-left: 8px;
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
    color: inherit;
    cursor: pointer;
}

#view-table .table-tab-btn.show-delete .delete-icon {
    display: inline-block;
}

#view-table .table-tab-btn.show-delete .delete-icon:hover {
    color: var(--accent-rose);
}

#view-table .error-row {
    background-color: rgba(var(--accent-rose-rgb), 0.1);
}

#view-table .error-row td {
    border-color: rgba(var(--accent-rose-rgb), 0.3);
}

/* 选中行：淡主题色底 + 最左侧一条竖描边（比只换背景更容易一眼看到勾了哪几行） */
#view-table .selected-row {
    background-color: rgba(var(--action-rgb), 0.16);
}

#view-table .selected-row td:first-child {
    box-shadow: inset 3px 0 0 var(--action);
}

/* ---------- 最左侧勾选列：自绘复选框（原生控件太小、和主题不搭） ---------- */
#view-table :is(.row-check, #select-all-check) {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    margin: 0;
    vertical-align: middle;
    border: 1.5px solid var(--border-strong);
    border-radius: 5px;
    background: var(--surface-inset);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

#view-table :is(.row-check, #select-all-check):hover {
    border-color: var(--action);
}

#view-table :is(.row-check, #select-all-check):focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--glow-action);
}

#view-table :is(.row-check, #select-all-check):checked {
    border-color: transparent;
    background: var(--grad-action);
    box-shadow: 0 2px 8px var(--glow-action);
}

#view-table :is(.row-check, #select-all-check):checked::after {
    content: '';
    width: 4px;
    height: 8px;
    border: 2px solid var(--btn-on-accent);
    border-top: 0;
    border-left: 0;
    transform: translateY(-1px) rotate(45deg);
}

/* 勾选列不参与排版挤压：定宽 + 居中 */
#view-table #table-body td:first-child {
    vertical-align: middle;
}

/* 表头里的「全选」与「反选」：对齐成一组紧凑控件 */
#view-table th:first-child > .flex {
    gap: var(--sp-2);
}

/* 「反选」是纯图标按钮：不重置的话会带上 UA 默认的按钮底色与描边，
   在暗色 color-scheme 下就成了一块灰方块，和旁边的复选框完全不搭 */
#view-table #select-invert-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.16s ease, background-color 0.16s ease;
}

#view-table #select-invert-btn:hover {
    color: var(--action);
    background: var(--action-soft);
}

#view-table #select-invert-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--glow-action);
}

/* 表格的横向滚动容器：底部留 18px（≈ 插入按钮的一半身高 + 余量），
   给末行「+ 在此插入行」按钮的下一半留位置 ——
   不留的话，按钮会被 overflow:auto 的容器裁掉一截 */
#view-table .table-scroll {
    padding-bottom: 18px;
}

/* ---------- 「序号」列开关（在表格工具栏里） ---------- */
#index-col-toggle.is-active {
    background: var(--action-soft);
    border-color: rgba(var(--action-rgb), 0.45);
    color: var(--action);
}

/* ---------- 游客只读：写入口与编辑能力整体收起来（JS 里也逐个挡了） ---------- */
body[data-readonly="1"] #view-table .editable-cell {
    pointer-events: none;
}

body[data-readonly="1"] #view-table .editable-cell:hover {
    background: none;
    box-shadow: none;
}

body[data-readonly="1"] #view-table .group-standard-input {
    pointer-events: none;
    opacity: 0.7;
}

body[data-readonly="1"] #view-table .row-insert-hint,
body[data-readonly="1"] #view-table .group-apply-btn,
body[data-readonly="1"] #view-table .group-reset-btn,
body[data-readonly="1"] #view-table .group-use-standard,
body[data-readonly="1"] #view-table .table-tab-btn .delete-icon,
body[data-readonly="1"] #fix-errors-btn,
body[data-readonly="1"] #floating-delete {
    display: none !important;
}

/* 行间插入提示：高度 0 的横线上挂一个按钮。
   宽度由 JS 按表格真实宽度设定（表格比视口宽时要一直画到最右一列），
   按钮的 left 也由 JS 跟着指针给，所以这里不写 right / 50%。 */
#view-table .row-insert-hint {
    position: absolute;
    left: 0;
    width: 100%;
    height: 0;
    z-index: 30;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease;
}

#view-table .row-insert-hint.show {
    opacity: 1;
}

#view-table .row-insert-hint::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: -1px;
    height: 2px;
    background-color: var(--action);
    opacity: 0.75;
}

#view-table .row-insert-btn {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translate(-50%, -50%);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    font-size: 12px;
    line-height: 18px;
    white-space: nowrap;
    border-radius: var(--r-pill);
    border: none;
    font-family: inherit;
    cursor: pointer;
    background-color: var(--action);
    color: var(--btn-on-accent);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
    pointer-events: none;
}

#view-table .row-insert-hint.show .row-insert-btn {
    pointer-events: auto;
}

#view-table .row-insert-btn:hover {
    background-color: var(--action-alt);
}

/* 序号列只读（第 32 轮）：宽度固定、永不换行 ——
   它是「行的位置」而不是可编辑内容，宽度随内容漂移会让整张表的列线一跳一跳。
   宽度按最长形态（三位前缀 + 两位序号，如 10.123）留够，窄屏也不压缩。 */
#view-table .col-serial { width: 4.6rem; }
#view-table .serial-cell-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    white-space: nowrap;
}
#view-table .serial-cell {
    display: block;
    min-width: 2.6rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    cursor: default;
    border-radius: 4px;
}
/* 悬停不再有「可编辑」的底色与描边 —— 它压根点不进去 */
#view-table .serial-cell:hover { background: none; box-shadow: none; }

#view-table .editable-cell {
    display: inline-block;
    min-width: 12px;
    outline: none;
    border-radius: 4px;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

#view-table .editable-cell:hover {
    background-color: var(--surface-hover);
    box-shadow: inset 0 0 0 1px var(--border-strong);
}

#view-table .group-record-field[data-override="1"] {
    background-color: rgba(var(--accent-gold-rgb), 0.12);
    box-shadow: inset 0 0 0 1px var(--accent-gold);
}

#view-table .editable-cell:focus {
    background-color: var(--action-soft);
    box-shadow: inset 0 0 0 1px var(--action);
}

#view-table .editable-cell.cell-block {
    display: block;
}

/* 普通表格：宽度跟着容器走，列宽由内容自动分配。
   以前每列写死 min-width（96+224+104+256+152），加起来就必然横向溢出；
   现在不设下限，放不下的内容在同一格里分行 —— 横滚条从根上不会出现。 */
#view-table table {
    width: 100%;
    min-width: 0;
    table-layout: auto;
}

#view-table td,
#view-table th {
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* 表头一行到底：「序列号」「最初更新版本」这种四五个字的列名不许折成两行。
   单元格正文照旧可以折（上面那组 overflow-wrap），表头不折才看得出这是表头。
   窄屏例外：<640 时表头不折会把整张表撑得比容器还宽 —— 横向滚动比折行严重得多。 */
#view-table thead th {
    white-space: nowrap;
}
@media (max-width: 639px) {
    #view-table thead th { white-space: normal; }
}

#view-table .editable-cell[data-col] {
    display: block;
    /* 空单元格也要能点进去：0 宽会让「空 id 格子」变成点不到的一条线 */
    min-width: 1.6em;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* id 被回收后留在单元格底部的提示：低对比、只读，点它不会进编辑态 */
#view-table .id-recall {
    display: block;
    margin-top: 2px;
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--text-muted);
    opacity: 0.72;
    white-space: nowrap;
}

#view-table .search-hit {
    background-color: rgba(var(--accent-gold-rgb), 0.4);
    color: var(--btn-on-gold);
    border-radius: 2px;
    padding: 0 2px;
}

#view-table thead tr {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* ============================================================
   3. table.js 生成、但原 <style> 未定义的自定义类（按令牌补齐最小外观）
   ============================================================ */
#view-table .tags-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#view-table .tag-primary {
    display: block;
    line-height: 1.5;
}

#view-table .music-name {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

#view-table .music-name-cn {
    color: var(--text-primary);
}

#view-table .music-name-en {
    color: var(--text-muted);
    font-size: var(--fs-sm);
}

#view-table .region-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--r-sm);
    background: rgba(var(--accent-blue-rgb), 0.13);
    color: var(--accent-blue);
    border: 1px solid rgba(var(--accent-blue-rgb), 0.28);
    font-size: var(--fs-xs);
    white-space: nowrap;
}

#view-table .version-cell {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

#view-table .music-info {
    color: var(--text-muted);
    font-size: var(--fs-sm);
}

#view-table .row-error-icon {
    color: var(--accent-rose);
}

#view-table .override-flag {
    color: var(--accent-gold);
    font-size: var(--fs-xs);
    margin-left: var(--sp-1);
}

#view-table input[type="checkbox"] {
    accent-color: var(--action);
}

/* 自检表里由 JS 拼出的组操作控件 */
#view-table .group-record-field { display: block; }

#view-table .group-standard-input {
    height: 28px;
    padding: 0 6px;
    font-size: var(--fs-xs);
}

#view-table .group-apply-btn,
#view-table .group-reset-btn,
#view-table .group-use-standard {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface-soft);
    color: var(--text-muted);
    font-family: inherit;
    font-size: var(--fs-xs);
    cursor: pointer;
    transition: color 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}

#view-table .group-apply-btn:hover,
#view-table .group-reset-btn:hover,
#view-table .group-use-standard:hover {
    border-color: var(--action-alt);
    color: var(--action-alt);
    background: var(--action-alt-soft);
}

/* ============================================================
   4. Tailwind 工具类垫层
   ------------------------------------------------------------
   只为「原骨架 + table.js」里真实出现过的 token 写规则（见交付说明），
   值对齐 Tailwind 默认尺度，颜色取自 theme 令牌。全部限定在 #view-table 内。
   ============================================================ */

/* ---------- 显示 / 定位 ---------- */
#view-table .block { display: block; }
#view-table .hidden { display: none !important; }
#view-table .flex { display: flex; }
#view-table .flex-col { flex-direction: column; }
#view-table .flex-wrap { flex-wrap: wrap; }
#view-table .flex-grow { flex-grow: 1; }
#view-table .flex-shrink-0 { flex-shrink: 0; }
#view-table .items-center { align-items: center; }
#view-table .items-start { align-items: flex-start; }
#view-table .items-end { align-items: flex-end; }
#view-table .justify-between { justify-content: space-between; }
#view-table .justify-center { justify-content: center; }

#view-table .relative { position: relative; }
#view-table .absolute { position: absolute; }
#view-table .inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
#view-table .top-1\/2 { top: 50%; }
#view-table .bottom-3 { bottom: 0.75rem; }
#view-table .left-4 { left: 1rem; }
#view-table .right-3 { right: 0.75rem; }
#view-table .overflow-hidden { overflow: hidden; }
/* 音乐表任何场景都不允许出现横向滚动条：横向裁切兜底（overflow-x: clip 不产生
   滚动容器，纵向的吸顶表头不受影响），真正的「放不下」由下面单元格内换行消化。 */
#view-table .overflow-x-auto { overflow-x: clip; overflow-y: visible; -webkit-overflow-scrolling: auto; }
#view-table .cursor-pointer { cursor: pointer; }
#view-table .container { width: 100%; max-width: var(--shell-max); margin-left: auto; margin-right: auto; }

/* ---------- 尺寸 ---------- */
#view-table .w-12 { width: 3rem; }
#view-table .w-16 { width: 4rem; }
#view-table .w-24 { width: 6rem; }
#view-table .w-32 { width: 8rem; }
#view-table .w-40 { width: 10rem; }
#view-table .w-56 { width: 14rem; }
#view-table .w-full { width: 100%; }
#view-table .h-3 { height: 0.75rem; }
#view-table .h-16 { height: 4rem; }
#view-table .h-full { height: 100%; }
#view-table .min-w-full { min-width: 100%; }
#view-table .min-h-screen { min-height: 100vh; }
#view-table .max-w-sm { max-width: 24rem; }
#view-table .max-w-md { max-width: 28rem; }

/* ---------- 间距 ---------- */
#view-table .p-0\.5 { padding: 0.125rem; }
#view-table .p-3 { padding: 0.75rem; }
#view-table .p-4 { padding: 1rem; }
#view-table .p-6 { padding: 1.5rem; }
#view-table .px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
#view-table .px-2\.5 { padding-left: 0.625rem; padding-right: 0.625rem; }
#view-table .px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
#view-table .px-4 { padding-left: 1rem; padding-right: 1rem; }
#view-table .py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
#view-table .py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
#view-table .py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
#view-table .py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
#view-table .py-4 { padding-top: 1rem; padding-bottom: 1rem; }
#view-table .py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
#view-table .py-12 { padding-top: 3rem; padding-bottom: 3rem; }
#view-table .pb-1 { padding-bottom: 0.25rem; }
#view-table .pl-11 { padding-left: 2.75rem; }
#view-table .pr-10 { padding-right: 2.5rem; }

#view-table .m-0 { margin: 0; }
#view-table .mx-auto { margin-left: auto; margin-right: auto; }
#view-table .mb-2 { margin-bottom: 0.5rem; }
#view-table .mb-3 { margin-bottom: 0.75rem; }
#view-table .mb-4 { margin-bottom: 1rem; }
#view-table .mb-6 { margin-bottom: 1.5rem; }
#view-table .mt-1 { margin-top: 0.25rem; }
#view-table .mt-2 { margin-top: 0.5rem; }
#view-table .mt-3 { margin-top: 0.75rem; }
#view-table .mt-8 { margin-top: 2rem; }
#view-table .ml-1 { margin-left: 0.25rem; }
#view-table .ml-2 { margin-left: 0.5rem; }
#view-table .ml-auto { margin-left: auto; }
#view-table .mr-1 { margin-right: 0.25rem; }
#view-table .mr-2 { margin-right: 0.5rem; }
#view-table .mr-3 { margin-right: 0.75rem; }

#view-table .gap-0\.5 { gap: 0.125rem; }
#view-table .gap-1 { gap: 0.25rem; }
#view-table .gap-2 { gap: 0.5rem; }
#view-table .gap-3 { gap: 0.75rem; }
#view-table .gap-4 { gap: 1rem; }
#view-table .space-x-1 > * + * { margin-left: 0.25rem; }
#view-table .space-x-2 > * + * { margin-left: 0.5rem; }
#view-table .space-x-3 > * + * { margin-left: 0.75rem; }

/* ---------- 排版 ---------- */
#view-table .text-left { text-align: left; }
#view-table .text-center { text-align: center; }
#view-table .text-xs { font-size: 0.75rem; line-height: 1rem; }
#view-table .text-sm { font-size: 0.875rem; line-height: 1.25rem; }
#view-table .text-lg { font-size: 1.125rem; line-height: 1.75rem; }
#view-table .text-xl { font-size: 1.25rem; line-height: 1.75rem; }
#view-table .text-2xl { font-size: 1.5rem; line-height: 2rem; }
#view-table .text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
#view-table .font-medium { font-weight: 500; }
#view-table .font-semibold { font-weight: 600; }
#view-table .font-bold { font-weight: 700; }
#view-table .font-mono { font-family: var(--font-mono); }
#view-table .uppercase { text-transform: uppercase; }
#view-table .tracking-wider { letter-spacing: 0.05em; }
#view-table .whitespace-nowrap { white-space: nowrap; }
#view-table .resize-none { resize: none; }

/* ---------- 前景色 ---------- */
#view-table .text-white { color: var(--btn-on-accent); }
#view-table .text-gray-100 { color: var(--text-primary); }
#view-table .text-gray-200 { color: var(--text-primary); }
#view-table .text-gray-300 { color: var(--text-primary); }
#view-table .text-gray-400 { color: var(--text-muted); }
#view-table .text-gray-500 { color: var(--text-muted); opacity: 0.85; }
#view-table .text-primary { color: var(--action); }
#view-table .text-success { color: var(--action-alt); }
#view-table .text-info { color: var(--accent-blue); }
#view-table .text-purple { color: var(--accent-violet); }
#view-table .text-warning { color: var(--accent-gold); }
#view-table .text-danger { color: var(--accent-rose); }
#view-table .placeholder-gray-500::placeholder { color: var(--text-muted); opacity: 0.7; }

/* ---------- 背景色 ---------- */
#view-table .bg-dark { background-color: var(--bg-deep); }
#view-table .bg-black\/50 { background-color: var(--overlay); }
#view-table .bg-gray-900 { background-color: var(--bg-deep); }
#view-table .bg-gray-900\/50 { background-color: var(--surface-soft); }
#view-table .bg-gray-900\/60 { background-color: var(--surface-soft); }
#view-table .bg-gray-800 { background-color: var(--surface-soft); }
#view-table .bg-gray-800\/60 { background-color: var(--surface-soft); }
#view-table .bg-gray-800\/90 { background-color: var(--card-bg); }
#view-table .bg-gray-800\/95 { background-color: var(--bg-mid); }
#view-table .bg-gray-700 { background-color: var(--surface-inset); }
#view-table .bg-gray-700\/50 { background-color: var(--surface-inset); }
#view-table .bg-gray-700\/60 { background-color: var(--surface-inset); }
#view-table .bg-gray-600 { background-color: var(--surface-hover); }
#view-table .bg-primary { background-color: var(--action); }
#view-table .bg-primary\/20 { background-color: rgba(var(--action-rgb), 0.2); }
#view-table .bg-success { background-color: var(--action-alt); }
#view-table .bg-info { background-color: var(--accent-blue); }
#view-table .bg-info\/20 { background-color: rgba(var(--accent-blue-rgb), 0.2); }
#view-table .bg-purple { background-color: var(--accent-violet); }
#view-table .bg-warning { background-color: var(--accent-gold); }
#view-table .bg-warning\/20 { background-color: rgba(var(--accent-gold-rgb), 0.2); }
#view-table .bg-danger { background-color: var(--accent-rose); }
#view-table .bg-danger\/20 { background-color: rgba(var(--accent-rose-rgb), 0.2); }

/* ---------- 边框 ---------- */
#view-table .border { border-width: 1px; border-style: solid; border-color: var(--border); }
#view-table .border-gray-600 { border-color: var(--border-strong); }
#view-table .border-gray-600\/60 { border-color: var(--border-strong); }
#view-table .border-gray-700 { border-color: var(--border); }
#view-table .border-gray-700\/50 { border-color: var(--border); }
#view-table .border-primary { border-color: var(--action); }
#view-table .border-warning { border-color: var(--accent-gold); }
#view-table .border-warning\/40 { border-color: rgba(var(--accent-gold-rgb), 0.4); }
#view-table .border-b { border-bottom-width: 1px; border-bottom-style: solid; }

#view-table .divide-y > * + * { border-top-width: 1px; border-top-style: solid; border-color: var(--border); }
#view-table .divide-gray-700 > * + * { border-color: var(--border); }

/* ---------- 圆角 / 阴影 ---------- */
#view-table .rounded { border-radius: 0.25rem; }
#view-table .rounded-md { border-radius: 0.375rem; }
#view-table .rounded-lg { border-radius: 0.5rem; }
#view-table .rounded-xl { border-radius: 0.75rem; }
#view-table .shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
#view-table .shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1); }
#view-table .shadow-2xl { box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); }

/* ---------- 状态 / 变换 / 过渡 ---------- */
#view-table .opacity-50 { opacity: 0.5; }
#view-table .-translate-y-1\/2 { transform: translateY(-50%); }
#view-table .translate-y-full { transform: translateY(100%); }

#view-table .transition-colors { transition-property: color, background-color, border-color, fill, stroke, opacity, box-shadow; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 0.15s; }
#view-table .duration-200 { transition-duration: 0.2s; }

/* ---------- hover / focus ---------- */
#view-table .hover\:bg-gray-600:hover { background-color: var(--surface-hover); }
#view-table .hover\:bg-gray-700\/30:hover { background-color: var(--surface-hover); }
#view-table .hover\:bg-primary\/30:hover { background-color: rgba(var(--action-rgb), 0.3); }
#view-table .hover\:bg-primary\/90:hover { background-color: rgba(var(--action-rgb), 0.9); }
#view-table .hover\:bg-success\/90:hover { background-color: rgba(var(--action-alt-rgb), 0.9); }
#view-table .hover\:bg-info\/30:hover { background-color: rgba(var(--accent-blue-rgb), 0.3); }
#view-table .hover\:bg-info\/90:hover { background-color: rgba(var(--accent-blue-rgb), 0.9); }
#view-table .hover\:bg-purple\/90:hover { background-color: rgba(var(--accent-violet-rgb), 0.9); }
#view-table .hover\:bg-warning\/30:hover { background-color: rgba(var(--accent-gold-rgb), 0.3); }
#view-table .hover\:bg-warning\/90:hover { background-color: rgba(var(--accent-gold-rgb), 0.9); }
#view-table .hover\:bg-danger\/30:hover { background-color: rgba(var(--accent-rose-rgb), 0.3); }
#view-table .hover\:bg-danger\/90:hover { background-color: rgba(var(--accent-rose-rgb), 0.9); }

#view-table .hover\:text-white:hover { color: var(--text-primary); }
#view-table .hover\:text-gray-200:hover { color: var(--text-primary); }
#view-table .hover\:text-gray-300:hover { color: var(--text-primary); }
#view-table .hover\:text-primary:hover { color: var(--action); }
#view-table .hover\:border-gray-500:hover { border-color: var(--border-strong); }

#view-table .focus\:outline-none:focus { outline: 2px solid transparent; outline-offset: 2px; }
#view-table .focus\:border-primary:focus { border-color: var(--action); }
#view-table .focus\:ring-1:focus { box-shadow: 0 0 0 3px var(--glow-action); }
#view-table .focus\:ring-primary:focus { --tw-ring-color: var(--action); }

/* 表格单元格的 padding / 字号一律交给 theme.css 的 th、td 默认值，
   与原「更新分析」页的分析结果表完全一致 ⇒ 这里不再覆盖。 */

/* 搜索框样式已随入口迁到页头（见 page.css 的 .pagehead-search）：
   这里不再为 #search-input 写 padding —— 它已经不在表格视图里了。 */

/* ---------- 版本筛选与版本变更视图 ---------- */
/* 「全部版本」不再是原生 select，而是与表格切换同一套悬停面板：
   一颗胶囊 + 悬停展开的版本列表（样式见下方 .table-switch 一组）。 */
#view-table .version-picker .table-switch-btn {
    padding-right: 12px;
}
#view-table .version-picker.is-filtered .table-switch-btn {
    border-color: rgba(var(--accent-gold-rgb), 0.55);
    color: var(--accent-gold);
}

/* 「新增数」本身就是一个开关按钮（原来里面还挂着一颗眼睛，两个可点区域容易看错）。
   尺寸与右下角悬浮条上的「删除 / 互换 / 取消」完全对齐：同高、同内边距、同圆角、同字号。
   边框常驻（关态是透明的）⇒ 点开时只换颜色，不会因为多出 1px 边框而抖动位移。 */
#view-table .stat-new {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: var(--chip-h);
    min-height: var(--chip-h);
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: var(--r-pill);
    background: transparent;
    color: var(--accent-green);
    font-family: inherit;
    font-size: var(--fs-sm);
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    flex: 0 0 auto;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}
#view-table .stat-new:hover {
    background: rgba(var(--accent-green-rgb), 0.12);
}
#view-table .stat-new:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--glow-action);
}
#view-table .stat-new.is-on {
    border-color: rgba(var(--accent-green-rgb), 0.55);
    background: rgba(var(--accent-green-rgb), 0.16);
}
/* 两种文案叠在同一格里，只显示当前那一条：
   格子宽度 = 较宽的那条（「仅 x.y 新增」）⇒ 开关前后宽度恒定、零位移。 */
#view-table .stat-new-label { display: inline-grid; }
#view-table .stat-new-lbl { grid-area: 1 / 1; visibility: hidden; }
#view-table .stat-new.is-on .stat-new-lbl.is-on,
#view-table .stat-new:not(.is-on) .stat-new-lbl.is-off { visibility: visible; }
#view-table .stat-new-count { font-variant-numeric: tabular-nums; }

/* 「新增」开关右边的「删除 / 互换 / 重复组」等统计，用同一套 chip 盒子。
   以前它们是裸 inline span：高度跟着行高走（≈19px）、和 30px 的开关不在同一条基线上，
   于是「没开仅新增」时看着像两种风格混排。现在同高、同内边距、同圆角、同字号，
   颜色仍由 text-danger / text-warning 负责（只统一盒子，不统一语义色）。 */
#view-table .stat-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: var(--chip-h);
    min-height: var(--chip-h);
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: var(--r-pill);
    /* 与「新增」开关同一个浅底：只统一高度不统一底色，看起来仍是「一段文字」 */
    background: var(--surface-soft);
    font-size: var(--fs-sm);
    line-height: 1;
    white-space: nowrap;
    flex: 0 0 auto;
}
/* chip 内图标用 gap 控制间距，旧模板里的 mr-1 不再额外加 4px */
#view-table .stat-chip .mr-1 { margin-right: 0; }

/* 行数徽标只给一个很窄的最小宽度（第 30 轮收窄）：
   「6 行」够放即可；内容变长时徽标自己撑开，不再为极端情况常驻 4 个字的位置。 */
#view-table #row-count {
    min-width: 2.6rem;
    padding: 1px 6px;
    text-align: center;
}

/* 本版本新增的行：淡绿底 + 左侧竖描边，和「选中行」「错误行」都能区分开 */
#view-table tr.new-row {
    background-color: rgba(var(--accent-green-rgb), 0.13);
}
#view-table tr.new-row td:first-child {
    box-shadow: inset 3px 0 0 rgba(var(--accent-green-rgb), 0.7);
}
#view-table tr.new-row:hover {
    background-color: rgba(var(--accent-green-rgb), 0.19);
}
/* 选中优先于新增高亮（两者叠在一起时以勾选为准） */
#view-table tr.new-row.selected-row {
    background-color: rgba(var(--action-rgb), 0.20);
    box-shadow: inset 3px 0 0 var(--action);
}

/* 归档行：该版本已删除的曲目，只读、加删除线压暗 */
#view-table tr.is-archived td {
    opacity: 0.62;
    color: var(--text-muted);
    text-decoration: line-through;
    text-decoration-thickness: 1px;
    background: var(--surface-soft);
}
#view-table tr.is-archived td .row-version { text-decoration: none; }

/* 版本视图最后一列：加入版本 · 序号变化 */
#view-table .row-version {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    white-space: nowrap;
}
#view-table .row-version .delta { color: var(--accent-gold); }

/* 与表格页同一套标签行的「版本映射」表：弹窗内不需要额外间距 */
#version-map-body table { min-width: 100%; }
#version-map-body .row-version .delta { color: var(--accent-gold); }

/* ============================================================
   5. Font Awesome 图标复刻（mask-image + 内联 data-URI SVG）
   ------------------------------------------------------------
   不再加载 font-awesome CSS。.fa 基类用 currentColor 作为底色，
   具体图标只负责给 --fa-ico 一个 SVG 蒙版。仅覆盖实际用到的图标。
   ============================================================ */
#view-table .fa {
    display: inline-block;
    width: 1em;
    height: 1em;
    line-height: 1;
    vertical-align: -0.125em;
    background-color: currentColor;
    -webkit-mask-image: var(--fa-ico);
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
    mask-image: var(--fa-ico);
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
}

#view-table .fa.block { display: block; margin-left: auto; margin-right: auto; }

#view-table .fa-spin { animation: table-fa-spin 1s linear infinite; }
@keyframes table-fa-spin { to { transform: rotate(360deg); } }

#view-table .fa-arrow-up { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20V5M12 5l-6 6M12 5l6 6'/%3E%3C/svg%3E"); }

/* 表底部三个快捷跳转用到的图标。没有 --fa-ico 的 .fa 会退化成一个实心方块
   （基类是 background-color: currentColor + mask-image），所以每加一个图标都必须补这里。 */
#view-table .fa-chevron-left { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 5l-7 7 7 7'/%3E%3C/svg%3E"); }
#view-table .fa-chevron-right { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 5l7 7-7 7'/%3E%3C/svg%3E"); }
/* 分页「加载更多」（§C4） */
#view-table .fa-chevron-down { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 9l7 7 7-7'/%3E%3C/svg%3E"); }
#view-table .fa-bolt { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M13 2.5 4.5 13.5H11l-1 8 8.5-11H12l1-8z'/%3E%3C/svg%3E"); }
/* 序号列开关：原来没有映射，一直显示成一个实心方块 */
#view-table .fa-list-ol { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M5 6h2M10 6h9M5 12h2M10 12h9M5 18h2M10 18h9'/%3E%3C/svg%3E"); }
/* 更新日志（第 93 轮）：文档图标、箭头。没有映射的 .fa 会画成实心方块。 */
#view-table .fa-file-text-o { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 3v5h5M8.5 13h7M8.5 17h5'/%3E%3C/svg%3E"); }
#view-table .fa-long-arrow-right { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12h15M15 7l5 5-5 5'/%3E%3C/svg%3E"); }
#view-table .fa-bullseye { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Ccircle cx='12' cy='12' r='5'/%3E%3Ccircle cx='12' cy='12' r='1.5'/%3E%3C/svg%3E"); }
#view-table .fa-check { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 13l4 4L19 7'/%3E%3C/svg%3E"); }
#view-table .fa-check-circle { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M8.5 12.5l2.5 2.5 4.5-5.5'/%3E%3C/svg%3E"); }
#view-table .fa-check-square-o { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='16' height='16' rx='2.5'/%3E%3Cpath d='M8.5 12.5l2.5 2.5 4.5-5.5'/%3E%3C/svg%3E"); }
#view-table .fa-cloud-download { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7.6 18.5h8.9a3.6 3.6 0 0 0 .4-7.2 5.6 5.6 0 0 0-10.7-1.2 3.9 3.9 0 0 0 1.4 8.4z'/%3E%3Cpath d='M12 11v5M12 16l-2.2-2.2M12 16l2.2-2.2'/%3E%3C/svg%3E"); }
#view-table .fa-code { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 7l-5 5 5 5M15 7l5 5-5 5'/%3E%3C/svg%3E"); }
#view-table .fa-copy { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='11' height='11' rx='2.5'/%3E%3Cpath d='M5.5 15.5V6.5a2 2 0 0 1 2-2h9'/%3E%3C/svg%3E"); }
#view-table .fa-database { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cellipse cx='12' cy='6' rx='7' ry='3'/%3E%3Cpath d='M5 6v6c0 1.7 3.1 3 7 3s7-1.3 7-3V6'/%3E%3Cpath d='M5 12v6c0 1.7 3.1 3 7 3s7-1.3 7-3v-6'/%3E%3C/svg%3E"); }
#view-table .fa-download { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v11M12 15l-4.5-4.5M12 15l4.5-4.5'/%3E%3Cpath d='M5 19.5h14'/%3E%3C/svg%3E"); }
#view-table .fa-eraser { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 20H5l-2-2 9-9 5 5-4 4'/%3E%3Cpath d='M9 20h10'/%3E%3C/svg%3E"); }
#view-table .fa-exchange { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 8h11l-3.5-3.5M17 16H6l3.5 3.5'/%3E%3C/svg%3E"); }
#view-table .fa-exclamation-circle { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7.5v5.5'/%3E%3Cpath d='M12 16.4v.2'/%3E%3C/svg%3E"); }
#view-table .fa-exclamation-triangle { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4l9 16H3z'/%3E%3Cpath d='M12 10v4.5'/%3E%3Cpath d='M12 17.3v.2'/%3E%3C/svg%3E"); }
#view-table .fa-files-o { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='3' width='11' height='14' rx='2'/%3E%3Cpath d='M5 8v9a3 3 0 0 0 3 3h8'/%3E%3C/svg%3E"); }
#view-table .fa-filter { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 5h16l-6 7.2V19l-4 2v-8.8z'/%3E%3C/svg%3E"); }
#view-table .fa-history { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 12a8.5 8.5 0 1 0 2.6-6.1'/%3E%3Cpath d='M3.5 4.5V9H8'/%3E%3Cpath d='M12 7.8V12l3 1.8'/%3E%3C/svg%3E"); }
#view-table .fa-info-circle { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5'/%3E%3Cpath d='M12 7.6v.2'/%3E%3C/svg%3E"); }
#view-table .fa-list { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 6h12M8 12h12M8 18h12'/%3E%3Cpath d='M4 6h.5M4 12h.5M4 18h.5'/%3E%3C/svg%3E"); }
#view-table .fa-minus-circle { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M7.5 12h9'/%3E%3C/svg%3E"); }
#view-table .fa-object-group { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='8' height='8' rx='2'/%3E%3Crect x='13' y='13' width='8' height='8' rx='2'/%3E%3C/svg%3E"); }
#view-table .fa-paste { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 4H7a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-2'/%3E%3Crect x='9' y='2' width='6' height='4' rx='1.5'/%3E%3C/svg%3E"); }
/* 比对自检（第 94 轮）：剪贴板 = 外部比对，链条 = 补写关联 */
#view-table .fa-clipboard { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='4' width='14' height='17' rx='2.2'/%3E%3Crect x='9' y='2.2' width='6' height='4' rx='1.4'/%3E%3Cpath d='M8.6 10.5h6.8M8.6 14.2h6.8M8.6 17.4h4.2'/%3E%3C/svg%3E"); }
#view-table .fa-link { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.5 13.5a3.6 3.6 0 0 0 5.1 0l2.6-2.6a3.6 3.6 0 0 0-5.1-5.1l-1.3 1.3'/%3E%3Cpath d='M13.5 10.5a3.6 3.6 0 0 0-5.1 0l-2.6 2.6a3.6 3.6 0 0 0 5.1 5.1l1.3-1.3'/%3E%3C/svg%3E"); }
#view-table .fa-plus { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E"); }
#view-table .fa-plus-circle { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v8M8 12h8'/%3E%3C/svg%3E"); }
#view-table .fa-refresh { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12a8 8 0 0 1 13.7-5.6L20 8'/%3E%3Cpath d='M20 4v4h-4'/%3E%3Cpath d='M20 12a8 8 0 0 1-13.7 5.6L4 16'/%3E%3Cpath d='M4 20v-4h4'/%3E%3C/svg%3E"); }
/* 资源转换页用到的五颗（第 32 轮）：没有 --fa-ico 的 .fa 会退化成一个实心方块 */
#view-table .fa-film { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='16' rx='2.5'/%3E%3Cpath d='M7 4v16M17 4v16M3 9h4M17 9h4M3 15h4M17 15h4'/%3E%3C/svg%3E"); }
#view-table .fa-play { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M8 5.5l10 6.5-10 6.5z'/%3E%3C/svg%3E"); }
#view-table .fa-stop { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Crect x='6' y='6' width='12' height='12' rx='2'/%3E%3C/svg%3E"); }
#view-table .fa-key { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='8' r='4'/%3E%3Cpath d='M11 11l9 9M17 17l2-2M14 14l2-2'/%3E%3C/svg%3E"); }
#view-table .fa-folder-open { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8a2 2 0 0 1 2-2h4l2 2h6a2 2 0 0 1 2 2v1'/%3E%3Cpath d='M3 9h17.2a1 1 0 0 1 1 1.2l-1.4 7A2 2 0 0 1 17.8 19H4.6A1.6 1.6 0 0 1 3 17.4z'/%3E%3C/svg%3E"); }
#view-table .fa-search { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M20 20l-4.8-4.8'/%3E%3C/svg%3E"); }
#view-table .fa-search-plus { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M20 20l-4.8-4.8M8.5 11h5M11 8.5v5'/%3E%3C/svg%3E"); }
#view-table .fa-spinner { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M12 3a9 9 0 1 0 9 9'/%3E%3C/svg%3E"); }
#view-table .fa-table { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='16' rx='2.5'/%3E%3Cpath d='M3 9.5h18M3 14.5h18M9 4v16M15 4v16'/%3E%3C/svg%3E"); }
#view-table .fa-terminal { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='16' rx='2.5'/%3E%3Cpath d='M7 9.5l3 3-3 3M13 15.5h4'/%3E%3C/svg%3E"); }
#view-table .fa-times { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E"); }
#view-table .fa-times-circle { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M9 9l6 6M15 9l-6 6'/%3E%3C/svg%3E"); }
#view-table .fa-trash { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h16'/%3E%3Cpath d='M9.5 7V5.2A1.2 1.2 0 0 1 10.7 4h2.6a1.2 1.2 0 0 1 1.2 1.2V7'/%3E%3Cpath d='M6.5 7l1 12.2A1.8 1.8 0 0 0 9.3 21h5.4a1.8 1.8 0 0 0 1.8-1.8L17.5 7'/%3E%3C/svg%3E"); }
#view-table .fa-upload { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V5M12 5L7.5 9.5M12 5l4.5 4.5'/%3E%3Cpath d='M5 19.5h14'/%3E%3C/svg%3E"); }
#view-table .fa-wrench { --fa-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z'/%3E%3C/svg%3E"); }

/* ============================================================
   6. 组件（本项目专属，不写进 theme.css）
   ============================================================ */

/* ---------- 6.1 同步状态条 ---------- */
#sync-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 12px;
    border-radius: var(--r-pill);
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--text-muted);
    font-size: var(--fs-xs);
    line-height: 1.5;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

/* 状态点：颜色随状态走，给「可以点一下」一个视觉暗示 */
#sync-status::before {
    content: '';
    width: 6px;
    height: 6px;
    flex: none;
    border-radius: 50%;
    background: currentColor;
}

#sync-status:hover { border-color: var(--border-strong); }

#sync-status[data-state="idle"] {
    color: var(--text-muted);
    border-color: var(--border);
    background: var(--surface-soft);
}

#sync-status[data-state="pending"] {
    color: var(--accent-gold);
    border-color: rgba(var(--accent-gold-rgb), 0.5);
    background: rgba(var(--accent-gold-rgb), 0.12);
}

#sync-status[data-state="saving"] {
    color: var(--text-muted);
    border-color: var(--border-strong);
    background: var(--surface-inset);
}

#sync-status[data-state="error"] {
    color: var(--accent-rose);
    border-color: rgba(var(--accent-rose-rgb), 0.5);
    background: rgba(var(--accent-rose-rgb), 0.12);
}

#sync-status[data-state="locked"] {
    color: var(--accent-gold);
    border-color: rgba(var(--accent-gold-rgb), 0.6);
    background: rgba(var(--accent-gold-rgb), 0.16);
}

#sync-status[data-state="conflict"] {
    color: var(--accent-rose);
    border-color: var(--accent-rose);
    background: rgba(var(--accent-rose-rgb), 0.16);
}

/* ---------- 6.2 导出下拉（与「导入」同款：同按钮、同悬停面板） ---------- */
#export-menu .export-menu-list { min-width: 216px; padding: 6px 4px; }
#export-menu .export-menu-list > button[role="menuitem"] { text-align: left; padding: 7px 10px; }

.export-menu-note {
    margin: 0;
    padding: 4px 10px 6px;
    color: var(--text-muted);
    font-size: var(--fs-xs);
    white-space: nowrap;
}

.export-menu-sep {
    height: 1px;
    margin: 5px 2px;
    background: var(--border);
}

.export-menu-version {
    padding: 2px 10px 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: var(--text-muted);
    font-size: var(--fs-xs);
}

.export-menu-version #export-version-display {
    white-space: nowrap;
    cursor: pointer;
}

.export-menu-version #export-version-display:hover { color: var(--action-alt); }
.export-menu-version #export-version-input { width: 100%; height: 30px; font-size: var(--fs-xs); }

/* ---------- 6.3 表格卡片：放开裁切 ---------- */
/* .card--flush 默认 overflow:hidden，卡片右上角的导出下拉和左上角的表格切换面板
   都会被裁掉。卡片本身不需要裁切（内层 .bar 自己撑高），这里单独放开。 */
#view-table #table-card { overflow: visible; }

/* ---------- 6.3.0 首屏加载态 ---------- */
/* 与「评审与分析」项目同一套做法：不用自转圆环（全项目零 @keyframes），
   只静态画一个「定格进度环」+ 一行文案，数据回来后被整表渲染替换掉。 */
#view-table .table-loading > td {
    padding: 56px var(--sp-4);
    text-align: center;
    color: var(--text-muted);
}

#view-table .loading-block {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--fs-sm);
}

#view-table .loading-block p { margin: 0; }

/* ---------- 6.3.1 表格切换（与「编号与映射」并排，一颗长椭圆） ---------- */
/* 第 31 轮重做：
     ① 左翻 / 表名 / 右翻 共用一个外壳 —— 只有最外层有边框与圆角，内部按钮无框无圆角、
        之间用 1px 内阴影当分隔线，整体是一颗「上下两端水平」的长椭圆；
     ② 位置从整行最右挪到「编号与映射」右侧（它属于表内那组控件，不属于右侧操作区）。 */
#view-table .table-switch {
    position: relative;
    display: inline-flex;
    align-items: stretch;
    height: 28px;
    min-width: 0;
    flex: none;
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    background: var(--surface-soft);
    transition: border-color 0.16s ease;
}
#view-table .table-switch:hover,
#view-table .table-switch.is-open { border-color: var(--action); }

/* 内部的每一段都只是「在这颗胶囊里的一块」：没有自己的边框与圆角 */
#view-table .table-switch-btn,
#view-table .table-switch-step {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: auto;
    padding: 0 10px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--fs-sm);
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.16s ease, color 0.16s ease;
}
#view-table .table-switch-btn { min-width: 0; max-width: 22rem; }
#view-table .table-switch-btn > #current-table-name,
#view-table .table-switch-btn > #album-current-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#view-table .table-switch-step {
    width: 26px;
    padding: 0;
    justify-content: center;
    color: var(--text-secondary);
}
/* 左右箭头是内联 SVG 画出来的（第 32 轮，不再用 ‹ › 字符）：
   字符的字形随字体漂移、基线偏上，14px 时看着比中间文字高半格。
   SVG 用 display:block 去掉行内基线的下沉，flex 的 align-items:center 再把它钉在正中。 */
#view-table .table-switch-ico {
    display: block;
    width: 14px;
    height: 14px;
    flex: none;
}
/* 左右两端各自带上外圈的圆角，中间的按钮保持方角 ⇒ 拼起来仍是一颗胶囊 */
#view-table .table-switch-step:first-child {
    border-radius: var(--r-pill) 0 0 var(--r-pill);
    box-shadow: inset -1px 0 0 var(--border);
}
#view-table .table-switch-btn + .table-switch-step {
    border-radius: 0 var(--r-pill) var(--r-pill) 0;
    box-shadow: inset 1px 0 0 var(--border);
}
/* 只有一个按钮的（版本筛选）：它自己就是整颗胶囊 */
#view-table .version-picker .table-switch-btn {
    border-radius: var(--r-pill);
}
#view-table .table-switch-btn:hover,
#view-table .table-switch-step:hover:not(:disabled) {
    background: var(--surface-hover);
}
#view-table .table-switch-step:hover:not(:disabled) { color: var(--action); }
#view-table .table-switch-btn:focus-visible,
#view-table .table-switch-step:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--glow-action);
}
#view-table .table-switch-step:disabled { opacity: 0.4; cursor: default; }

/* 展开的面板：控件在左半边 ⇒ 面板改为左对齐展开（右对齐会往卡片外溢出） */
#view-table .table-switch-panel {
    position: absolute;
    left: 0;
    right: auto;
    top: calc(100% + 6px);
    z-index: 70;
    width: max-content;
    min-width: 12rem;
    max-width: min(560px, calc(100vw - 2 * var(--sp-5)));
    max-height: 320px;
    overflow-y: auto;
    padding: var(--sp-3);
    /* 卡片底是半透明的（--card-bg 带 alpha），弹层叠在表格上会透出后面的行，
       所以这里用不透明的 --bg-mid 当底 */
    background: var(--bg-mid);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

[data-theme="dark"] #view-table .table-switch-panel {
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
}

#view-table .table-switch-panel[hidden] { display: none; }

#view-table .table-switch-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
    margin-bottom: var(--sp-2);
    padding-bottom: var(--sp-2);
    border-bottom: 1px solid var(--border);
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

#view-table .table-switch-esc { opacity: 0.7; }

#view-table .table-switch-panel .tab-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ---------- 6.4 文件选择控件（隐藏原生 input，用标签当按钮） ---------- */
/* 原生 <input type=file> 各浏览器外观不一，且与本页设计系统不符，
   所以把它藏起来，由 .file-pick 复刻一个与 .btn 同气质的触发器。 */
.file-pick-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.file-pick {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    margin-top: var(--sp-2);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.file-pick-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 0 0.9rem;
    flex: none;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    background: var(--surface-soft);
    color: var(--text-primary);
    font-size: var(--fs-sm);
    line-height: 1.2;
    transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.file-pick:hover .file-pick-btn {
    border-color: var(--action-alt);
    background: var(--action-alt-soft);
    color: var(--action-alt);
}

.file-pick-input:focus-visible + .file-pick .file-pick-btn {
    border-color: var(--action);
    box-shadow: 0 0 0 3px var(--glow-action);
}

.file-pick-name {
    min-width: 0;
    color: var(--text-muted);
    font-size: var(--fs-sm);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- 6.5 进度遮罩（数据自检等长任务） ---------- */
.progress-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-4);
    background: var(--overlay);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.progress-box {
    width: 100%;
    max-width: 26rem;
    padding: var(--sp-5);
    text-align: center;
    background: var(--bg-mid);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-lg);
    box-shadow: var(--card-shadow);
}

.progress-ring {
    width: 4rem;
    height: 4rem;
    margin: 0 auto var(--sp-4);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(var(--action-rgb), 0.14);
    color: var(--action);
    /* .fa 基类是 1em×1em，字号决定图标大小 */
    font-size: 1.4rem;
}

.progress-title {
    margin: 0;
    font-size: var(--fs-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.progress-overlay .hint { margin: var(--sp-2) 0 0; }

.progress-meter { margin-top: var(--sp-4); }

.progress-meter-head {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--sp-2);
    color: var(--text-muted);
    font-size: var(--fs-sm);
}

.progress-track {
    width: 100%;
    height: 0.75rem;
    overflow: hidden;
    background: var(--surface-inset);
    border-radius: var(--r-pill);
}

/* 进度条填充沿用 theme.css 的 .progress-fill（渐变与圆角都是设计令牌） */

/* ---------- 6.6 已记录的版本总览（导入历史版本弹窗） ---------- */
/* 统一的历史版本查看入口：把「数据库里已有的版本」做成可点的小卡片，
   点一下即切到该版本的变更视图，省去先去表格页翻下拉。 */
.ver-overview-block {
    padding: var(--sp-3);
    margin-bottom: var(--sp-3);
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
}

.ver-overview-head {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    margin-bottom: var(--sp-2);
}

.ver-overview-title {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--accent-brand);
}

.ver-overview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: var(--sp-2);
    max-height: 176px;
    overflow-y: auto;
}

.ver-chip-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 6px 10px;
    text-align: left;
    font-family: inherit;
    font-size: var(--fs-sm);
    color: var(--text-primary);
    background: var(--surface-inset);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.ver-chip-item:hover {
    border-color: var(--action-alt);
    background: var(--action-alt-soft);
    color: var(--action-alt);
}

.ver-chip-item .v { font-weight: 600; }
.ver-chip-item .d { font-size: var(--fs-xs); color: var(--text-muted); }
.ver-chip-item:hover .d { color: inherit; opacity: 0.85; }

/* 导入结果里的「查看版本 xxx」快捷入口 */
.res-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
    margin-top: var(--sp-2);
}

/* ============================================================
   7. 映射表单（区域默认映射 / 各版本关键词）
   ------------------------------------------------------------
   表单本体在第 24 轮搬进「编号与映射」的版本映射页签，只剩控件样式；
   原来那个挂在页头的浮层壳（.map-menu / .map-panel）已随入口一起删掉。
   ============================================================ */
.map-group-head { display: flex; align-items: center; gap: var(--sp-2); }

.map-group-head h4 {
    flex: 1 1 auto; margin: 0;
    font-size: var(--fs-xs); font-weight: 600;
    color: var(--text-primary); letter-spacing: 0.02em;
}

.map-group .hint {
    margin: 4px 0 var(--sp-2);
    font-size: var(--fs-xs); color: var(--text-muted); line-height: 1.6;
}

.map-rows { display: flex; flex-direction: column; gap: 6px; }
.map-row { display: flex; align-items: center; gap: 6px; }
.map-arrow { flex: 0 0 auto; color: var(--text-muted); font-size: var(--fs-xs); }

.map-in {
    min-width: 0; padding: 5px 8px;
    font-family: inherit; font-size: var(--fs-xs);
    color: var(--text-primary); background: var(--surface-inset);
    border: 1px solid var(--border); border-radius: var(--r-sm);
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.map-in:focus {
    outline: none;
    border-color: var(--action);
    box-shadow: 0 0 0 3px var(--glow-action);
}

.map-in-key { flex: 0 0 108px; }
.map-in-val { flex: 0 0 88px; }
.map-in-kw { flex: 1 1 auto; }

.map-del {
    flex: 0 0 auto; width: 22px; height: 22px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-family: inherit; font-size: 15px; line-height: 1;
    color: var(--text-muted); background: none;
    border: 1px solid transparent; border-radius: var(--r-sm);
    cursor: pointer; -webkit-tap-highlight-color: transparent;
    transition: color 0.16s ease, background-color 0.16s ease;
}

.map-del:hover {
    color: var(--accent-rose);
    background: rgba(var(--accent-rose-rgb), 0.12);
}

/* 「映射版本」列：推导出来的结果，只读，做成小胶囊和可编辑列区分开。
   两种来源用不同色系区分：
     · 关键词映射（精确命中）→ 主绿 --accent-green
     · 区域默认映射（兜底）  → 淡粉 --map-region */
#view-table {
    --map-region: #bd5b83;
    --map-region-rgb: 189, 91, 131;
}

[data-theme="dark"] #view-table {
    --map-region: #f2b3c9;
    --map-region-rgb: 242, 179, 201;
}

#view-table .mapped-version {
    display: inline-block; min-width: 34px; padding: 1px 7px;
    font-size: var(--fs-xs); font-weight: 600; text-align: center;
    border: 1px solid transparent;
    border-radius: var(--r-pill);
}

#view-table .mapped-version.is-keyword {
    color: var(--accent-green); background: rgba(var(--accent-green-rgb), 0.16);
    border-color: rgba(var(--accent-green-rgb), 0.38);
}

#view-table .mapped-version.is-region {
    color: var(--map-region); background: rgba(var(--map-region-rgb), 0.12);
    border-color: rgba(var(--map-region-rgb), 0.30);
}

#view-table .mapped-version.is-unknown {
    color: var(--text-muted); background: none;
    border-color: var(--border); font-weight: 500;
}

/* ============================================================
   7.5 表底部快捷跳转（上一张 / 下一张 / 下一个更新表）
   ============================================================ */
#view-table .table-foot-nav {
    display: flex;
    align-items: center;
    /* 第 14 轮：整组居中。原先靠 .spacer 把「下一个更新表」顶到右侧，
       结果三个按钮一左一右；居中后阅读视线不用来回跳。 */
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--sp-2);
    padding: 0 var(--sp-5) var(--sp-4);
}

/* .hint 全局带 max-width: var(--read-width)，留在这里会把「6.4 · 3 张」挤成竖排 */
#view-table .table-foot-nav .hint {
    max-width: none;
    margin: 0;
    white-space: nowrap;
}

#view-table .table-foot-nav .btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

/* 表底开关（原「下一个更新表」按钮）：轨道 + 圆点的纯 CSS 开关。
   开启后「上一个 / 下一个」只在被本版本自动更新过的表之间循环。 */
#view-table .nav-switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    min-height: 32px;
    padding: 0 10px 0 7px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    font-size: var(--fs-xs);
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}
#view-table .nav-switch:hover:not(:disabled) { color: var(--text-primary); border-color: var(--border-strong); }
#view-table .nav-switch.is-on {
    color: var(--accent-gold);
    border-color: rgba(var(--accent-gold-rgb), 0.55);
    background: rgba(var(--accent-gold-rgb), 0.14);
}
#view-table .nav-switch:disabled { opacity: 0.42; cursor: not-allowed; }
#view-table .nav-switch-track {
    position: relative;
    display: inline-block;
    width: 26px;
    height: 14px;
    border-radius: 999px;
    background: var(--border);
    transition: background 0.16s ease;
}
#view-table .nav-switch-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: transform 0.16s ease, background 0.16s ease;
}
#view-table .nav-switch.is-on .nav-switch-track { background: rgba(var(--accent-gold-rgb), 0.55); }
#view-table .nav-switch.is-on .nav-switch-knob { transform: translateX(12px); background: var(--accent-gold); }

/* ---------- 原音名称：快捷输入推荐 ----------
   挂在 body 上（position: fixed），因为表格有自己的滚动容器，
   放进单元格里会被 overflow 裁掉。 */
.name-suggest {
    position: fixed;
    z-index: 80;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 220px;
    max-width: 320px;
    max-height: 280px;
    overflow-y: auto;
    padding: 4px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    background: var(--bg-mid);
    box-shadow: var(--card-shadow);
}
.name-suggest[hidden] { display: none; }
.name-suggest-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 8px;
    border: 0;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--fs-sm);
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.name-suggest-item.is-active { background: rgba(var(--action-rgb), 0.18); }
.name-suggest-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.name-suggest-hint {
    flex: 0 0 auto;
    max-width: 55%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-muted);
    font-size: var(--fs-xs);
}

/* ============================================================
   8. 响应式
   ============================================================ */
@media (max-width: 768px) {
    .btn-menu-list { min-width: 210px; }
    #sync-status { padding: 4px 12px; }

    /* 窄屏：映射面板铺满，映射行竖向堆叠，免得输入框被压成一条 */
    .map-row { flex-wrap: wrap; }
    .map-in-key { flex: 1 1 40%; }
    .map-in-val { flex: 1 1 30%; }
    .map-in-kw { flex: 1 1 100%; }

    /* 窄屏：单元格内边距收一档，把宽度留给文字（配合「格内换行」做到零横滚） */
    #view-table td,
    #view-table th { padding: 8px 6px; }

    /* 窄屏：表格切换面板铺满一屏宽，标签按钮可换行 */
    #view-table .table-switch-panel {
        width: calc(100vw - 2 * var(--sp-4));
        max-width: calc(100vw - 2 * var(--sp-4));
        max-height: 60vh;
    }
    #view-table .table-switch-btn { font-size: var(--fs-md); }
}
/* ---------- 完整性自检（第 92 轮） ----------
   与「数据自检」的自检表并排出现，视觉上要能一眼分开：
   这里是一个只读报告（三段列表），不自带表格、不进入表格页签。 */
.integrity-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 14px;
}

.integrity-chip {
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    color: var(--text-muted);
    font-size: var(--fs-sm);
}

.integrity-chip.warn {
    border-color: rgba(var(--accent-gold-rgb), 0.45);
    color: var(--accent-gold);
}

.integrity-chip.info {
    border-color: rgba(var(--accent-brand-rgb), 0.35);
    color: var(--accent-brand);
}

.integrity-chip.muted { opacity: 0.75; }

.integrity-sec { margin-bottom: 16px; }

.integrity-sec-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.integrity-sec-head b {
    font-size: var(--fs-md);
    color: var(--text-primary);
}

.integrity-sec-head span {
    font-size: var(--fs-sm);
    color: var(--text-muted);
}

.integrity-item {
    padding: 7px 0;
    border-bottom: 1px dashed var(--border);
    font-size: var(--fs-sm);
    color: var(--text-primary);
}

.integrity-item:last-child { border-bottom: none; }
.integrity-item.muted { color: var(--text-muted); }

.integrity-line {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.integrity-line span {
    flex: 1 1 240px;
    min-width: 0;
    color: var(--text-muted);
    overflow-wrap: anywhere;
}

.integrity-item.is-ignored { opacity: 0.7; }
