/* ============ 基础 ============ */
:root {
  --bg: #e8edf4;
  --panel: #ffffff;
  --ink: #16212e;
  --muted: #6a7b8d;
  --line: #d7e0ea;
  --line-soft: #e9eff6;
  --brand: #0d2338;
  --accent: #1565d8;
  --accent-soft: #e8f1ff;
  --hot: #ef6c1a;
  --danger: #c0392b;
  --stage: #0b131c;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 36, 60, .06);
  --shadow-md: 0 8px 24px rgba(16, 36, 60, .10);
  --font: "Segoe UI", "Microsoft YaHei", -apple-system, "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.spacer { flex: 1; }
::selection { background: rgba(21, 101, 216, .18); }

/* 滚动条 */
.pane-scroll::-webkit-scrollbar, .stage::-webkit-scrollbar, .tabs::-webkit-scrollbar { width: 10px; height: 10px; }
.pane-scroll::-webkit-scrollbar-thumb, .tabs::-webkit-scrollbar-thumb {
  background: #c6d3e1; border-radius: 8px; border: 2px solid transparent; background-clip: content-box;
}
.stage::-webkit-scrollbar-thumb {
  background: #35485c; border-radius: 8px; border: 2px solid transparent; background-clip: content-box;
}

/* ============ 顶栏 ============ */
.topbar {
  flex: none;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: linear-gradient(180deg, #10293f, #0b1d2e);
  color: #e9f2fb;
  border-bottom: 1px solid #06121e;
}
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.logo {
  width: 28px; height: 28px; border-radius: 7px;
  display: grid; place-items: center;
  background: linear-gradient(150deg, #1d6fd0, #124b93);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 2px 6px rgba(0,0,0,.28);
}
.brand h1 { font-size: 15px; font-weight: 600; margin: 0; letter-spacing: .03em; white-space: nowrap; }
.tag {
  font-size: 10px; letter-spacing: .12em; padding: 2px 6px; border-radius: 4px;
  color: #9dc4e8; border: 1px solid rgba(157, 196, 232, .38);
}
.save-state {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: #9fb6cd; white-space: nowrap;
  border: 0; background: transparent; padding: 3px 7px; border-radius: 6px;
  cursor: pointer;
}
.save-state:hover { background: rgba(255,255,255,.1); color: #dfeefb; }
.ver {
  font-size: 10px; letter-spacing: .06em; padding: 2px 6px; border-radius: 4px;
  color: #8fb4d6; background: rgba(143, 180, 214, .12);
}
.save-state i {
  width: 6px; height: 6px; border-radius: 50%; background: #4cc38a;
  box-shadow: 0 0 0 3px rgba(76, 195, 138, .16);
}
.save-state.saving i { background: #e8b23a; box-shadow: 0 0 0 3px rgba(232,178,58,.16); }
.save-state.error { color: #f2a196; }
.save-state.error i { background: #e8593f; box-shadow: 0 0 0 3px rgba(232,89,63,.18); }
.tb-divider { width: 1px; height: 18px; background: rgba(255,255,255,.14); }
.tb-btn {
  height: 28px; padding: 0 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06);
  color: #d6e6f6;
  font-size: 12.5px;
}
.tb-btn:hover { background: rgba(255,255,255,.13); color: #fff; }
.tb-btn.primary {
  background: #1b6fd4;
  border-color: #3d8be8;
  color: #fff;
  font-weight: 600;
}
.tb-btn.primary:hover { background: #2b80e6; border-color: #62a6f2; }

/* 缓存/脚本异常提示条 */
.fatal-bar {
  padding: 8px 16px;
  background: #fff6e5;
  color: #875600;
  border-bottom: 1px solid #f0c987;
  font-size: 12.5px;
  line-height: 1.6;
}
.fatal-bar.error { background: #fdecea; color: #a02a1c; border-bottom-color: #f3b8b0; }
.fatal-bar b { color: inherit; }

/* ============ 标签栏 ============ */
.tabstrip {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 6px 10px 0;
  height: 42px;
  background: #dfe7f0;
  border-bottom: 1px solid var(--line);
}
.tabs { display: flex; align-items: flex-end; gap: 4px; overflow-x: auto; min-width: 0; }
.tabs::-webkit-scrollbar { height: 0; }
.tab {
  position: relative;
  display: flex; align-items: center; gap: 4px;
  height: 31px;
  max-width: 210px;
  padding: 0 5px 0 11px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 7px 7px 0 0;
  background: #e9eff6;
  color: #566a7e;
  font-size: 13px;
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
}
.tab:hover { background: #f0f5fa; color: #2c4055; }
.tab.active {
  background: var(--panel);
  color: var(--ink);
  font-weight: 600;
  border-color: var(--line);
  box-shadow: inset 0 2px 0 var(--accent);
}
.tab .t-name { overflow: hidden; text-overflow: ellipsis; padding-bottom: 1px; }
.tab .t-x {
  width: 18px; height: 18px; flex: none;
  border: 0; border-radius: 4px; padding: 0;
  background: transparent; color: #93a5b7;
  font-size: 13px; line-height: 1; opacity: 0;
}
.tab:hover .t-x, .tab.active .t-x { opacity: 1; }
.tab .t-x:hover { background: #fbe3e0; color: var(--danger); }
.tab .t-x:disabled { display: none; }
/* 拖动换位置 */
.tab { touch-action: pan-y; }
.tab.tab-dragging {
  z-index: 3;
  cursor: grabbing;
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 6px 16px rgba(16, 56, 102, .18);
  opacity: .96;
}
.tab.tab-dragging .t-x { opacity: 0; }
body.tab-drag-mode { cursor: grabbing; user-select: none; }
.tab-add {
  height: 27px; margin-bottom: 3px; padding: 0 10px;
  border-radius: 6px;
  border: 1px dashed #a8bccf;
  background: transparent;
  color: #3d5a75;
  font-size: 12.5px;
  white-space: nowrap;
}
.tab-add:hover { background: #fff; border-color: var(--accent); color: var(--accent); }
.tab-hint { font-size: 11.5px; color: #90a2b4; padding-bottom: 9px; }

/* ============ 主区 ============ */
.work {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--split, 58%) 7px minmax(300px, 1fr);
  background: var(--panel);
}
.pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--panel); }
.pane-table::before { content: attr(data-title); display: none; }
.pane-head {
  flex: none;
  height: 46px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line-soft);
  background: #fbfcfe;
}
.pane-label {
  font-size: 11px; letter-spacing: .08em; color: #90a2b4;
  padding-right: 2px; white-space: nowrap;
}
.page-title {
  flex: 1; min-width: 80px;
  height: 30px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #f2f6fa;
  font-size: 13.5px;
  font-weight: 600;
  outline: none;
}
.page-title:hover { background: #edf3f9; }
.page-title:focus { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(21,101,216,.12); }
.counter {
  font-size: 11.5px; color: #7a8da0; white-space: nowrap;
  padding: 2px 7px; border-radius: 999px; background: #eef3f9;
}
.btn {
  height: 30px; padding: 0 11px;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  border: 1px solid #cfdbe8;
  border-radius: 6px;
  background: #fff;
  color: #26394d;
  font-size: 12.5px;
  white-space: nowrap;
  transition: background .14s, border-color .14s, color .14s;
}
.btn:hover { background: #f3f8fd; border-color: #b6c8db; }
.btn:active { transform: translateY(.5px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #0f57bd; border-color: #0f57bd; }
.btn.mini { width: 26px; padding: 0; font-size: 14px; }
.btn.icon { width: 30px; padding: 0; color: #5c6f83; }
.btn.icon:hover { color: var(--danger); }
.btn.toggle.on { background: var(--accent-soft); border-color: #a9c8ef; color: #1257b8; }
.btn:disabled { opacity: .4; pointer-events: none; }

.splitter {
  position: relative;
  cursor: col-resize;
  background: #e7eef6;
  border-left: 1px solid #dbe4ee;
  border-right: 1px solid #dbe4ee;
}
.splitter span {
  position: absolute; left: 50%; top: 50%;
  width: 2px; height: 26px; margin: -13px 0 0 -1px;
  border-radius: 2px; background: #b8c9da;
}
.splitter:hover { background: #d8e5f2; }
.splitter:hover span { background: var(--accent); }

/* ============ 表格 ============ */
.pane-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 14px 48px;
  background: #f4f8fb;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.block {
  background: #fff;
  border: 1px solid #d2dfec;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: clip;
}
.block-head {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 7px 6px 12px;
  background: linear-gradient(180deg, #275579, #1c4568);
}
.block-title {
  flex: 1; min-width: 40px;
  padding: 3px 5px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
  outline: none;
}
.block-title:hover { background: rgba(255,255,255,.08); }
.block-title:focus { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.45); }
.block-title::placeholder { color: rgba(255,255,255,.55); }
.block-head .btn {
  height: 24px; padding: 0 8px; font-size: 11.5px;
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.26);
  color: #eaf4ff;
}
.block-head .btn:hover { background: rgba(255,255,255,.24); border-color: rgba(255,255,255,.5); }

.grid { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.grid th {
  position: sticky; top: 0; z-index: 2;
  padding: 7px 10px;
  background: #e8f0f9;
  color: #1a4a76;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-align: left;
  border-bottom: 1px solid #cddbea;
  border-right: 1px solid #dde7f2;
}
.grid th:last-child { border-right: 0; }
.grid td {
  padding: 0;
  border-bottom: 1px solid #eef3f8;
  border-right: 1px solid #f3f7fb;
  vertical-align: middle;
  position: relative;
}
.grid td:last-child { border-right: 0; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid input, .grid textarea {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  color: #17232f;
  outline: none;
  resize: none;
  overflow: hidden;
}
.grid textarea { min-height: 33px; }
.grid input::placeholder, .grid textarea::placeholder { color: #bcc9d6; }
.grid input:focus, .grid textarea:focus {
  background: #fffdf2;
  box-shadow: inset 0 0 0 2px rgba(21, 101, 216, .32);
  border-radius: 2px;
}
.grid tbody tr { transition: background .1s; }
.grid tbody tr:hover { background: #f2f8ff; }
.grid tbody tr.sel { background: #fff7ea; }
.grid tbody tr.sel:hover { background: #fff3dd; }
.grid tbody tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.grid tbody tr.has-box td:first-child { box-shadow: inset 3px 0 0 var(--hot); }
.grid tbody tr.sel.has-box td:first-child { box-shadow: inset 3px 0 0 var(--accent), inset 3px 0 0 var(--hot); }

/* 行拖动把手 */
.grid th.grip-col { width: 22px; padding: 0; }
.grid td.grip {
  width: 22px;
  padding: 0;
  text-align: center;
  vertical-align: middle;
  cursor: grab;
  touch-action: none;
  user-select: none;
  background: #fbfdff;
}
.grid td.grip span {
  display: inline-block;
  width: 10px;
  height: 22px;
  border-radius: 3px;
  background-image: radial-gradient(circle, #c4d3e2 1.25px, transparent 1.35px);
  background-size: 5px 5.5px;
  background-position: 0 2px;
}
.grid td.grip:hover { background: #eaf4ff; }
.grid td.grip:hover span { background-image: radial-gradient(circle, var(--accent) 1.35px, transparent 1.45px); }
.grid td.grip:active { cursor: grabbing; }
.grid tbody tr.dragging { background: #eaf4ff; }
.grid tbody tr.dragging td { opacity: .55; }
.grid tbody tr.dragging td.grip { opacity: 1; }

/* 拖动行时的插入位置指示线 */
.row-drop-line {
  position: fixed; z-index: 80;
  height: 2px; display: none;
  background: var(--accent); border-radius: 2px;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(21, 101, 216, .22), 0 2px 6px rgba(21, 101, 216, .25);
}
body.row-drag-mode { cursor: grabbing; user-select: none; }

td.ops { width: 56px; }
.ops-inner { display: flex; align-items: center; justify-content: center; gap: 5px; padding: 0 6px; }
.op-dot {
  width: 15px; height: 15px; flex: none;
  padding: 0; border: 0; border-radius: 50%;
  background: #dde6ef;
  color: #fff;
  font-size: 9px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.op-dot:hover { background: #ef6c1a; }
.op-dot.on { background: var(--hot); box-shadow: 0 0 0 3px rgba(239,108,26,.16); }
.op-del {
  width: 18px; height: 18px; flex: none;
  padding: 0; border: 0; border-radius: 4px;
  background: transparent;
  color: #a6b7c8;
  font-size: 14px; line-height: 1;
  opacity: 0;
  transition: opacity .12s;
}
tr:hover .op-del { opacity: 1; }
.op-del:hover { background: #fbe5e2; color: var(--danger); }

.block-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px;
  background: #f8fbfe;
  border-top: 1px solid #eef4fa;
}
.add-row {
  border: 0; background: transparent; padding: 3px 4px;
  color: var(--accent); font-size: 12.5px; border-radius: 4px;
}
.add-row:hover { background: var(--accent-soft); }
.foot-hint { font-size: 11.5px; color: #a1b0bf; }

/* 空状态 */
.empty-state {
  margin: auto;
  text-align: center;
  color: var(--muted);
  padding: 30px;
  font-size: 13px;
  line-height: 1.8;
}
.empty-state strong { display: block; font-size: 14px; color: #2b3f54; margin-bottom: 4px; }

/* ============ 图片区 ============ */
.pane-image { background: #fff; }
.zoom {
  display: flex; align-items: center;
  height: 28px;
  border: 1px solid #d3dfeb;
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}
.zoom .btn.mini { height: 26px; width: 25px; border: 0; border-radius: 0; background: transparent; color: #4c6076; }
.zoom .btn.mini:hover { background: #eef4fb; }
.zoom-val {
  min-width: 48px; height: 26px;
  border: 0; border-left: 1px solid #e4ecf5; border-right: 1px solid #e4ecf5;
  background: transparent;
  color: #4c6076;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.zoom-val:hover { background: #eef4fb; }

/* 单张 / 全部 */
.seg {
  display: flex;
  height: 28px;
  border: 1px solid #d3dfeb;
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}
.seg button {
  height: 26px; padding: 0 10px;
  border: 0; background: transparent;
  color: #5a6e82; font-size: 12px;
}
.seg button + button { border-left: 1px solid #e4ecf5; }
.seg button:hover { background: #f3f8fd; }
.seg button.on { background: var(--accent-soft); color: #1257b8; font-weight: 600; }

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--stage);
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,.055) 1px, transparent 0);
  background-size: 22px 22px;
}
.gallery {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 30px;
  min-width: 100%;
  min-height: 100%;
  padding: 22px;
  box-sizing: border-box;
}
.gallery[data-mode="all"] { justify-content: flex-start; }
.shot { margin: 0; max-width: 100%; }
.shot-cap {
  display: flex; align-items: center; gap: 6px;
  padding: 0 0 6px 2px;
  font-size: 11.5px;
  color: #8ca4bb;
  max-width: 100%;
  overflow: hidden;
}
.shot-cap b { color: #cfe3f7; font-weight: 600; flex: none; }
.shot-cap span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frame {
  position: relative;
  margin: 0 auto;
  box-shadow: 0 14px 40px rgba(0,0,0,.55);
  outline: 1px solid rgba(255,255,255,.14);
}
.frame img {
  display: block;
  width: 100%; height: 100%;
  user-select: none;
  -webkit-user-drag: none;
}
.frame img.broken { opacity: .12; }
.frame.loading::after {
  content: "图片加载中…";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: #101a26;
  color: #7d95ab;
  font-size: 12.5px;
  z-index: 1;
}
.img-error {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: rgba(9, 18, 28, .82);
  color: #cfdcea;
  font-size: 13px;
  z-index: 6;
}
.img-error button {
  height: 28px; padding: 0 12px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 6px;
  background: rgba(255,255,255,.1);
  color: #fff;
  font-size: 12px;
}
.img-error button:hover { background: rgba(255,255,255,.22); }
.overlay {
  position: absolute; inset: 0;
  overflow: hidden;
  touch-action: none;
  outline: none;
}

/* 缩略图条 */
.thumbs {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  min-height: 64px;
  border-top: 1px solid var(--line-soft);
  background: #fff;
  overflow-x: auto;
}
.thumbs:empty { display: none; }
.thumb {
  position: relative;
  width: 74px; height: 54px;
  flex: none;
  padding: 0;
  border: 1.5px solid #d7e2ee;
  border-radius: 6px;
  background: #0b131c;
  overflow: hidden;
  cursor: pointer;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .8; }
.thumb.on { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(21,101,216,.22); }
.thumb.on img { opacity: 1; }
.thumb-idx {
  position: absolute; left: 3px; top: 3px;
  min-width: 15px; height: 15px;
  border-radius: 4px;
  background: rgba(8,18,30,.72);
  color: #dce9f7;
  font-size: 10px; line-height: 15px; text-align: center;
  padding: 0 2px;
}
.thumb-x {
  position: absolute; right: 2px; top: 2px;
  width: 16px; height: 16px;
  border: 0; border-radius: 4px;
  background: rgba(8,18,30,.6);
  color: #cfdcea;
  font-size: 12px; line-height: 1;
  opacity: 0;
  transition: opacity .12s;
}
.thumb:hover .thumb-x { opacity: 1; }
.thumb-x:hover { background: #c0392b; color: #fff; }
.thumb-add {
  width: 42px; height: 54px;
  flex: none;
  border: 1px dashed #b8c9da;
  border-radius: 6px;
  background: #fbfcfe;
  color: #5c748c;
  font-size: 17px;
}
.thumb-add:hover { border-color: var(--accent); color: var(--accent); background: #f2f8ff; }
.overlay.draw { cursor: crosshair; }

.box {
  position: absolute;
  border: 1.5px solid var(--hot);
  background: rgba(239, 108, 26, .14);
  border-radius: 2px;
}
.box.hover { border-color: #ffb066; background: rgba(255, 176, 102, .2); }
.box.dim { box-shadow: 0 0 0 3000px rgba(2, 7, 12, .6); }
.box.sel {
  border-color: #55b1ff;
  background: rgba(85, 177, 255, .14);
  cursor: move;
  box-shadow: 0 0 0 1px rgba(85,177,255,.4), 0 0 18px rgba(85,177,255,.35);
}
.box.all {
  border-style: dashed;
  border-color: rgba(239,108,26,.65);
  background: rgba(239,108,26,.05);
  pointer-events: none;
}
.box-label {
  position: absolute;
  left: -1.5px; bottom: 100%;
  max-width: 280px;
  padding: 2px 7px;
  background: var(--hot);
  color: #fff;
  font-size: 11.5px;
  line-height: 1.5;
  border-radius: 3px 3px 3px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.box-label.flip { bottom: auto; top: 100%; border-radius: 0 3px 3px 3px; }
.box.sel .box-label { background: #1b6fd4; }

.h {
  position: absolute;
  width: 9px; height: 9px;
  margin: -5px 0 0 -5px;
  background: #fff;
  border: 1.6px solid #1b6fd4;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.h.nw { left: 0; top: 0; cursor: nwse-resize; }
.h.n  { left: 50%; top: 0; cursor: ns-resize; }
.h.ne { left: 100%; top: 0; cursor: nesw-resize; }
.h.e  { left: 100%; top: 50%; cursor: ew-resize; }
.h.se { left: 100%; top: 100%; cursor: nwse-resize; }
.h.s  { left: 50%; top: 100%; cursor: ns-resize; }
.h.sw { left: 0; top: 100%; cursor: nesw-resize; }
.h.w  { left: 0; top: 50%; cursor: ew-resize; }
.h:hover { background: #1b6fd4; }

/* 选中框上的删除按钮 */
.box-del {
  position: absolute; right: -11px; top: -11px;
  width: 20px; height: 20px;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid #fff;
  border-radius: 50%;
  background: #e0533b;
  color: #fff;
  font-size: 11px;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(0,0,0,.45);
  z-index: 5;
  cursor: pointer;
}
.box-del:hover { background: #c0392b; transform: scale(1.08); }

.stage-empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
  color: #7e93a8;
  text-align: center;
  padding: 24px;
}
.stage-empty svg { color: #46617c; }
.stage-empty strong { color: #cfdeed; font-size: 14px; font-weight: 600; }
.stage-empty span { font-size: 12.5px; max-width: 300px; line-height: 1.7; }
.stage-empty .btn { margin-top: 8px; }

/* 首次框选引导 */
.stage-coach {
  position: absolute; left: 14px; top: 14px;
  display: flex; align-items: center; gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(11, 27, 43, .86);
  border: 1px solid rgba(120, 174, 230, .35);
  color: #cfe3f7;
  font-size: 12px;
  pointer-events: none;
  animation: coach-in .3s ease-out;
}
.stage-coach b { color: #74b6ff; font-weight: 700; }
@keyframes coach-in { from { opacity: 0; transform: translateY(-5px); } }

.statusbar {
  flex: none;
  height: 34px;
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px;
  border-top: 1px solid var(--line-soft);
  background: #fbfcfe;
  font-size: 12px;
  color: #6d8093;
  min-width: 0;
}
.status-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-text b { color: #2b3f54; font-weight: 600; }
.coords { font-size: 11.5px; color: #93a5b7; font-variant-numeric: tabular-nums; white-space: nowrap; }
.statusbar .btn.toggle {
  height: 22px; padding: 0 8px; font-size: 11px;
  border-radius: 5px; color: #6d8093; border-color: #dae3ec; background: #fff;
}
.statusbar .btn.toggle.on { color: #1257b8; background: var(--accent-soft); border-color: #a9c8ef; }
.statusbar .btn.toggle:disabled { opacity: .35; }

/* 拖图提示 */
.stage.drag-over { box-shadow: inset 0 0 0 2px var(--accent); }
.stage.drag-over::after {
  content: "松开鼠标即可导入这张图";
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: rgba(8, 18, 30, .62);
  color: #dbe9f7;
  font-size: 13px;
  pointer-events: none;
}

/* 定位闪烁 */
.box.flash { animation: box-flash .45s ease-in-out 2; }
@keyframes box-flash {
  50% { box-shadow: 0 0 0 7px rgba(239, 108, 26, .4); border-color: #ffd0a8; }
}

/* ============ 提示条 ============ */
.toasts {
  position: fixed; right: 16px; bottom: 46px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 50;
  pointer-events: none;
}
.toast {
  padding: 9px 14px;
  border-radius: 7px;
  background: rgba(16, 30, 45, .94);
  color: #eaf3fb;
  font-size: 12.5px;
  box-shadow: 0 10px 28px rgba(0,0,0,.3);
  animation: toast-in .18s ease-out;
  max-width: 380px;
}
.toast.warn { background: rgba(160, 74, 18, .95); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

/* ============ 对话框 ============ */
.dlg {
  border: 0;
  border-radius: 12px;
  padding: 0;
  width: min(540px, calc(100vw - 32px));
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(8, 20, 34, .35);
  background: #fff;
}
.dlg::backdrop { background: rgba(9, 20, 32, .5); backdrop-filter: blur(2px); }
.dlg-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 14px 12px 18px;
  border-bottom: 1px solid var(--line-soft);
}
.dlg-head h2 { margin: 0; font-size: 15px; font-weight: 600; flex: 1; }
.dlg-body { padding: 16px 18px; }
.dlg-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 18px 16px;
}
.dlg-note { margin: 12px 0 0; font-size: 12px; color: #7c8fa2; line-height: 1.7; }
.dlg-note:empty { display: none; }
.dlg-note.hint { color: var(--accent); margin-top: 10px; }

/* 通用确认框 */
.dlg-confirm { width: min(420px, calc(100vw - 32px)); }
.confirm-msg { margin: 0; font-size: 13.5px; line-height: 1.8; color: #24384c; }
.confirm-msg b { color: #10283f; }
.dlg-confirm .dlg-note { margin-top: 8px; }
.btn.danger-fill { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-fill:hover { background: #c73a2e; border-color: #c73a2e; color: #fff; }

/* 待导入图片列表 */
.pending-list {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 12px;
  max-height: 236px;
  overflow: auto;
}
.pending-list:empty { display: none; }
.pend {
  display: flex; align-items: center; gap: 10px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}
.pend img {
  width: 78px; height: 54px;
  object-fit: cover;
  border-radius: 5px;
  background: #0b131c;
  flex: none;
}
.pend-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pend-meta b {
  font-size: 12.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pend-meta span { font-size: 11.5px; color: #7c8fa2; }
.pend-x {
  width: 24px; height: 24px; flex: none;
  border: 0; border-radius: 5px;
  background: transparent; color: #a3b3c4; font-size: 14px;
}
.pend-x:hover { background: #fbe5e2; color: var(--danger); }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 26px 16px;
  border: 1.5px dashed #c3d3e3;
  border-radius: 10px;
  background: #f7fafd;
  color: #7c8fa2;
  text-align: center;
  cursor: pointer;
  outline: none;
  transition: .15s;
}
.dropzone strong { color: #374d63; font-size: 13.5px; }
.dropzone span { font-size: 12px; }
.dropzone:hover, .dropzone:focus, .dropzone.hot {
  border-color: var(--accent);
  background: #f1f7ff;
  color: var(--accent);
}
.dropzone.hot strong { color: var(--accent); }
.dlg-preview { margin-top: 14px; text-align: center; }
.dlg-preview img {
  max-width: 100%; max-height: 250px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0b131c;
}
.dlg-meta { margin-top: 8px; font-size: 12px; color: #6d8093; }
.file-input { width: 100%; font-size: 13px; }

/* ============ 日志面板 ============ */
.dlg-wide { width: min(1040px, calc(100vw - 32px)); }
.dlg-wide .dlg-body { max-height: min(66vh, 620px); overflow: auto; }
.log-grid {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 280px;
  gap: 14px;
}
.log-card {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 10px 12px 12px;
  min-width: 0;
}
.log-card h3 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  color: #2b3f54;
}
.kv { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 5px 8px; margin: 0; font-size: 12px; }
.kv dt { color: #7c8fa2; }
.kv dd { margin: 0; color: #22384c; font-variant-numeric: tabular-nums; word-break: break-all; }
.log-note { margin: 10px 0 0; font-size: 11.5px; color: #8b9cae; line-height: 1.65; }

.op-log, .ver-log { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow: auto; font-size: 12px; }
.op-log li {
  display: flex; flex-wrap: wrap; gap: 5px 8px;
  padding: 5px 0;
  border-bottom: 1px dashed #e8eef5;
}
.op-log li:last-child { border-bottom: 0; }
.op-log time { color: #93a5b7; font-variant-numeric: tabular-nums; }
.op-log b { color: #1f3b57; font-weight: 600; }
.op-log span { color: #5d7286; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.op-log i { margin-left: auto; color: #a6b6c6; font-style: normal; font-size: 11px; }
.op-log li.empty { color: #93a5b7; border: 0; }
.ver-log li { padding: 7px 0; border-bottom: 1px dashed #e8eef5; }
.ver-log li:last-child { border-bottom: 0; }
.ver-head { display: flex; gap: 8px; align-items: baseline; }
.ver-head b { color: #1f3b57; }
.ver-head time { color: #93a5b7; font-size: 11px; }
.ver-log ul { margin: 4px 0 0 16px; padding: 0; color: #5d7286; line-height: 1.7; }
.btn.danger { color: var(--danger); border-color: #e7c3bd; }
.btn.danger:hover { background: #fdf2f0; border-color: #dda9a0; }

/* ============ 窄屏 ============ */
@media (max-width: 900px) {
  .work { display: flex; flex-direction: column; }
  .splitter { display: none; }
  .pane-table { flex: 1 1 46%; border-bottom: 1px solid var(--line); }
  .pane-image { flex: 1 1 54%; }
  .stage { min-height: 260px; }
  .tab-hint { display: none; }
  .pane-head { gap: 6px; padding: 0 8px; }
  .counter { display: none; }
  .log-grid { grid-template-columns: 1fr; }
  .dlg-wide .dlg-body { max-height: 70vh; }
}

/* ============ 打印 ============ */
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  html, body { height: auto; overflow: visible; background: #fff; }
  .topbar, .tabstrip, .splitter, .pane-head, .statusbar, .toasts,
  .stage-empty, .stage-coach, .block-foot, .ops, .pane-head .btn { display: none !important; }
  .block-head .btn { display: none !important; }
  .pane-table::before {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #16212e;
    padding-bottom: 5px;
    margin-bottom: 7px;
    border-bottom: 1.5px solid #b9c9d9;
  }
  .work { display: flex; gap: 8mm; align-items: flex-start; padding-top: 2mm; }
  .pane-table { flex: 1 1 52%; }
  .pane-image { flex: 1 1 48%; }
  .pane-scroll { overflow: visible; padding: 0; gap: 5mm; background: #fff; }
  .block { box-shadow: none; break-inside: avoid; }
  .grid input, .grid textarea { padding: 5px 8px; }
  .grid th { position: static; }
  /* 打印时不显示拖动把手与插入线：只隐藏视觉，保留列占位，否则后面的列会整体错位 */
  .grid colgroup col:first-child { width: 0 !important; }
  .grid th.grip-col, .grid td.grip { visibility: hidden; padding: 0; border: 0; }
  .row-drop-line { display: none !important; }
  .grid tbody tr.sel, .grid tbody tr.sel:hover { background: transparent; }
  .grid tbody tr.sel td:first-child,
  .grid tbody tr.has-box td:first-child,
  .grid tbody tr.sel.has-box td:first-child { box-shadow: none; }
  .stage {
    position: static; overflow: visible;
    background: #fff !important; background-image: none !important;
  }
  .thumbs { display: none !important; }
  .gallery { display: block; min-height: 0; padding: 0; }
  .gallery .shot { margin: 0 0 6mm; break-inside: avoid; }
  .shot-cap { display: none; }
  .frame { width: 100% !important; height: auto !important; margin: 0; box-shadow: none; outline: 0; }
  .frame img { width: 100%; height: auto; }
  .overlay { display: none; }
}
