/* SuperTable 样式 */
:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #6b7785;
  --line: #e3e8ee;
  --line-strong: #cfd8e3;
  --accent: #1d5fd0;
  --accent-weak: #eaf1fd;
  --danger: #c0392b;
  --ok: #16794c;
  --shadow: 0 6px 24px rgba(20, 40, 80, .12);
  --radius: 8px;
  --letters-h: 26px;
  --rownum-w: 70px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
}

body { display: flex; flex-direction: column; }

/* 顶栏 */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 190px; flex: 0 0 auto; }
.logo {
  height: 34px; width: auto; max-width: 170px;
  object-fit: contain; display: block; flex: 0 0 auto;
}
.brand h1 { margin: 0; font-size: 16px; font-weight: 600; white-space: nowrap; }
.brand p { margin: 1px 0 0; font-size: 11px; color: var(--muted); white-space: nowrap; }

.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 0; background: transparent; color: var(--muted);
  padding: 8px 14px; border-radius: 999px; cursor: pointer;
  font-size: 13.5px; white-space: nowrap;
}
.tab:hover { background: #f0f3f7; color: var(--ink); }
.tab.active { background: var(--accent-weak); color: var(--accent); font-weight: 600; }
.tab .badge {
  display: inline-block; margin-left: 6px; padding: 0 6px;
  border-radius: 9px; background: #eef1f5; color: var(--muted);
  font-size: 11px; line-height: 17px;
}
.tab.active .badge { background: #d7e5fb; color: var(--accent); }

.top-actions { display: flex; align-items: center; gap: 10px; }
.search input {
  width: 300px; max-width: 34vw; height: 32px;
  padding: 0 12px; border: 1px solid var(--line-strong);
  border-radius: var(--radius); font-size: 13px; outline: none; background: #fbfcfd;
}
/* 导出按钮与搜索框同高 */
#btn-export { height: 32px; padding: 0 12px; }
.search input:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px var(--accent-weak); }

/* 按钮 */
.btn {
  border: 1px solid var(--line-strong); background: var(--panel);
  color: var(--ink); padding: 7px 12px; border-radius: var(--radius);
  font-size: 13px; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #b9c5d4; background: #f8fafc; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #1750b3; }
.btn.ghost { background: transparent; }
.btn.danger-ghost { color: var(--danger); border-color: #e7c3bf; background: #fff; }
.btn.danger-ghost:hover { background: #fdf1ef; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* 工具条 */
.toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 18px; background: var(--panel);
  border-bottom: 1px solid var(--line); flex: 0 0 auto;
  min-height: 48px;
}
.spacer { flex: 1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-weak); color: var(--accent);
  border: 1px solid #cddff9; border-radius: 999px;
  padding: 2px 4px 2px 10px; font-size: 12px;
}
.chip button {
  border: 0; background: transparent; color: inherit; cursor: pointer;
  width: 18px; height: 18px; border-radius: 50%; line-height: 1; font-size: 13px;
}
.chip button:hover { background: #d3e3fb; }
.chip.clear { background: #f3f4f6; color: var(--muted); border-color: var(--line); padding: 2px 10px; cursor: pointer; }

/* 表格 */
.main { flex: 1 1 auto; min-height: 0; padding: 14px 18px; }
.table-wrap {
  height: 100%; overflow: auto; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 2px 10px rgba(15, 30, 60, .05);
}
.loading { padding: 40px; text-align: center; color: var(--muted); }

table.grid { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }
table.grid th, table.grid td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  vertical-align: middle;
}
table.grid thead th {
  position: sticky; top: var(--letters-h); z-index: 3;
  background: linear-gradient(#f9fbfd, #eef2f7);
  font-weight: 600; font-size: 12.5px; color: #2c3a4a;
  height: 38px; border-bottom: 1px solid var(--line-strong);
  text-align: left;
}
/* Excel 式列字母行：随表头一起吸顶 */
table.grid thead tr.letters th {
  top: 0; z-index: 3;
  height: var(--letters-h);
  padding: 0;
  background: #e9eef5;
  color: #7b8798;
  font-size: 10.5px; font-weight: 500;
  text-align: center;
  line-height: calc(var(--letters-h) - 1px);
  border-bottom: 1px solid var(--line-strong);
}
table.grid thead tr.letters th.rownum { position: sticky; left: 0; z-index: 7; background: #e4eaf2; }
table.grid thead tr.letters th.actions { position: sticky; right: 0; z-index: 5; background: #e4eaf2; }
table.grid thead th.align-center { text-align: center; }
table.grid thead th.align-right { text-align: right; }
table.grid thead th .th-inner {
  display: flex; align-items: center; gap: 2px;
  padding: 0 8px 0 12px; min-height: 38px;
}
table.grid thead th.align-right .th-inner { flex-direction: row-reverse; padding: 0 12px 0 8px; }
.th-title { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
th.align-left .th-title { text-align: left; }
th.align-center .th-title { text-align: center; }
th.align-right .th-title { text-align: right; }
.th-letter { color: #a6b1bf; font-size: 10px; margin-left: 3px; font-weight: 400; }
.th-hint { color: #a6b1bf; font-size: 10px; margin-left: 4px; font-weight: 400; }
.th-sort { flex: 0 0 auto; color: #b3bdca; font-size: 10px; padding-left: 4px; }
.th-sort.active { color: var(--accent); }
.funnel {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; margin-left: 2px;
  border: 0; background: transparent; cursor: pointer;
  color: #94a1b1; padding: 0; border-radius: 5px; line-height: 1;
  transition: background .12s, color .12s;
}
.funnel svg { display: block; }
.funnel svg path { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linejoin: round; }
.funnel:hover { background: #e8eef7; color: var(--accent); }
.funnel:focus-visible { outline: 2px solid #a9c6f5; outline-offset: 1px; }
.funnel.on { color: var(--accent); background: #e2ecfc; }
.funnel.on svg path { fill: currentColor; }

table.grid td.cell {
  font-size: 13px; color: #24303d;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  height: 36px; line-height: 36px; padding: 0 12px;
  font-variant-numeric: tabular-nums;
  background: inherit; cursor: default;
}
table.grid td.cell.align-right { text-align: right; }
table.grid td.cell.align-center { text-align: center; }
table.grid td.cell.align-left { text-align: left; }
tbody tr { background: #fff; }
tbody tr:nth-child(even) { background: #f8fafc; }
tbody tr:hover { background: #eef5ff; }
tbody tr.selected { background: #e4efff; }
td.cell.empty-cell { color: #c9d1db; }
td.cell.readonly { background: #f1f4f8; color: #6b7785; }
td.cell.sensitive { color: #55637a; cursor: pointer; }
td.cell.sensitive .eye { font-size: 10px; color: #9aa7b8; margin-left: 4px; }
td.cell.saving { background: #fff8e1; }
td.cell.error { box-shadow: inset 0 0 0 2px #e3a29a; }

table.grid td.rownum, table.grid th.rownum {
  position: sticky; left: 0; z-index: 2;
  width: 70px; min-width: 70px; max-width: 70px;
  padding: 0 10px 0 12px;
  text-align: left; color: var(--muted); font-size: 12px;
  background: #f7f9fc; border-right: 1px solid var(--line-strong);
}
thead th.rownum { z-index: 4; }
tbody td.rownum { background: #fff; }
tbody tr:nth-child(even) td.rownum { background: #f8fafc; }
tbody tr:hover td.rownum { background: #eef5ff; }
tbody tr.selected td.rownum { background: #e4efff; }
/* 首列表头：纵向与横向同时吸顶，层级高于表头(3)与表体吸顶单元格(2)，避免被数据行遮挡 */
table.grid thead th.rownum {
  position: sticky; top: var(--letters-h); left: 0; z-index: 6;
  background: #f3f6fa;
  border-right: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}
/* 复选框在左、序号在右，水平排列；表头全选框与数据行复选框起点一致 */
.rownum-inner { display: inline-flex; align-items: center; gap: 8px; line-height: 1; }
.rownum-inner input[type=checkbox] { margin: 0; flex: 0 0 auto; }
td.rownum .rowno { font-variant-numeric: tabular-nums; }

table.grid th.actions, table.grid td.actions {
  position: sticky; right: 0; z-index: 2;
  width: 87px; min-width: 87px; max-width: 87px;
  padding: 0 10px;
  background: #f7f9fc; text-align: center;
  border-left: 1px solid var(--line-strong);
  border-right: 0;
  box-shadow: -8px 0 8px -8px rgba(15, 30, 60, .22);
}
/* 操作列表头：纵向与横向同时吸顶，层级高于普通表头(3)，低于左上角交叉单元格(6) */
table.grid thead th.actions {
  position: sticky; top: var(--letters-h); right: 0; z-index: 5;
  background: #f3f6fa;
  border-left: 1px solid var(--line-strong);
  border-right: 0;
  border-bottom: 1px solid var(--line-strong);
}
tbody td.actions { background: #fff; }
tbody tr:nth-child(even) td.actions { background: #f8fafc; }
tbody tr:hover td.actions { background: #eef5ff; }
tbody tr.selected td.actions { background: #e4efff; }

/* 客户列左侧冻结：紧贴序号列右侧 */
table.grid th.freeze-l,
table.grid td.freeze-l { position: sticky; left: var(--rownum-w); z-index: 2; }
table.grid thead th.freeze-l {
  z-index: 6; background: #f3f6fa;
  border-right: 1px solid var(--line-strong);
  box-shadow: 6px 0 6px -6px rgba(15, 30, 60, .22);
}
table.grid thead tr.letters th.freeze-l {
  z-index: 4; background: #e4eaf2;
  box-shadow: 6px 0 6px -6px rgba(15, 30, 60, .18);
}
table.grid td.cell.freeze-l {
  background: inherit;
  border-right: 1px solid var(--line-strong);
  box-shadow: 6px 0 6px -6px rgba(15, 30, 60, .22);
}
/* 新增行短暂高亮，覆盖斑马纹与吸顶列背景 */
tbody tr.just-added { background: #fff4d6; }
tbody tr.just-added td,
tbody tr.just-added td.rownum,
tbody tr.just-added td.actions { background: #fff4d6; }
.icon-btn {
  border: 0; background: transparent; cursor: pointer;
  color: #7a8795; font-size: 12px; padding: 4px 5px; border-radius: 4px;
}
/* 操作列：两个图标按钮严格水平排列，按 30+30+6+20+1 计算列宽 */
.actions-inner {
  display: flex; align-items: center; justify-content: center;
  flex-wrap: nowrap; gap: 6px; height: 100%; min-height: 34px;
}
.actions .icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0; margin: 0; border-radius: 6px; flex: 0 0 30px;
}
.actions .icon-btn svg { display: block; }
.icon-btn:hover { background: #e9eef6; color: var(--accent); }
.icon-btn.del:hover { background: #fdecea; color: var(--danger); }

/* 单元格编辑 */
.cell-editor {
  width: 100%; min-width: 120px; border: 1px solid var(--accent);
  border-radius: 4px; padding: 4px 6px; font: inherit; font-size: 13px;
  outline: none; background: #fff; box-shadow: 0 0 0 3px var(--accent-weak);
}
.cell-editor.textarea { min-width: 260px; min-height: 60px; resize: vertical; }

/* 下拉编辑（列已配置默认值清单） */
.combo-list {
  position: fixed; z-index: 60;
  max-height: 220px; overflow: auto;
  background: #fff; border: 1px solid var(--line-strong);
  border-radius: 8px; box-shadow: var(--shadow);
  padding: 4px;
}
.combo-item, .combo-add {
  padding: 6px 10px; border-radius: 5px; font-size: 13px;
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.combo-item:hover, .combo-item.active { background: var(--accent-weak); color: var(--accent); }
.combo-add { color: var(--ok); border-top: 1px solid var(--line); margin-top: 4px; }
.combo-add:hover, .combo-add.active { background: #e8f6ef; }
.combo-empty { padding: 10px; color: var(--muted); font-size: 12.5px; }

/* 筛选面板：默认值清单维护 */
.fp-tip { color: #8a97a6; font-size: 11px; margin-left: auto; }
.opt-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; min-height: 24px; }
.opt-tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--accent-weak); border: 1px solid #cddff9; color: var(--accent);
  border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 12px;
}
.opt-tag button {
  border: 0; background: transparent; color: inherit; cursor: pointer;
  width: 16px; height: 16px; border-radius: 50%; line-height: 1; padding: 0;
}
.opt-tag button:hover { background: #d3e3fb; }
.opt-empty { color: #9aa7b8; font-size: 12px; }

.empty-state { padding: 60px 20px; text-align: center; color: var(--muted); }

/* 状态栏 */
.statusbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 8px 18px; background: var(--panel);
  border-top: 1px solid var(--line); flex: 0 0 auto; font-size: 12.5px;
  color: var(--muted);
}
.pager-wrap { display: flex; align-items: center; gap: 12px; }
.pager { display: flex; gap: 4px; align-items: center; }
.pager button {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  min-width: 30px; height: 28px; border-radius: 6px; cursor: pointer; font-size: 12.5px;
}
.pager button:hover { border-color: #b9c5d4; }
.pager button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager button:disabled { opacity: .4; cursor: not-allowed; }
.pager .dots { color: #a9b4c1; padding: 0 2px; }
.page-size {
  border: 1px solid var(--line-strong); border-radius: 6px;
  padding: 4px 6px; font-size: 12.5px; background: #fff; color: var(--ink);
}

/* 列设置菜单 */
.col-toggle { position: relative; }
.menu {
  position: absolute; right: 0; top: 38px; z-index: 20;
  width: 250px; max-height: 380px; overflow: auto;
  background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow); padding: 8px;
}
.menu label {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px; font-size: 13px; cursor: pointer;
}
.menu label:hover { background: #f4f7fb; }
.menu .menu-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 8px 8px; color: var(--muted); font-size: 12px;
  border-bottom: 1px solid var(--line); margin-bottom: 6px;
}
.menu .menu-head button { border: 0; background: transparent; color: var(--accent); cursor: pointer; font-size: 12px; }

/* 筛选面板 */
.filter-panel {
  position: fixed; z-index: 40; width: 380px;
  background: #fff; border: 1px solid #e1e7ef;
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(16, 32, 64, .18), 0 2px 6px rgba(16, 32, 64, .06);
  padding: 0; max-height: 76vh; overflow: auto;
}
.fp-head { padding: 16px 18px 12px; border-bottom: 1px solid #eef2f7; }
.filter-panel h4 { margin: 0; font-size: 15px; font-weight: 650; color: #16202b; letter-spacing: .2px; }
.filter-panel h4 .th-letter {
  margin-left: 6px; padding: 1px 5px; border-radius: 4px;
  background: #f1f4f8; color: #9aa7b8; font-size: 10.5px; font-weight: 500;
  vertical-align: 2px;
}
.filter-panel .fp-sub { margin: 5px 0 0; color: #8a97a6; font-size: 11.5px; line-height: 1.5; }
.fp-section { padding: 14px 18px; border-top: 1px solid #f0f3f7; }
.fp-head + .fp-section { border-top: 0; }
.fp-section strong { font-size: 12.5px; font-weight: 600; color: #2c3a4a; }

/* 手风琴分区 */
.fp-acc-head {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 0; border: 0; background: transparent; cursor: pointer;
  font: inherit; text-align: left; min-height: 24px;
}
.fp-acc-title { font-size: 13px; font-weight: 600; color: #2c3a4a; transition: color .15s; }
.fp-acc-head:hover .fp-acc-title, .fp-acc-section.open .fp-acc-title { color: var(--accent); }
.fp-acc-meta {
  margin-left: auto; display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; color: #8a97a6;
}
.fp-acc-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.fp-acc-arrow {
  display: inline-flex; width: 16px; height: 16px; color: #9aa7b8;
  transition: transform .22s ease, color .15s;
}
.fp-acc-arrow svg { width: 14px; height: 14px; display: block; }
.fp-acc-section.open .fp-acc-arrow { transform: rotate(180deg); color: var(--accent); }
.fp-acc-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .24s ease; }
.fp-acc-section.open .fp-acc-body { grid-template-rows: 1fr; }
.fp-acc-inner { overflow: hidden; min-height: 0; }
.fp-acc-content { padding-top: 10px; }
.fp-values {
  max-height: 190px; overflow: auto; border: 1px solid #e4eaf1;
  border-radius: 10px; margin: 8px 0; background: #fcfdfe;
}
.fp-values label {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; margin: 2px 4px; border-radius: 6px;
  font-size: 12.5px; color: #2c3a4a; cursor: pointer;
}
.fp-values label:hover { background: #eef4fd; }
.fp-values .cnt { margin-left: auto; color: #9aa7b8; font-size: 11px; }
.fp-row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.fp-row select, .fp-row input {
  height: 34px; border: 1px solid #dbe2ea; border-radius: 8px;
  padding: 0 10px; font-size: 12.5px; min-width: 0; background: #fff; color: var(--ink);
}
.fp-row select { padding-right: 6px; }
.fp-row input { flex: 1; }
.fp-row select:focus, .fp-row input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}
.fp-row label.fp-inline { color: #5a6776; font-size: 12px; }
.fp-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 12px; }
.fp-inline { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }

/* 面板内按钮体系：主按钮 / 次按钮 / 链接式，图标与文字垂直居中 */
.filter-panel .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 32px; padding: 0 12px; border-radius: 8px;
  font-size: 12.5px; line-height: 1;
}
.filter-panel .btn .btn-ic { display: inline-flex; width: 14px; height: 14px; opacity: .9; }
.filter-panel .btn .btn-ic svg { width: 14px; height: 14px; display: block; }
.filter-panel .btn.primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 1px 2px rgba(29, 95, 208, .28);
}
.filter-panel .btn.primary:hover { background: #1750b3; border-color: #1750b3; }
.filter-panel .btn.ghost { background: #fff; border-color: #d8e0ea; color: #3a4756; }
.filter-panel .btn.ghost:hover { background: #f5f8fc; border-color: #c6d2e0; }
.filter-panel .btn.link {
  border-color: transparent; background: transparent; color: var(--accent);
  padding: 0 8px; min-height: 32px;
}
.filter-panel .btn.link:hover { background: var(--accent-weak); border-color: transparent; }
.filter-panel .btn.link.danger { color: #b3453a; }
.filter-panel .btn.link.danger:hover { background: #fdf1ef; }

/* 默认值清单区：浅底卡片，与筛选区分开 */
.fp-options { background: #f8fafd; }
.fp-tip { color: #8a97a6; font-size: 11px; margin-left: auto; }

/* 恢复按钮：悬停用绿色，与退单的红色区分 */
.icon-btn.restore:hover { background: #e6f6ed; color: var(--ok); border-color: #bfe6d2; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 52px; transform: translateX(-50%);
  background: #24303f; color: #fff; padding: 9px 16px;
  border-radius: 8px; font-size: 13px; z-index: 60;
  box-shadow: var(--shadow); max-width: 70vw;
  display: flex; align-items: center; gap: 8px;
}
.toast-action {
  border: 0; background: rgba(255, 255, 255, .16); color: #fff;
  padding: 2px 9px; border-radius: 5px; font-size: 12px; cursor: pointer;
}
.toast-action:hover { background: rgba(255, 255, 255, .3); }
.toast.error { background: #a93226; }
.toast.ok { background: #17734a; }
.hidden { display: none !important; }

/* 列设置：月份列删除按钮与 60 列提示 */
.menu-warn {
  margin: 6px 8px 8px; padding: 6px 8px; border-radius: 6px;
  background: #fff7e6; border: 1px solid #f0dcb4; color: #8a6216;
  font-size: 11.5px; line-height: 1.4;
}
#colmenu label .col-del {
  margin-left: auto; border: 0; background: transparent; color: #a7b2c0;
  width: 20px; height: 20px; border-radius: 5px; cursor: pointer;
  font-size: 15px; line-height: 1; padding: 0;
}
#colmenu label .col-del:hover { background: #fdecea; color: var(--danger); }

/* 新增月份列弹窗 */
.modal-mask {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(20, 32, 48, .38);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-card {
  width: 480px; max-width: 100%; background: #fff; border-radius: 12px;
  box-shadow: 0 20px 60px rgba(15, 30, 60, .28); padding: 18px 20px 16px;
  max-height: calc(100vh - 40px); overflow-y: auto;
}
/* 退单弹框：窄版，标签改为上下排列，避免换行与挤压 */
.modal-card.return-dialog { width: 280px; }
.return-dialog .modal-field { grid-template-columns: 1fr; gap: 4px; align-items: start; }
.return-dialog .modal-field + .modal-field { margin-top: 12px; }
.return-dialog .modal-actions { margin-top: 22px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-x {
  border: 0; background: transparent; color: #8a97a6; cursor: pointer;
  font-size: 20px; line-height: 1; width: 28px; height: 28px; border-radius: 6px;
}
.modal-x:hover { background: #f1f4f8; color: var(--ink); }
.modal-sub { margin: 8px 0 14px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.modal-sub code {
  background: #f1f4f8; border-radius: 4px; padding: 1px 4px;
  font-family: ui-monospace, Consolas, monospace; font-size: 11.5px;
}
.modal-field {
  display: grid; grid-template-columns: 110px minmax(0, 1fr);
  align-items: center; gap: 10px; font-size: 13px; color: #34404e;
}
.modal-field + .modal-field { margin-top: 10px; }
.modal-field span { white-space: nowrap; }
.modal-field input {
  width: 100%; min-width: 0; height: 36px; border: 1px solid #dbe2ea; border-radius: 8px;
  padding: 0 10px; font-size: 13px; color: var(--ink); background: #fff;
}
.modal-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.modal-preview {
  display: flex; flex-direction: column; gap: 4px;
  margin: 12px 0 16px; padding: 9px 10px; border-radius: 8px;
  background: #f7f9fc; color: #4a5867; font-size: 12.5px;
}
.modal-preview .warn { color: #a15c00; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 900px) {
  .brand p { display: none; }
  .search input { width: 180px; }
  .topbar { gap: 10px; padding: 8px 10px; }
  .toolbar, .main, .statusbar { padding-left: 10px; padding-right: 10px; }
}

/* 窄屏弹窗：标签改为上下排列，避免挤压换行 */
@media (max-width: 520px) {
  .modal-mask { padding: 12px; }
  .modal-card { padding: 16px; }
  .modal-field { grid-template-columns: 1fr; gap: 4px; align-items: start; }
  .modal-field + .modal-field { margin-top: 12px; }
}
