/* 锐消 RedactX — 参照 Vercel 设计语言：近白画布、墨黑主操作、细描边加多层淡阴影、等宽字体做技术标签、
   多色网格渐变只在上传区大面积出现。全部使用系统字体，不加载外部资源。 */
:root {
  --canvas: #ffffff;
  --canvas-soft: #fafafa;
  --canvas-soft-2: #f5f5f5;
  --ink: #171717;
  --body: #4d4d4d;
  --mute: #888888;
  --hairline: #ebebeb;
  --hairline-strong: #a1a1a1;
  --primary: #171717;
  --on-primary: #ffffff;
  --link: #0070f3;
  --link-deep: #0761d1;
  --link-soft: #d3e5ff;
  --error: #ee0000;
  --error-deep: #c50000;
  --error-soft: #f7d4d6;
  --warning-deep: #ab570a;
  --warning-soft: #ffefcf;
  --stage: #f5f5f5;
  --ring: 0 0 0 1px rgba(0, 0, 0, .08);
  --e2: 0 1px 1px rgba(0, 0, 0, .02), 0 2px 2px rgba(0, 0, 0, .04), var(--ring);
  --e4: 0 2px 2px rgba(0, 0, 0, .04), 0 8px 16px -4px rgba(0, 0, 0, .04), var(--ring);
  --e5: 0 1px 1px rgba(0, 0, 0, .02), 0 8px 16px -4px rgba(0, 0, 0, .04), 0 24px 32px -8px rgba(0, 0, 0, .06), var(--ring);
  /* 字段分组色，取自 Vercel 系统色板 */
  --c-people: #0070f3;
  --c-org: #7928ca;
  --c-numbers: #f5a623;
  --c-medical: #ff0080;
  --c-handwriting: #ee0000;
  --c-images: #29bc9b;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Monaco, "Noto Sans Mono CJK SC", monospace;
  color-scheme: light;
}
/* 深色主题：theme.js 按用户选择或系统设置写入 data-theme */
:root[data-theme="dark"] {
  /* 层次：页面 < 卡片 < 悬停；边框与文字三档灰拉开差距 */
  --canvas: #141416;
  --canvas-soft: #0b0b0c;
  --canvas-soft-2: #1f1f22;
  --ink: #ededed;
  --body: #b3b3b8;
  --mute: #88888f;
  --hairline: #2a2a2e;
  --hairline-strong: #46464c;
  --primary: #ededed;
  --on-primary: #0b0b0c;
  --link: #4ea1ff;
  --link-deep: #7ab8ff;
  --link-soft: #10243d;
  --error: #ff5c5c;
  --error-deep: #ff7b7b;
  --error-soft: #3b1618;
  --warning-deep: #f5b544;
  --warning-soft: #33260e;
  --stage: #0f0f11;
  --ring: 0 0 0 1px rgba(255, 255, 255, .08);
  --e2: 0 1px 2px rgba(0, 0, 0, .45), var(--ring);
  --e4: 0 8px 16px -4px rgba(0, 0, 0, .55), var(--ring);
  --e5: 0 24px 32px -8px rgba(0, 0, 0, .65), var(--ring);
  --c-people: #4ea1ff;
  --c-org: #b18cf0;
  --c-numbers: #f5b544;
  --c-medical: #ff66b3;
  --c-handwriting: #ff5c5c;
  --c-images: #50e3c2;
  color-scheme: dark;
}
/* 样式示意代表打印在纸上的效果，保持浅色；深色下降低亮度，不刺眼 */
[data-theme="dark"] .sty, [data-theme="dark"] .swatch { filter: brightness(.82) saturate(.9); }

* { box-sizing: border-box; }
/* 图标 */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.summary h3 .ic { width: 13px; height: 13px; }
dialog h3 .ic { width: 20px; height: 20px; }
/* body 只设最小高度：设成固定 100% 时，页面比一屏长（手机单栏）后固定顶部栏会随 body 一起滚走 */
html { height: 100%; }
body { min-height: 100%; }
body { margin: 0; background: var(--canvas-soft); color: var(--ink); font: 14px/20px var(--sans); letter-spacing: -0.01em; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
::selection { background: var(--primary); color: var(--on-primary); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: 0; }
[hidden] { display: none !important; }
.eyebrow { font: 400 12px/16px var(--mono); color: var(--mute); letter-spacing: .04em; text-transform: uppercase; }

/* 顶栏 */
/* 液态玻璃：半透明底 + 背景模糊提饱和 + 很淡的蓝紫渐变，顶边一道高光、底边细线；内容滚到下面时透出 */
.topbar { --glass-tint-a: color-mix(in srgb, var(--link) 7%, transparent); --glass-tint-b: color-mix(in srgb, #8b5cf6 6%, transparent); --glass-hi: rgba(255, 255, 255, .7);
  height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 20; isolation: isolate;
  background: linear-gradient(100deg, var(--glass-tint-a) 0%, transparent 42%, transparent 58%, var(--glass-tint-b) 100%), color-mix(in srgb, var(--canvas) 70%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 1px 0 color-mix(in srgb, var(--hairline) 80%, transparent), 0 8px 24px -16px rgba(0, 0, 0, .12); }
.topbar::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(120% 140% at 18% -40%, rgba(255, 255, 255, .55), transparent 60%), radial-gradient(80% 120% at 85% 140%, color-mix(in srgb, var(--link) 6%, transparent), transparent 70%); }
[data-theme="dark"] .topbar { --glass-tint-a: color-mix(in srgb, var(--link) 11%, transparent); --glass-tint-b: color-mix(in srgb, #8b5cf6 10%, transparent); --glass-hi: rgba(255, 255, 255, .07);
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 1px 0 var(--hairline), 0 8px 24px -16px rgba(0, 0, 0, .6); }
[data-theme="dark"] .topbar::before { background: radial-gradient(120% 140% at 18% -40%, rgba(255, 255, 255, .06), transparent 60%), radial-gradient(80% 120% at 85% 140%, color-mix(in srgb, var(--link) 9%, transparent), transparent 70%); }
.brand { display: flex; align-items: center; gap: 10px; }
.mark { width: 24px; height: 24px; }
.brand-name { font-weight: 600; font-size: 18px; letter-spacing: -0.02em; }
.brand-dot { color: var(--mute); font-weight: 600; font-size: 18px; margin: 0 -2px; }
.brand-ver { font: 500 11.5px/1 var(--mono); color: var(--body); padding: 4px 7px; border-radius: 9999px; box-shadow: 0 0 0 1px var(--hairline); letter-spacing: 0; }
.brand-sep { color: var(--hairline-strong); font-weight: 300; font-size: 20px; }
.brand-en { font: 400 13px/1 var(--mono); color: var(--body); letter-spacing: 0; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.chip-local { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; line-height: 16px; color: var(--body); background: var(--canvas-soft); box-shadow: var(--ring); padding: 4px 10px; border-radius: 9999px; margin-right: 8px; }
.chip-local i { width: 6px; height: 6px; border-radius: 50%; background: #29bc9b; box-shadow: 0 0 0 3px color-mix(in srgb, #29bc9b 22%, transparent); }
.toplink { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--body); text-decoration: none; background: none; border: 0; cursor: pointer; padding: 6px 12px; border-radius: 9999px; }
.toplink:hover { color: var(--ink); background: var(--canvas-soft-2); }
.nav-btn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink); height: 28px; padding: 0 10px; border-radius: 6px; border: 0; background: var(--canvas); box-shadow: 0 0 0 1px var(--hairline); font-size: 14px; font-weight: 500; cursor: pointer; }
.nav-btn:hover { background: var(--canvas-soft-2); }
.theme-btn { width: 32px; height: 32px; display: inline-grid; place-items: center; border: 0; border-radius: 9999px; background: none; color: var(--body); cursor: pointer; margin-left: 4px; }
.theme-btn:hover { color: var(--ink); background: var(--canvas-soft-2); }
.theme-btn svg { width: 18px; height: 18px; }
.theme-btn .i-sun { display: none; }
[data-theme="dark"] .theme-btn .i-sun { display: block; }
[data-theme="dark"] .theme-btn .i-moon { display: none; }

/* 布局 */
.layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 24px; padding: 24px; max-width: 1720px; margin: 0 auto; align-items: start; }
.settings { position: sticky; top: 88px; max-height: calc(100vh - 112px); overflow: auto; display: grid; gap: 12px; padding: 1px 4px 1px 1px; scrollbar-width: thin; }
.panel { background: var(--canvas); border-radius: 8px; padding: 16px; box-shadow: var(--e2); }
.panel h2 { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 12px; color: var(--ink); }
.panel h2[data-eyebrow]::after { content: attr(data-eyebrow); margin-left: auto; font: 400 11px/16px var(--mono); color: var(--mute); letter-spacing: .06em; }
.panel h2 .ic { color: var(--body); }
.panel h2 label { cursor: text; }
/* 标题、图标、英文标注与右侧按钮垂直居中 */
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 0 12px; }
.panel-head h2 { flex: 1; margin: 0; }
.mini-actions { display: flex; gap: 4px; }
.mini-actions button { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; color: var(--body); font-size: 12px; cursor: pointer; padding: 2px 8px; border-radius: 6px; }
.mini-actions .ic { width: 13px; height: 13px; }
.mini-actions .lb { font-variant-numeric: tabular-nums; }
.mini-actions button:hover { background: var(--canvas-soft-2); color: var(--ink); }
.hint { font-size: 12px; line-height: 16px; color: var(--mute); margin: 0 0 8px; }

/* 场景预设 */
.presets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.preset { text-align: left; border: 0; background: var(--canvas); box-shadow: 0 0 0 1px var(--hairline); border-radius: 8px; padding: 10px; cursor: pointer; display: grid; gap: 4px; transition: box-shadow .15s, background .15s; }
.preset:hover { box-shadow: 0 0 0 1px var(--hairline-strong); }
.preset { position: relative; }
.preset[aria-checked="true"] { box-shadow: 0 4px 14px -8px rgba(124, 58, 237, .45); background: var(--canvas-soft); }
/* 选中：彩色渐变边框（伪元素加遮罩，只露出 1.5px 边框，不改变卡片尺寸） */
.preset[aria-checked="true"]::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: linear-gradient(135deg, #0070f3, #7c3aed 40%, #ec4899 70%, #f59e0b);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); }
.preset b { font-weight: 600; font-size: 13px; letter-spacing: -0.02em; margin-top: 4px; }
.preset small { color: var(--mute); font-size: 11.5px; line-height: 15px; }
.swatch { height: 18px; border-radius: 4px; background: #fbfbfa; box-shadow: inset 0 0 0 1px #ebebeb; display: flex; align-items: center; gap: 4px; padding: 0 6px; }
.swatch span { height: 5px; border-radius: 3px; background: #d4d4d4; }

/* 样式示意（表示输出效果，保持浅色） */
.sty { display: inline-block; width: 28px; height: 11px; border-radius: 6px; vertical-align: -1px; flex: none; }
.sty-label { background: #ECEBFC; box-shadow: inset 0 0 0 1px #d9d6fa; }
.sty-background { background: #F4F2EC; box-shadow: inset 0 0 0 1px #e1ddd2; border-radius: 2px; }
.sty-replace { background: #F4F2EC; border-radius: 2px; position: relative; }
.sty-replace::after { content: "姓名1"; position: absolute; left: 2px; top: -3px; font-size: 9px; color: #333; }
.sty-mosaic { border-radius: 2px; background: conic-gradient(#b9b4a9 25%, #d8d3c8 0 50%, #a19c92 0 75%, #cbc6bb 0) 0 0 / 6px 6px; }
.sty-hatch { border-radius: 2px; background: repeating-linear-gradient(45deg, #787c82 0 1.5px, #ecece9 1.5px 5px); }
.sty-inpaint { border-radius: 2px; background: linear-gradient(90deg, #efe9da, #f3eee2); }
.sty-black { border-radius: 2px; background: #111; box-shadow: inset 0 0 0 1px #333; }

/* 字段分组 */
.group { border-top: 1px solid var(--hairline); padding: 10px 0 4px; }
.group:first-child { border-top: 0; padding-top: 0; }
.group-title { display: flex; align-items: center; gap: 8px; font: 400 11px/16px var(--mono); color: var(--mute); letter-spacing: .06em; margin: 0 0 4px; }
.group-title i { width: 6px; height: 6px; border-radius: 50%; }
.ent { display: grid; grid-template-columns: 16px minmax(0, 1fr) 136px; align-items: center; gap: 10px; padding: 4px 0; }
.ent label { cursor: pointer; font-size: 14px; line-height: 20px; }

.ent.off label { color: var(--mute); }
.ent.off .style-pick { opacity: .4; }
.style-pick { position: relative; }
.style-na { height: 28px; display: flex; align-items: center; padding: 0 10px; font-size: 12.5px; color: var(--mute); border-radius: 6px; box-shadow: 0 0 0 1px var(--hairline); }
.ent.off .style-na { opacity: .4; }
.style-pick .dd-trigger { width: 100%; height: 28px; padding: 0 6px 0 40px; gap: 4px; font-size: 12.5px; }
.style-pick .sty { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); pointer-events: none; }


/* 表单 */
/* 高度：最少两行、最多八行文字（加上下内边距），拖动只在此范围内；词多时框内滚动 */
textarea { display: block; width: 100%; resize: vertical; border: 0; box-shadow: 0 0 0 1px var(--hairline); border-radius: 6px; padding: 10px 12px; background: var(--canvas); font-size: 14px; line-height: 20px; min-height: calc(2 * 20px + 2 * 10px); max-height: calc(8 * 20px + 2 * 10px); overflow-y: auto; }
textarea:focus, input[type=password]:focus, select:focus { outline: none; box-shadow: 0 0 0 1px var(--hairline-strong), 0 0 0 4px color-mix(in srgb, var(--link) 18%, transparent); }
.opt-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; }
.opt-label { font-size: 14px; display: grid; }
.opt-label small { color: var(--mute); font-size: 12px; line-height: 16px; }
.opt-row .dd-trigger { width: 152px; height: 32px; }
.opt-row input[type=password] { height: 32px; background: var(--canvas); border: 0; box-shadow: 0 0 0 1px var(--hairline); border-radius: 6px; padding: 0 12px; font-size: 13px; width: 152px; }
.seg { display: inline-flex; background: var(--canvas-soft-2); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; height: 26px; padding: 0 12px; border-radius: 6px; font-size: 13px; cursor: pointer; color: var(--body); }
.seg button:hover { color: var(--ink); }
.seg button[aria-checked="true"] { background: var(--canvas); color: var(--ink); box-shadow: var(--e2); font-weight: 500; }
.switch { appearance: none; width: 32px; height: 18px; border-radius: 9999px; background: var(--hairline); box-shadow: inset 0 0 0 1px var(--hairline-strong); position: relative; cursor: pointer; transition: background .15s; flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch:checked { background: var(--primary); box-shadow: none; }
.switch:checked::after { transform: translateX(14px); background: var(--on-primary); }
.switch-row { cursor: pointer; }

/* 按钮：应用内统一用 6px 圆角 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; border-radius: 6px; padding: 0 12px; font-size: 14px; font-weight: 500; border: 0; background: var(--canvas); box-shadow: 0 0 0 1px var(--hairline); cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap; transition: background .15s, box-shadow .15s; }
.btn:hover { background: var(--canvas-soft-2); }
.btn.primary { background: var(--primary); color: var(--on-primary); box-shadow: none; }
.btn.primary:hover { background: color-mix(in srgb, var(--primary) 85%, var(--canvas)); }
.btn.lg { height: 40px; padding: 0 16px; font-size: 15px; gap: 8px; }
.btn.lg .ic { width: 18px; height: 18px; }
.btn.danger { color: var(--error); box-shadow: 0 0 0 1px color-mix(in srgb, var(--error) 35%, transparent); }
.btn.danger:hover { background: var(--error-soft); box-shadow: 0 0 0 1px color-mix(in srgb, var(--error) 30%, transparent); }

/* 上传区：全页唯一使用多色渐变的地方 */
.workspace { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }  /* 列宽不被长文件名等不折行内容撑开 */
.dropzone { position: relative; overflow: hidden; background: var(--canvas); border-radius: 12px; box-shadow: var(--e4); min-height: 380px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 260px); align-items: center; gap: 40px; padding: 56px; cursor: pointer; isolation: isolate; transition: box-shadow .2s; }
.dropzone::after { content: ""; position: absolute; inset: 10px; border-radius: 8px; border: 1px dashed transparent; transition: border-color .2s; pointer-events: none; }
.dropzone:hover::after, .dropzone.over::after { border-color: var(--hairline-strong); }
.dropzone.over { box-shadow: 0 0 0 2px var(--primary), var(--e4); }
.mesh { position: absolute; inset: -20% -10% auto 35%; height: 140%; z-index: -1; filter: blur(60px) saturate(1.1); opacity: .5; pointer-events: none;
  background:
    radial-gradient(38% 42% at 30% 30%, #007cf0 0%, transparent 70%),
    radial-gradient(34% 40% at 58% 22%, #00dfd8 0%, transparent 70%),
    radial-gradient(36% 40% at 72% 52%, #ff0080 0%, transparent 70%),
    radial-gradient(34% 38% at 44% 64%, #7928ca 0%, transparent 70%),
    radial-gradient(30% 34% at 84% 80%, #f9cb28 0%, transparent 70%),
    radial-gradient(28% 30% at 64% 84%, #ff4d4d 0%, transparent 70%); }
[data-theme="dark"] .mesh { opacity: .35; }
.drop-text { position: relative; }
.drop-text .eyebrow { display: inline-block; margin-bottom: 14px; }
.drop-text h1 { font-size: 36px; line-height: 44px; font-weight: 600; letter-spacing: -0.04em; margin: 0 0 12px; }
.drop-text p { color: var(--body); font-size: 14px; line-height: 24px; margin: 0; max-width: 52em; }
.drop-note { font-size: 12px !important; line-height: 20px !important; color: var(--mute) !important; max-width: 60em; }
.cta-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 24px 0 20px; }
.cta-hint { font-size: 13px; color: var(--mute); }
.formats { display: flex; flex-wrap: wrap; gap: 6px; margin: 20px 0 14px; }
.formats span { font: 400 11px/16px var(--mono); color: var(--body); background: var(--canvas-soft); box-shadow: var(--ring); border-radius: 9999px; padding: 2px 8px; }
.drop-art { display: grid; place-items: center; position: relative; order: 2; }
/* 示意图：液态玻璃——后面两团蓝紫光晕，文档是一张磨砂半透明玻璃片，带边缘高光与斜向反光 */
.drop-art::before, .drop-art::after { content: ""; position: absolute; border-radius: 50%; filter: blur(28px); pointer-events: none; z-index: 0; }
.drop-art::before { width: 170px; height: 170px; left: -6px; top: 8px; background: radial-gradient(circle at 40% 40%, color-mix(in srgb, var(--link) 55%, transparent), transparent 70%); }
.drop-art::after { width: 150px; height: 150px; right: -14px; bottom: 0; background: radial-gradient(circle at 50% 50%, rgba(139, 92, 246, .45), transparent 70%); }
.sheet { --glass-bg: rgba(255, 255, 255, .5); --glass-edge: rgba(255, 255, 255, .85); --glass-line: rgba(15, 23, 42, .1);
  position: relative; z-index: 1; overflow: hidden; width: 220px; aspect-ratio: 1 / 1.3; border-radius: 14px; padding: 26px 22px; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 12px 8px; transform: rotate(3deg);
  background: linear-gradient(145deg, rgba(255, 255, 255, .35), rgba(255, 255, 255, .08)), var(--glass-bg);
  -webkit-backdrop-filter: blur(16px) saturate(180%); backdrop-filter: blur(16px) saturate(180%);
  box-shadow: inset 0 0 0 1px var(--glass-edge), inset 1px 1px 0 1px rgba(255, 255, 255, .5), inset -1px -1px 0 rgba(15, 23, 42, .06), 0 20px 40px -12px rgba(15, 23, 42, .25), 0 2px 6px rgba(15, 23, 42, .06); }
.sheet::before { content: ""; position: absolute; inset: -40% -60%; pointer-events: none; transform: rotate(-18deg);
  background: linear-gradient(100deg, transparent 38%, rgba(255, 255, 255, .55) 46%, rgba(255, 255, 255, .12) 52%, transparent 60%); }
.sheet > * { position: relative; }
.sheet .ln { height: 7px; border-radius: 4px; background: var(--glass-line); }
[data-theme="dark"] .sheet { --glass-bg: rgba(255, 255, 255, .06); --glass-edge: rgba(255, 255, 255, .14); --glass-line: rgba(255, 255, 255, .16);
  box-shadow: inset 0 0 0 1px var(--glass-edge), inset 1px 1px 0 1px rgba(255, 255, 255, .06), 0 20px 40px -12px rgba(0, 0, 0, .7); }
[data-theme="dark"] .sheet::before { background: linear-gradient(100deg, transparent 38%, rgba(255, 255, 255, .12) 46%, rgba(255, 255, 255, .03) 52%, transparent 60%); }
[data-theme="dark"] .sheet .pill, [data-theme="dark"] .sheet .hatch { filter: brightness(.85) saturate(.9); }
.w80 { width: 80%; } .w70 { width: 70%; } .w60 { width: 60%; } .w50 { width: 50%; } .w40 { width: 40%; } .w30 { width: 30%; }
.sheet .pill { font-size: 10px; line-height: 16px; padding: 0 8px; background: #ECEBFC; color: #3C3489; border-radius: 8px; margin-top: -4px; }
.sheet .hatch { width: 36%; height: 14px; margin-top: -3px; border-radius: 2px; background: repeating-linear-gradient(45deg, #787c82 0 1.5px, #ecece9 1.5px 5px); }

/* 任务 */
.job { background: var(--canvas); border-radius: 12px; padding: 20px 24px 24px; box-shadow: var(--e4); }
.job-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.job-title { display: flex; gap: 12px; align-items: center; min-width: 0; }
/* 文件名再长也不撑开面板：信息列可收缩，文件名、说明单行省略（悬停看全文） */
.job-info { flex: 1 1 auto; min-width: 0; }
.file-kind { flex: none; }
.progress-text { gap: 12px; }
.progress-text #progress-msg { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-text #progress-pct { flex: none; }
.file-kind { font: 500 11px/1 var(--mono); background: var(--canvas-soft-2); color: var(--body); box-shadow: var(--ring); border-radius: 6px; padding: 10px 8px; letter-spacing: .04em; }
.job-name { font-weight: 600; font-size: 16px; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46ch; }
.job-meta { font-size: 13px; color: var(--mute); }
.job-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.progress { margin-top: 20px; }
.progress-bar { height: 4px; background: var(--canvas-soft-2); border-radius: 9999px; overflow: hidden; }
.progress-bar span { display: block; height: 100%; background: linear-gradient(90deg, #0070F3, #7C3AED 45%, #EC4899 75%, #F59E0B); clip-path: inset(0 100% 0 0 round 9999px); transition: clip-path .4s ease; }
.progress-text { display: flex; justify-content: space-between; font-size: 13px; color: var(--body); margin-top: 8px; }
.alert { margin-top: 16px; background: var(--error-soft); color: var(--error-deep); border-radius: 6px; padding: 10px 14px; font-size: 14px; box-shadow: 0 0 0 1px color-mix(in srgb, var(--error) 25%, transparent); }

/* 结果查看 */
.result { margin-top: 16px; }
.viewer-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 4px 0 12px; }
.check-inline { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; color: var(--body); cursor: pointer; }

.pager { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.pager .num { font-size: 13px; color: var(--body); min-width: 64px; text-align: center; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9999px; border: 0; background: var(--canvas); box-shadow: 0 0 0 1px var(--hairline); cursor: pointer; font-size: 17px; line-height: 1; color: var(--ink); }
.icon-btn:hover:not(:disabled) { background: var(--canvas-soft-2); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.viewer-wrap { display: grid; grid-template-columns: 92px minmax(0, 1fr) 300px; gap: 12px; height: calc(100vh - 260px); min-height: 520px; }
.thumbs { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 2px; scrollbar-width: thin; }
.thumb { position: relative; flex: none; height: 112px; border: 0; border-radius: 6px; overflow: hidden; background: var(--stage); box-shadow: var(--ring); cursor: pointer; padding: 0; transition: box-shadow .15s; }
.thumb:hover { box-shadow: 0 0 0 1px var(--hairline-strong); }
.thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.thumb[aria-current="true"] { box-shadow: 0 0 0 2px var(--primary); }
.thumb .tn { position: absolute; right: 4px; bottom: 4px; font: 500 10px/1 var(--mono); background: var(--primary); color: var(--on-primary); padding: 3px 5px; border-radius: 4px; }
.thumb .tc { position: absolute; left: 4px; top: 4px; font: 500 10px/1 var(--mono); background: var(--canvas); color: var(--ink); box-shadow: var(--ring); padding: 3px 5px; border-radius: 9999px; }
.viewer-pane { position: relative; min-height: 0; min-width: 0; }
/* flex + margin:auto 居中：放大后内容超出时仍能滚动到左、上边缘（grid 居中会被裁掉） */
.viewer { height: 100%; background-color: var(--stage); border-radius: 8px; box-shadow: var(--ring); overflow: auto; display: flex; padding: 12px 12px 56px; position: relative; overscroll-behavior: contain;
  background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--hairline-strong) 45%, transparent) 1px, transparent 0); background-size: 16px 16px; }
.stage { position: relative; margin: auto; flex: none; line-height: 0; box-shadow: var(--e5); border-radius: 2px; user-select: none; }
.stage img { display: block; }
#img-after { width: var(--page-w, auto); height: auto; max-width: none; }
/* 缩放工具条：悬浮在画布下沿的磨砂胶囊（与对比手柄的玻璃质感呼应），紧贴页面下方 */
.zoombar { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 2; display: flex; align-items: center; gap: 2px; padding: 3px;
  border-radius: 9999px; background: color-mix(in srgb, var(--canvas) 78%, transparent);
  -webkit-backdrop-filter: blur(12px) saturate(170%); backdrop-filter: blur(12px) saturate(170%);
  box-shadow: 0 0 0 1px var(--hairline), inset 0 1px 0 var(--zb-hi), 0 1px 2px rgba(0, 0, 0, .06), 0 8px 24px -8px rgba(0, 0, 0, .22); }
.zoombar button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 30px; min-width: 30px; padding: 0 8px; border: 0; border-radius: 9999px;
  background: none; color: var(--body); font-size: 13px; line-height: 1; cursor: pointer; transition: background .12s ease, color .12s ease; }
.zoombar button .ic { width: 16px; height: 16px; }
.zoombar button:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); }
.zoombar button:active:not(:disabled) { background: color-mix(in srgb, var(--ink) 11%, transparent); }
.zoombar button:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.zoombar button:disabled { color: var(--mute); opacity: .55; cursor: default; }
.zoombar #zoom-level { min-width: 52px; font: 500 12px/1 var(--mono); color: var(--ink); letter-spacing: -.01em; }
.zoombar .zfit { padding: 0 10px 0 8px; font-weight: 500; }
.zsep { width: 1px; height: 16px; background: var(--hairline); margin: 0 3px; }
.zoombar #pan-tool[aria-pressed="true"] { background: var(--ink); color: var(--canvas); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .zoombar { background: var(--canvas); } }
:root { --zb-hi: rgba(255, 255, 255, .6); }  /* 工具条上沿高光 */
:root[data-theme="dark"] { --zb-hi: rgba(255, 255, 255, .07); }
/* 手形拖动：拖动画布平移；此时点击不移动对比分隔线 */
.viewer.pan, .viewer.pan .stage { cursor: grab; }
.viewer.panning, .viewer.panning .stage { cursor: grabbing; }
.viewer.pan .handle { pointer-events: none; }
.viewer.panning { user-select: none; }
.before-clip { position: absolute; inset: 0; overflow: hidden; clip-path: inset(0 50% 0 0); }
.before-clip img { width: 100%; height: 100%; max-height: none; }
.boxes { position: absolute; inset: 0; pointer-events: none; }
.box { position: absolute; border: 1.5px solid var(--bc, var(--link)); border-radius: 3px; background: color-mix(in srgb, var(--bc, var(--link)) 8%, transparent); transition: opacity .15s; }
.box.dim { opacity: .12; }
/* 复核：在页面上拖出新框，点选后拖动、拉伸或删除 */
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; gap: 5px; }
.btn.sm .ic { width: 14px; height: 14px; }
#btn-review[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); box-shadow: none; }
/* 复核栏一行（桌面与平板）：状态 → 框类型、删除所选 → 快捷键、更多、完成复核 → 放弃修改、保存；手机另排（见下） */
.review-bar { position: relative; display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 8px; margin: 0 0 12px; border-radius: 10px; background: var(--canvas-soft); box-shadow: var(--ring); font-size: 13px; }
.review-bar[hidden] { display: none; }
.rv-row { display: contents; }
/* rv-break 在桌面上是分组的细竖线，手机上用作换行 */
.rv-break { flex: none; width: 1px; height: 18px; margin: 0 4px; background: var(--hairline); }
.rv-status { display: flex; align-items: center; gap: 8px; flex: 0 1 auto; min-width: 0; margin-right: 6px; }
.rv-mode { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px 0 6px; border-radius: 9999px; font-size: 12px; font-weight: 500; white-space: nowrap; flex: none; cursor: help;
  color: var(--link-deep); background: color-mix(in srgb, var(--link) 12%, transparent); }
.rv-mode .ic { width: 13px; height: 13px; }
.rv-mode.locked { color: var(--warning-deep); background: var(--warning-soft); }
.rv-mode:focus-visible { outline: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--link) 45%, transparent); }
.rv-hint { color: var(--mute); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-dirty { color: var(--mute); white-space: nowrap; flex: none; }
.rv-dirty.on { color: var(--warning-deep); font-weight: 500; }
.rv-dirty.on::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: currentColor; vertical-align: 1px; }
.rv-hint:has(+ .rv-dirty.on) { display: none; }  /* 有未保存的修改时只显示修改数，腾出位置 */
.rv-type { display: inline-flex; align-items: center; gap: 6px; color: var(--body); white-space: nowrap; }
.rv-type .dd-trigger { height: 28px; width: 160px; }
/* 桌面与平板：框类型与按钮铺满整行，下拉占的份额大一些，四个按钮平分其余宽度（不窄于自身文字） */
.rv-type { flex: 2 1 0; min-width: min-content; }
.rv-type .dd-trigger { flex: 1; width: auto; min-width: 170px; }
#rv-del, #rv-finish, #rv-cancel, #rv-save { flex: 1 1 0; }
.btn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
.btn.danger[aria-disabled="true"]:hover { background: var(--canvas); }
.icon-btn.sm { width: 28px; height: 28px; border-radius: 6px; }
.icon-btn.sm .ic { width: 15px; height: 15px; }
.icon-btn[aria-expanded="true"] { background: var(--canvas-soft-2); box-shadow: 0 0 0 1px var(--hairline-strong); }
.rv-sep { width: 1px; height: 18px; margin: 0 4px; background: var(--hairline); }
#rv-keys { margin-left: 4px; }  /* 两个小图标在最右侧，与保存隔开一点 */

/* 快捷键卡片与“更多”菜单：挂在复核栏右下 */
.rv-pop { position: absolute; top: calc(100% + 6px); right: 6px; z-index: 50; padding: 10px 12px; border-radius: 10px; background: var(--canvas); box-shadow: var(--e5); font-size: 12.5px; max-width: min(380px, calc(100vw - 32px)); animation: dd-in .12s ease-out; }
.rv-pop[hidden] { display: none; }
.kbd-list { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; margin: 0; align-items: center; }
.kbd-list dt { white-space: nowrap; color: var(--ink); font-weight: 500; }
.kbd-list dd { margin: 0; color: var(--body); }
kbd { display: inline-block; min-width: 18px; padding: 1px 5px; border-radius: 4px; font: 500 11px/16px var(--mono); text-align: center; color: var(--ink); background: var(--canvas-soft-2); box-shadow: inset 0 -1px 0 var(--hairline-strong), 0 0 0 1px var(--hairline); }
.rv-menu { padding: 4px; width: 300px; }
.rv-menu button { display: flex; gap: 10px; align-items: flex-start; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: none; text-align: left; font: inherit; font-size: 13px; color: var(--ink); cursor: pointer; }
.rv-menu button:hover, .rv-menu button:focus-visible { background: var(--canvas-soft-2); outline: none; }
.rv-menu button[hidden] { display: none; }
.rv-menu button:disabled { opacity: .45; cursor: default; }
.rv-menu button .ic { margin-top: 1px; color: var(--body); }
.rv-menu button span { display: grid; gap: 2px; }
.rv-menu small { color: var(--mute); font-size: 12px; line-height: 16px; }
/* 平板竖屏等中等宽度：收窄框类型下拉，保存按钮只写“保存”，让第二行放得下 */
/* 按复核栏自身的宽度逐级收起（有无侧栏时栏宽不同，不能按窗口宽度判断）：先收提示，再把模式标签缩成图标、收窄框类型，
   最窄时隐藏“新框类型”字样，完成复核只留图标，保存只写“保存” */
.review-bar { container-type: inline-size; }
@container (max-width: 960px) { .rv-hint, #rv-type-label { display: none; } .rv-type .dd-trigger { min-width: 190px; } }
@container (max-width: 860px) {
  .rv-type .dd-trigger { min-width: 150px; }
  .rv-mode { padding: 0 5px; } .rv-mode #rv-mode-text { display: none; }
}
@container (max-width: 740px) {
  .rv-long { display: none; }
  .rv-type .dd-trigger { min-width: 120px; }
  #rv-finish { flex: none; padding: 0; width: 28px; } #rv-finish .rv-fin-text { display: none; }
}
/* 手机：第二行框类型（占满）与快捷键、更多两个图标；第三行删除所选、放弃修改、保存；完成复核单独一行 */
@media (max-width: 640px) {
  .review-bar { flex-direction: row; flex-wrap: wrap; padding: 8px; gap: 8px; }
  .rv-row { display: contents; }
  .rv-status { order: 1; flex-basis: 100%; }
  .rv-type { order: 2; flex: 1 1 0; min-width: 0; }
  .rv-type .dd-trigger { flex: 1; width: auto; min-width: 0; }
  #rv-keys { order: 3; margin-left: 0; } #rv-more { order: 4; }
  .rv-sep { order: 5; flex-basis: 100%; width: auto; height: 0; margin: 0; }
  #rv-del { order: 6; margin-left: 0; flex: none; } #rv-cancel { order: 7; flex: none; }
  #rv-save { order: 8; flex: 1; min-width: 0; }
  .rv-long { display: inline; }
  #rv-type-label, .rv-mode #rv-mode-text, .rv-hint, #rv-finish .rv-fin-text { display: revert; }
  .rv-mode { padding: 0 8px 0 6px; }
  #rv-finish { width: auto; padding: 0 10px; }
  .rv-break { order: 9; flex-basis: 100%; width: auto; height: 0; margin: 0; }
  .review-bar:has(#rv-finish[hidden]) .rv-break { display: none; }
  #rv-finish { order: 10; flex: 1; }
}
@media (max-width: 420px) {
  .review-bar { gap: 8px 6px; }
  #rv-del, #rv-cancel, #rv-save { padding: 0 8px; gap: 4px; }
}
@media (max-width: 380px) { .rv-long { display: none; } }  /* 很窄的手机上保存按钮只写“保存” */
.btn:disabled { opacity: .4; cursor: default; }
.btn[aria-busy="true"] { cursor: progress; opacity: .85; }
.dl-text { font-variant-numeric: tabular-nums; }
.stage.reviewing .boxes { pointer-events: auto; cursor: crosshair; }
.stage.reviewing .box { cursor: pointer; background: color-mix(in srgb, var(--bc, var(--link)) 14%, transparent); }
.stage.reviewing .box.edit { cursor: move; }
.box.new { border-style: dashed; }
.box.sel { border-width: 2px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--bc, var(--link)) 30%, transparent); z-index: 1; }
.box .rs { position: absolute; right: -5px; bottom: -5px; width: 10px; height: 10px; border-radius: 2px; background: var(--canvas); box-shadow: 0 0 0 1.5px var(--bc, var(--link)); cursor: nwse-resize; }
.viewer.pan .stage.reviewing .boxes { pointer-events: none; }
.handle { position: absolute; top: 0; bottom: 0; left: 50%; width: 0; cursor: ew-resize; touch-action: none; }
/* 手指可按的区域比分隔线宽 */
.handle::after { content: ""; position: absolute; top: 0; bottom: 0; left: -22px; width: 44px; }
.before-clip { will-change: clip-path; }
/* 分隔线与手柄：液态玻璃。轻度模糊并提饱和、提亮，下面的页面内容隐约透出；
   边缘一圈亮边、内侧极淡的暗边表现玻璃厚度，上沿镜面高光，底部反光，外加柔和投影 */
.handle::before { content: ""; position: absolute; top: 0; bottom: 0; left: -2px; width: 4px;
  background: linear-gradient(90deg, rgba(255, 255, 255, .15), rgba(255, 255, 255, .95) 50%, rgba(255, 255, 255, .15));
  -webkit-backdrop-filter: blur(2px) saturate(180%) brightness(1.08); backdrop-filter: blur(2px) saturate(180%) brightness(1.08);
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .12), 0 0 14px rgba(0, 0, 0, .10); }
.handle .grip { position: absolute; top: 50%; left: 0; width: 30px; height: 50px; transform: translate(-50%, -50%);
  display: grid; place-items: center; border-radius: 9999px; color: #111; isolation: isolate;
  background: linear-gradient(180deg, rgba(255, 255, 255, .42) 0%, rgba(255, 255, 255, .10) 55%, rgba(255, 255, 255, .22) 100%);
  -webkit-backdrop-filter: blur(3px) saturate(190%) brightness(1.08); backdrop-filter: blur(3px) saturate(190%) brightness(1.08);
  box-shadow:
    inset 0 0 0 1.5px rgba(255, 255, 255, .75),   /* 边缘亮圈 */
    inset 0 0 6px 1px rgba(0, 0, 0, .08),         /* 玻璃厚度 */
    inset 0 1px 1px rgba(255, 255, 255, .95),     /* 上沿高光 */
    inset 0 -6px 8px -6px rgba(255, 255, 255, .9), /* 底部反光 */
    0 0 0 .5px rgba(0, 0, 0, .18),                 /* 外轮廓 */
    0 2px 6px rgba(0, 0, 0, .10), 0 12px 30px -8px rgba(0, 0, 0, .36);
  transition: transform .18s cubic-bezier(.2, .8, .2, 1), box-shadow .18s ease, background .18s ease; }
/* 镜面高光：上半部一块椭圆形亮斑 */
.handle .grip::before { content: ""; position: absolute; inset: 2px 4px auto; height: 42%; border-radius: 9999px; z-index: -1; pointer-events: none;
  background: radial-gradient(120% 100% at 40% 0%, rgba(255, 255, 255, .85), rgba(255, 255, 255, 0) 72%); }
.handle .grip .ic { width: 16px; height: 16px; stroke-width: 2.3; filter: drop-shadow(0 0 2px rgba(255, 255, 255, .95)) drop-shadow(0 0 1px #fff); }
.handle:hover .grip { transform: translate(-50%, -50%) scale(1.07);
  background: linear-gradient(180deg, rgba(255, 255, 255, .52) 0%, rgba(255, 255, 255, .16) 55%, rgba(255, 255, 255, .3) 100%);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .85), inset 0 0 6px 1px rgba(0, 0, 0, .08), inset 0 1px 1px #fff, inset 0 -6px 8px -6px #fff,
    0 0 0 .5px rgba(0, 0, 0, .2), 0 3px 8px rgba(0, 0, 0, .12), 0 16px 34px -8px rgba(0, 0, 0, .42); }
.handle:active .grip { transform: translate(-50%, -50%) scale(.95); }
.handle:focus-visible { outline: none; }
.handle:focus-visible .grip { box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .75), inset 0 1px 1px rgba(255, 255, 255, .95),
    0 0 0 2px rgba(255, 255, 255, .9), 0 0 0 4px #0070f3, 0 12px 30px -8px rgba(0, 0, 0, .36); }
/* 不支持背景模糊的浏览器：退回不透明的白色胶囊 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .handle::before { background: #fff; width: 2px; left: -1px; }
  .handle .grip { background: #fff; }
}
/* 对比视图两个上角的“原件 / 脱敏后”标签 */
.cmp-label { position: absolute; top: 8px; z-index: 2; pointer-events: none; font: 500 10.5px/1 var(--sans); letter-spacing: .02em; color: #fff;
  padding: 4px 7px; border-radius: 9999px; background: rgba(23, 23, 23, .56); box-shadow: 0 0 0 1px rgba(255, 255, 255, .12); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.cmp-l { left: 8px; }
.cmp-r { right: 8px; }
.stage:has(.handle:active) .cmp-label { opacity: 0; transition: opacity .15s; }  /* 拖动分隔线时让出画面 */
.stage.mode-after .cmp-label, .stage.mode-before .cmp-label, .stage.reviewing .cmp-label, .stage.img-loading .cmp-label { display: none; }
/* 原件图加载完之前不显示原件层 */
.stage.before-loading .before-clip { visibility: hidden; }
.stage.mode-before.before-loading #img-after { visibility: hidden; }
@media (prefers-reduced-motion: reduce) { .handle .grip { transition: none; } }
.stage.mode-after .before-clip, .stage.mode-after .handle { display: none; }
.stage.mode-before .before-clip { clip-path: none !important; }
.stage.mode-before .handle, .stage.mode-before .boxes { display: none; }

.summary { background: var(--canvas-soft); border-radius: 8px; box-shadow: var(--ring); padding: 16px; overflow-y: auto; scrollbar-width: thin; }
.summary h3 { display: flex; align-items: center; gap: 6px; font: 400 11px/16px var(--mono); letter-spacing: .06em; color: var(--mute); margin: 0 0 8px; }
/* 可收起：标题行右侧按钮；收起后电脑上是 44px 窄条（按钮、图标、总处数竖排），单栏布局下只剩标题行 */
.viewer-wrap { transition: grid-template-columns .2s ease; }
.sum-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sum-head h3 { margin: 0; min-width: 0; }
.sum-mini { display: none; font-size: 12px; color: var(--body); white-space: nowrap; }
.sum-toggle { margin-left: auto; flex: none; display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--body); cursor: pointer; }
.sum-toggle:hover { background: var(--canvas); box-shadow: var(--ring); color: var(--ink); }
.sum-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.sum-toggle .ic { width: 15px; height: 15px; transition: transform .2s ease; }
.summary.off .sum-toggle .ic { transform: rotate(180deg); }
.viewer-wrap.sum-off { grid-template-columns: 92px minmax(0, 1fr) 44px; }
.summary.off { padding: 8px 0; overflow: hidden; }
.summary.off .sum-head { flex-direction: column; gap: 10px; margin: 0; }
.summary.off .sum-toggle { margin: 0; order: -1; }
.summary.off .sum-title { display: none; }
.summary.off .sum-mini { display: block; writing-mode: vertical-rl; letter-spacing: .04em; }
@media (prefers-reduced-motion: reduce) { .viewer-wrap, .sum-toggle .ic { transition: none; } }
.total { font-size: 13px; color: var(--body); margin-bottom: 12px; }
.total .num:first-child { font: 600 22px/28px var(--sans); letter-spacing: -0.03em; color: var(--ink); margin-right: 2px; }
.counts, .page-items { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 1px; }
.counts li { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 5px 8px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.counts li:hover { background: var(--canvas); box-shadow: var(--ring); }
.counts li.active { background: var(--canvas); box-shadow: 0 0 0 1px var(--primary); }
.counts i, .page-items i { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.counts .n { margin-left: auto; color: var(--body); font-size: 12px; }
.page-items li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--body); padding: 3px 8px; white-space: nowrap; }
/* 统计行一律单行显示，放不下时省略，悬停看全文 */
.counts .lb, .page-items .lb { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.counts .n, .page-items .src { flex: none; }
.total { white-space: nowrap; }
.page-items .src { margin-left: auto; font: 400 11px/16px var(--mono); color: var(--mute); }

/* 最近任务：表格式行 */
.history { background: var(--canvas); border-radius: 12px; padding: 16px 20px 8px; box-shadow: var(--e2); }
.history-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.history-head h2 { display: flex; align-items: center; gap: 8px; }
.history-head h2 .ic { color: var(--body); }
.history h2 { font-size: 16px; font-weight: 600; letter-spacing: -0.03em; margin: 0; }
.history ul { list-style: none; margin: 0; padding: 0; }
.history li { display: grid; grid-template-columns: 96px 1fr auto auto; gap: 16px; align-items: center; padding: 10px 0; border-top: 1px solid var(--hairline); font-size: 14px; }
.history li:first-child { border-top: 0; }
.history .when { color: var(--mute); font-size: 12px; }
.hist-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hist-name { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-meta { color: var(--mute); font-size: 12px; }
.status { font-size: 12px; line-height: 20px; padding: 0 8px; border-radius: 9999px; justify-self: start; }
.status.succeeded { background: var(--link-soft); color: var(--link-deep); }
.status.running, .status.queued { background: var(--warning-soft); color: var(--warning-deep); }
.status.failed { background: var(--error-soft); color: var(--error-deep); }
.history button { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; background: none; border: 0; color: var(--ink); cursor: pointer; font-size: 13px; font-weight: 500; padding: 4px 8px; border-radius: 6px; justify-self: end; }
.history button:hover { background: var(--canvas-soft-2); }
.history button.danger { color: var(--error); }
.history button.danger:hover { background: var(--error-soft); }

dialog { border: 0; border-radius: 12px; background: var(--canvas); color: var(--ink); padding: 24px; width: min(400px, 92vw); box-shadow: var(--e5); }
dialog::backdrop { background: rgba(0, 0, 0, .3); backdrop-filter: blur(2px); }
dialog h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 20px; font-weight: 600; letter-spacing: -0.03em; }
dialog input { width: 100%; height: 40px; border: 0; box-shadow: 0 0 0 1px var(--hairline); background: var(--canvas); border-radius: 6px; padding: 0 12px; margin: 8px 0 20px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dlg-danger h3 .ic { color: var(--error); }
.dlg-danger .hint { margin: 8px 0 24px; line-height: 20px; }
.btn.danger-solid { background: var(--error); color: #fff; box-shadow: none; }
.btn.danger-solid:hover { background: var(--error-deep); }
/* 深色下红底白字要足够对比：填充用较深的红，文字类红色仍用较亮的 --error */
[data-theme="dark"] .btn.danger-solid { background: #d93036; }
[data-theme="dark"] .btn.danger-solid:hover { background: #e5484d; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(16px); background: var(--canvas); color: var(--ink); box-shadow: var(--e5); padding: 12px 16px; border-radius: 8px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .settings { position: static; max-height: none; }
  .viewer-wrap { grid-template-columns: minmax(0, 1fr); height: auto; }
  .viewer-wrap.sum-off { grid-template-columns: minmax(0, 1fr); }
  .sum-toggle .ic { transform: rotate(-90deg); }
  .summary.off { padding: 10px 16px; }
  .summary.off .sum-head { flex-direction: row; gap: 8px; }
  .summary.off .sum-toggle { margin-left: auto; order: 0; }
  .summary.off .sum-toggle .ic { transform: rotate(90deg); }
  .summary.off .sum-title { display: inline; }
  .summary.off .sum-mini { writing-mode: horizontal-tb; }
  /* 单栏：画布高度取竖版 A4 按宽度放满时刚好的高度（容器宽减去左右内边距 12×2，再加上下 12 + 56），不超过屏高的 72% */
  .viewer-wrap { container-type: inline-size; }
  .viewer-pane { height: min(72vh, calc((100cqw - 24px) * 1.4142 + 68px)); }
  .thumbs { flex-direction: row; overflow-x: auto; }
  .thumb { width: 72px; height: 94px; }
  .dropzone { grid-template-columns: minmax(0, 1fr); padding: 32px 24px; min-height: 0; }
  .drop-text h1 { font-size: 28px; line-height: 36px; letter-spacing: -0.03em; }
  .drop-art { display: none; }
  .chip-local { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* API Key 按钮：已连接状态显示绿点 */
.key-dot { display: none; width: 7px; height: 7px; border-radius: 50%; background: #29bc9b; box-shadow: 0 0 0 3px color-mix(in srgb, #29bc9b 22%, transparent); }
#btn-key.connected .key-dot { display: inline-block; }
#btn-key.connected .ic { display: none; }
.dlg-actions .key-clear { margin-right: auto; }

/* 骨架屏：数据与图片加载完成前显示内容轮廓与流光；减少动态效果时不播放动画 */
:root { --skel-a: #f1f1f1; --skel-b: #e3e3e3; }
:root[data-theme="dark"] { --skel-a: #1b1b1e; --skel-b: #2a2a2f; }
.skel { display: block; border-radius: 6px; background: linear-gradient(90deg, var(--skel-a) 25%, var(--skel-b) 37%, var(--skel-a) 63%); background-size: 400% 100%; animation: skel 1.4s ease-in-out infinite; }
@keyframes skel { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .skel, .thumb.img-loading, .stage.img-loading { animation: none !important; } }
.sk-line { height: 10px; }
.sk-line.w30 { width: 30%; } .sk-line.w45 { width: 45%; } .sk-line.w50 { width: 50%; } .sk-line.w55 { width: 55%; } .sk-line.w60 { width: 60%; }
.sk-line.w65 { width: 65%; } .sk-line.w70 { width: 70%; } .sk-line.w75 { width: 75%; } .sk-line.w80 { width: 80%; } .sk-line.w90 { width: 90%; }
.sk-preset { display: grid; gap: 8px; padding: 10px; border-radius: 8px; box-shadow: 0 0 0 1px var(--hairline); }
.sk-bar { height: 16px; }
.sk-group { display: grid; gap: 12px; padding-top: 4px; }
.sk-ent { display: grid; grid-template-columns: 16px minmax(0, 1fr) 136px; align-items: center; gap: 10px; }
.sk-box { width: 16px; height: 16px; border-radius: 4px; }
.sk-pill { width: 100%; max-width: 136px; height: 28px; border-radius: 9999px; }
.history li.sk-hist { grid-template-columns: 96px 1fr 72px; }
.sk-col { display: grid; gap: 8px; }
.sk-hist .sk-pill { width: 72px; height: 22px; }
/* 打开任务时的结果区骨架 */
.sk-thumb { flex: none; height: 112px; border-radius: 6px; }
.sk-count { display: grid; grid-template-columns: 8px minmax(0, 1fr) 24px; gap: 10px; align-items: center; padding: 6px 0; }
.sk-count .skel:first-child { width: 8px; height: 8px; border-radius: 50%; }
.result.loading .viewer-bar { pointer-events: none; opacity: .5; }
.result.loading .zoombar { visibility: hidden; }
/* 图片下载完之前：缩略图与画布显示流光 */
.thumb.img-loading, .stage.img-loading { background: linear-gradient(90deg, var(--skel-a) 25%, var(--skel-b) 37%, var(--skel-a) 63%); background-size: 400% 100%; animation: skel 1.4s ease-in-out infinite; }
.thumb.img-loading img { opacity: 0; }
.stage.img-loading { height: calc(100% - 32px); max-height: 720px; width: auto; max-width: 100%; aspect-ratio: 1 / 1.414; }
.stage.img-loading img { opacity: 0; position: absolute; }
.stage.img-loading .handle, .stage.img-loading .before-clip, .stage.img-loading .boxes { display: none; }
/* 画布加载指示：盖在画布区正中（在画布外层，不会被分隔线裁切）。Vercel 风格的 12 条旋转指示器 */
.stage-loader { position: absolute; inset: 0 0 48px; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  pointer-events: none; opacity: 0; transition: opacity .15s ease .12s; font-size: 12.5px; color: var(--body); white-space: nowrap; }
.viewer-pane:has(.stage.img-loading) .stage-loader, .viewer-pane:has(.stage.mode-before.before-loading) .stage-loader { opacity: 1; }
.stage-loader #stage-loader-text { padding: 5px 10px; border-radius: 9999px; background: var(--canvas); box-shadow: var(--ring); }
.spinner { position: relative; width: 24px; height: 24px; }
.spinner i { position: absolute; left: 40%; top: 46.1%; width: 24%; height: 8%; border-radius: 6px; background: var(--ink); animation: spin-fade 1.2s linear infinite; }
.spinner i:nth-child(1) { transform: rotate(0deg) translate(146%); animation-delay: -1.2s; }
.spinner i:nth-child(2) { transform: rotate(30deg) translate(146%); animation-delay: -1.1s; }
.spinner i:nth-child(3) { transform: rotate(60deg) translate(146%); animation-delay: -1.0s; }
.spinner i:nth-child(4) { transform: rotate(90deg) translate(146%); animation-delay: -0.9s; }
.spinner i:nth-child(5) { transform: rotate(120deg) translate(146%); animation-delay: -0.8s; }
.spinner i:nth-child(6) { transform: rotate(150deg) translate(146%); animation-delay: -0.7s; }
.spinner i:nth-child(7) { transform: rotate(180deg) translate(146%); animation-delay: -0.6s; }
.spinner i:nth-child(8) { transform: rotate(210deg) translate(146%); animation-delay: -0.5s; }
.spinner i:nth-child(9) { transform: rotate(240deg) translate(146%); animation-delay: -0.4s; }
.spinner i:nth-child(10) { transform: rotate(270deg) translate(146%); animation-delay: -0.3s; }
.spinner i:nth-child(11) { transform: rotate(300deg) translate(146%); animation-delay: -0.2s; }
.spinner i:nth-child(12) { transform: rotate(330deg) translate(146%); animation-delay: -0.1s; }
@keyframes spin-fade { 0% { opacity: 1; } 100% { opacity: .15; } }
@media (prefers-reduced-motion: reduce) { .spinner i { animation: none; opacity: .5; } }

/* 标题与选项一律不折行：放不下时显示省略号（悬停看全文） */
.panel h2, .panel-head h2, .job-name, .job-meta, .summary h3, .history h2, dialog h3,
.opt-label, .opt-label small, .preset b, .preset small, .group-title, .ent label, .ent .lb,
.btn, .nav-btn, .seg button, .chip-local, .check-inline, .zoombar button, .pager .num,
.rv-hint, .rv-type, .rv-dirty, .rv-mode, .counts .lb, .page-items .lb, .hist-name, .hist-meta, .history .when,
.cta-hint, .eyebrow, .formats span, .tn, .tc, .total, .mini-actions button {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.opt-label { display: grid; min-width: 0; }
.opt-label > small { display: block; }
/* 带说明且控件较宽的选项（如出厂自检）：标签与说明占一行，控件单独一行、等分铺满 */
.opt-row.stack { flex-direction: column; align-items: stretch; gap: 8px; }
.opt-row.stack .seg { display: flex; width: 100%; }
.opt-row.stack .seg button { flex: 1 1 0; }
#btn-key { flex: none; }

/* ---------- 自定义组件（Vercel 风格） ---------- */
/* 下拉菜单：原生 select 只存值，不显示 */
.dd-native { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; overflow: hidden; clip-path: inset(50%); }
.dd-trigger { display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; height: 32px; padding: 0 10px 0 12px; border: 0; border-radius: 6px; background: var(--canvas);
  box-shadow: 0 0 0 1px var(--hairline); color: var(--ink); font-size: 13px; cursor: pointer; text-align: left; transition: box-shadow .15s, background .15s; min-width: 0; }
.dd-trigger:hover:not(:disabled) { box-shadow: 0 0 0 1px var(--hairline-strong); }
.dd-trigger:focus-visible, .dd-trigger[aria-expanded="true"] { outline: none; box-shadow: 0 0 0 1px var(--hairline-strong), 0 0 0 4px color-mix(in srgb, var(--link) 18%, transparent); }
.dd-trigger:disabled { cursor: default; opacity: .5; }
.dd-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.dd-chev { width: 14px; height: 14px; flex: none; fill: none; stroke: var(--mute); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.dd-trigger[aria-expanded="true"] .dd-chev { transform: rotate(180deg); }
.dd-menu { position: fixed; z-index: 1000; padding: 4px; border-radius: 10px; background: var(--canvas); box-shadow: var(--e5); overflow-y: auto; outline: none; max-width: min(360px, calc(100vw - 16px));
  animation: dd-in .12s ease-out; scrollbar-width: thin; }
@keyframes dd-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.dd-item { display: flex; align-items: flex-start; gap: 8px; padding: 7px 10px 7px 8px; border-radius: 6px; font-size: 13px; line-height: 18px; color: var(--ink); cursor: pointer; user-select: none; }
.dd-item.active { background: var(--canvas-soft-2); }
.dd-item[aria-disabled="true"] { opacity: .45; cursor: default; }
.dd-check { width: 14px; height: 14px; flex: none; margin-top: 2px; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; visibility: hidden; }
.dd-item[aria-selected="true"] .dd-check { visibility: visible; }
.dd-item[aria-selected="true"] { font-weight: 500; }
.dd-text { display: grid; min-width: 0; }
.dd-text > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dd-text small { color: var(--mute); font-size: 11.5px; line-height: 16px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (prefers-reduced-motion: reduce) { .dd-menu { animation: none; } }

/* 复选框 */
input[type="checkbox"]:not(.switch) { appearance: none; -webkit-appearance: none; flex: none; width: 16px; height: 16px; margin: 0; border-radius: 4px; background: var(--canvas);
  box-shadow: inset 0 0 0 1px var(--hairline-strong); display: inline-grid; place-content: center; cursor: pointer; transition: background .12s, box-shadow .12s; }
input[type="checkbox"]:not(.switch)::after { content: ""; width: 9px; height: 5px; border-left: 2px solid var(--on-primary); border-bottom: 2px solid var(--on-primary); transform: translateY(-1px) rotate(-45deg) scale(0); transition: transform .12s; }
input[type="checkbox"]:not(.switch):checked { background: var(--primary); box-shadow: none; }
input[type="checkbox"]:not(.switch):checked::after { transform: translateY(-1px) rotate(-45deg) scale(1); }
input[type="checkbox"]:not(.switch):hover { box-shadow: inset 0 0 0 1px var(--ink); }
input[type="checkbox"]:not(.switch):checked:hover { box-shadow: none; }
input[type="checkbox"]:focus-visible, .switch:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--canvas), 0 0 0 4px color-mix(in srgb, var(--link) 45%, transparent); }

/* 悬停提示 */
.ui-tip { position: fixed; z-index: 1100; max-width: 320px; padding: 6px 10px; border-radius: 6px; background: var(--ink); color: var(--canvas); font-size: 12px; line-height: 18px;
  white-space: pre-line; pointer-events: none; box-shadow: 0 4px 12px rgba(0, 0, 0, .18); animation: tip-in .12s ease-out; }
@keyframes tip-in { from { opacity: 0; transform: translateY(2px); } }
@media (prefers-reduced-motion: reduce) { .ui-tip { animation: none; } }

/* 确认框 */
.ui-confirm { width: min(400px, 92vw); }
.ui-confirm .hint { margin: 8px 0 20px; }

/* 对话框里的次要按钮（取消等）：不加线框，浅灰底，与右侧主按钮同高 */
.dlg-actions .btn { height: 34px; }
.dlg-actions .btn.ghost { box-shadow: none; background: var(--canvas-soft-2); }
.dlg-actions .btn.ghost:hover { background: color-mix(in srgb, var(--canvas-soft-2) 70%, var(--hairline-strong)); }
.dlg-actions .btn.ghost.danger { background: transparent; color: var(--error); }
.dlg-actions .btn.ghost.danger:hover { background: var(--error-soft); }
.dlg-actions .btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--canvas), 0 0 0 4px color-mix(in srgb, var(--link) 45%, transparent); }

/* 顶部栏：链接与按钮不折行；手机宽度只显示图标（悬停与读屏仍有完整文字） */
.topbar, .topbar-right, .brand { min-width: 0; }
.toplink, .nav-btn, .brand, .brand-name { white-space: nowrap; flex: none; }
@media (max-width: 640px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .brand { gap: 6px; }
  .brand-ver, .brand-sep, .brand-en { display: none !important; }
  .topbar-right { gap: 4px; }
  .toplink .tl-text, .nav-btn .tl-text { display: none; }
  .toplink, .nav-btn { width: 32px; height: 32px; padding: 0; justify-content: center; }
  #btn-key.connected .ic { display: none; }
}
/* 文件框：视觉隐藏但保留在页面里（display:none 的文件框在部分手机浏览器上无法由按钮打开） */
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip-path: inset(50%); pointer-events: none; }
label.btn { user-select: none; }
/* 只在触屏设备上显示（手机、平板）：照片与拍照入口 */
.touch-only { display: none !important; }
@media (pointer: coarse) {
  .touch-only { display: inline-flex !important; }
  .cta-hint { display: none; }
}

/* 骨架屏（窄屏）：缩略图横排时按缩略图尺寸；画布高度随内容变化，按宽度与页面比例推算。放在最后以覆盖上面的通用规则 */
@media (max-width: 1100px) {
  .sk-thumb { width: 72px; height: 94px; }
  .stage.img-loading { width: min(100%, 320px); height: auto; max-height: none; }
}

/* 底部菜单（手机上“照片/图片”）：从底部弹出，两个大按钮 + 取消 */
dialog.bottom-sheet { width: min(520px, 100vw); max-width: 100vw; margin: auto auto 0; border-radius: 16px 16px 0 0; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); animation: sheet-in .2s ease-out; }
@keyframes sheet-in { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { dialog.bottom-sheet { animation: none; } }
dialog.bottom-sheet h3 { margin: 4px 4px 12px; font-size: 15px; }
.sheet-actions { display: grid; gap: 8px; margin-bottom: 10px; }
.sheet-item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 12px; background: var(--canvas-soft-2); cursor: pointer; font-size: 15px; font-weight: 500; color: var(--ink); user-select: none; }
.sheet-item:active { background: color-mix(in srgb, var(--canvas-soft-2) 70%, var(--hairline-strong)); }
.sheet-item .ic { width: 22px; height: 22px; }
.sheet-item span { display: grid; gap: 2px; min-width: 0; }
.sheet-item small { font-size: 12.5px; font-weight: 400; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-cancel { width: 100%; height: 44px; font-size: 15px; box-shadow: none; background: var(--canvas-soft-2); }

/* 对比视图：分隔线右侧（脱敏后）整体盖一层淡淡的蒙板，与左侧原件区分；遮盖框照常显示。页面图总是白纸，深浅主题用同一种深色蒙板 */
.after-mask { position: absolute; top: 0; bottom: 0; right: 0; left: var(--split, 50%); pointer-events: none; background: rgba(15, 23, 42, .06); display: none; }
.stage:not(.mode-after):not(.mode-before):not(.reviewing) .after-mask { display: block; }

/* 手机：任务操作两行两列铺满；查看方式单独一行，显示遮盖框与翻页在下一行左右两侧 */
@media (max-width: 640px) {
  .job-head { flex-direction: column; align-items: stretch; flex-wrap: nowrap; }
  .job-name { max-width: 100%; }
  .job-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; }
  .job-actions .btn { width: 100%; height: 40px; font-size: 14px; justify-content: center; }
  .job-actions .btn .ic { width: 16px; height: 16px; }
  .viewer-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px 12px; }
  .viewer-bar #seg-view { grid-column: 1 / -1; display: flex; width: 100%; }
  .viewer-bar #seg-view button { flex: 1 1 0; height: 32px; }
  .viewer-bar .check-inline { justify-self: start; }
  .viewer-bar .pager { justify-self: end; margin-left: 0; }
}

/* 手机：上传、处理中只剩“处理新文件”一个按钮时，占满整行、用醒目的蓝色 */
@media (max-width: 640px) {
  .job-actions:not(:has(> .btn:not([hidden]):not(#btn-new))) #btn-new {
    grid-column: 1 / -1; height: 44px; font-size: 15px; background: #0070f3; color: #fff; box-shadow: none;
  }
  .job-actions:not(:has(> .btn:not([hidden]):not(#btn-new))) #btn-new:hover { background: #0761d1; }
  .job-actions:not(:has(> .btn:not([hidden]):not(#btn-new))) #btn-new .ic { stroke: #fff; }
}
/* 滚到任务面板时不被固定的顶部栏挡住 */
#job { scroll-margin-top: 76px; }
/* 单栏布局（手机、平板）：滚到任务面板时，面板上边线正好贴在顶部栏下沿 */
@media (max-width: 1100px) { #job { scroll-margin-top: 64px; } }

