/* ============================================================
 * Wesley Annotation — components & layout
 * ============================================================ */

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 16px; border-radius: var(--r-md);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 500; white-space: nowrap; transition: background .14s, border-color .14s, transform .06s, box-shadow .14s;
}
.btn:hover { background: var(--surface-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: var(--r-sm); }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.btn-soft { background: var(--surface-2); border-color: var(--border); }
.btn-soft:hover { background: var(--surface-3); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.96); }
.btn-danger-soft { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn-danger-soft:hover { filter: brightness(.97); }
.link-btn { background: none; border: none; color: var(--primary); font-size: 12px; padding: 0; }
.link-btn:hover { text-decoration: underline; }

.icon-ghost {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--r-md); border: 1px solid transparent;
  background: transparent; color: var(--text-2); font-size: 18px;
}
.icon-ghost:hover { background: var(--surface-2); color: var(--text); }
.icon-ghost.sm { width: 28px; height: 28px; font-size: 15px; }

.chip-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
  border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); font-size: 12.5px; font-weight: 500;
}
.chip-btn:hover { background: var(--surface-2); color: var(--text); }
.chip-btn.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-700); }
.chip-btn i { font-size: 14px; }

.input, .select, input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], textarea, select {
  height: 38px; width: 100%; padding: 0 12px; border-radius: var(--r-md);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-size: 14px; transition: border-color .14s, box-shadow .14s;
}
textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input.sm, .select.sm { height: 32px; font-size: 13px; border-radius: var(--r-sm); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); }
.field > span { font-weight: 500; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form-error { background: var(--danger-soft); color: var(--danger); padding: 9px 12px; border-radius: var(--r-md); font-size: 13px; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 40px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border: none; background: transparent; color: var(--muted); border-radius: var(--r-sm); font-size: 16px; }
.pw-eye:hover { color: var(--text); background: var(--surface-2); }

.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 500; }

/* segmented language control */
.seg { display: inline-flex; padding: 2px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border); }
.seg button { border: none; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 5px; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- loading ---------- */
.loading-view { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border-strong); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- login ---------- */
.login-view { position: fixed; inset: 0; display: grid; grid-template-columns: 1.05fr 1fr; }
.login-aside {
  padding: 60px 56px; display: flex; flex-direction: column; justify-content: center; gap: 18px; color: #fff;
  background:
    radial-gradient(900px 500px at 20% 0%, rgba(124,124,246,.55), transparent 60%),
    radial-gradient(700px 500px at 90% 100%, rgba(99,102,241,.4), transparent 55%),
    linear-gradient(150deg, #4f46e5, #6d28d9 55%, #4338ca);
}
.login-brand { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 600; opacity: .95; }
.login-aside h1 { font-size: 32px; line-height: 1.2; margin: 8px 0 0; font-weight: 700; max-width: 12em; }
.login-aside > p { font-size: 14px; opacity: .85; line-height: 1.7; max-width: 28em; }
.login-points { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 12px; }
.login-points li { display: flex; align-items: center; gap: 11px; font-size: 14px; opacity: .92; }
.login-points i { width: 30px; height: 30px; border-radius: 9px; background: rgba(255,255,255,.16); font-size: 16px; }
.logo-mark { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 9px; background: rgba(255,255,255,.18); font-weight: 700; }
.logo-mark.sm { width: 28px; height: 28px; border-radius: 8px; background: var(--primary); color: #fff; font-size: 14px; }
.login-main { display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 26px 26px 22px; box-shadow: var(--shadow-lg); }
.login-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.login-card h2 { margin: 4px 0 2px; font-size: 22px; font-weight: 650; }
.login-card .muted { margin: 0 0 18px; font-size: 13px; }
.login-back { display: inline-block; margin-top: 16px; color: var(--muted); font-size: 13px; }
.login-back:hover { color: var(--primary); }

/* ---------- topbar ---------- */
.workbench { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.topbar {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h); display: flex; align-items: center; gap: 12px;
  padding: 0 14px; background: var(--surface); border-bottom: 1px solid var(--border); z-index: 30;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; font-size: 15px; }
.brand-name { letter-spacing: .2px; }
.topbar-spacer { flex: 1; }
.project-switch { position: relative; }
.proj-btn { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-weight: 500; font-size: 14px; max-width: 280px; }
.proj-btn:hover { background: var(--surface-3); }
.proj-btn > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-btn i:first-child { color: var(--primary); font-size: 16px; }
.proj-btn i:last-child { color: var(--muted); font-size: 14px; }
.proj-pop, .user-pop {
  position: absolute; top: calc(100% + 8px); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-pop); padding: 6px; z-index: 40; min-width: 260px; max-height: 60vh; overflow: auto;
}
.proj-pop { left: 0; }
.user-pop { right: 0; min-width: 220px; }
.pop-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: none; background: none; border-radius: var(--r-sm); color: var(--text); font-size: 13.5px; text-align: left; }
.pop-item:hover { background: var(--surface-2); }
.pop-item.danger { color: var(--danger); }
.pop-item i { font-size: 16px; color: var(--muted); }
.pop-item.danger i { color: var(--danger); }
.pop-item.active { background: var(--primary-soft); color: var(--primary-700); }
.pop-proj { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.pop-proj .pp-name { font-weight: 500; }
.pop-proj .pp-meta { font-size: 11.5px; color: var(--muted); }
.pop-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.danger-sep { margin-top: 8px; }
.leave-platform { font-weight: 600; }
.pop-new { color: var(--primary); font-weight: 500; }
.pop-new i { color: var(--primary); }

.my-progress { display: flex; align-items: center; gap: 8px; padding: 0 6px; }
.mp-label { font-size: 12px; color: var(--muted); }
.mp-bar { width: 90px; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.mp-bar span { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .3s; }
.mp-num { font-size: 12.5px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.inbox-trigger { position: relative; flex: 0 0 auto; }
.inbox-trigger.has-invites { color: var(--primary); background: var(--primary-soft); }
.inbox-badge {
  position: absolute; top: -3px; right: -4px; min-width: 17px; height: 17px; padding: 0 4px;
  display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--surface);
  border-radius: 999px; background: var(--primary); color: var(--on-primary);
  font-size: 9.5px; line-height: 1; font-weight: 750; font-variant-numeric: tabular-nums;
}

.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 8px 0 6px; border-radius: var(--r-md); border: 1px solid transparent; background: transparent; }
.user-btn:hover { background: var(--surface-2); }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; background: var(--primary); color: #fff; font-size: 13px; font-weight: 600; }
.user-name { font-size: 13.5px; font-weight: 500; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-pop-head { padding: 10px 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.up-name { font-weight: 600; font-size: 14px; }
.up-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- workbench body ---------- */
.wb-body { flex: 1; display: grid; grid-template-columns: var(--rail-left) 1fr var(--rail-right); min-height: 0; }
.rail { background: var(--surface); display: flex; flex-direction: column; min-height: 0; position: relative; }
.rail-left { border-right: 1px solid var(--border); }
.rail-right { border-left: 1px solid var(--border); padding: 14px; gap: 14px; overflow-y: auto; }

/* draggable rail borders (VS Code style) */
.rail-resizer { position: absolute; top: 0; bottom: 0; width: 7px; z-index: 20; cursor: col-resize; touch-action: none; }
.rail-left .rail-resizer { right: -4px; }
.rail-right .rail-resizer { left: -4px; }
.rail-resizer::after { content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 1px; background: transparent; transition: background .12s; }
.rail-resizer:hover::after, .rail-resizer:active::after { background: var(--primary); box-shadow: 0 0 0 1px var(--primary); }

/* gate */
.gate { display: flex; flex-direction: column; height: 100%; padding: 16px; gap: 12px; overflow-y: auto; }
.gate-inner { text-align: center; padding: 26px 10px 8px; }
.gate-inner h3 { margin: 12px 0 4px; font-size: 16px; }
.gate-inner p { margin: 0; font-size: 13px; color: var(--muted); }
.stage-gate { margin: auto; text-align: center; max-width: 320px; padding: 20px; }
.stage-gate h3 { margin: 14px 0 6px; font-size: 17px; }
.stage-gate p { margin: 0; color: var(--muted); font-size: 13.5px; }

.proj-list { display: flex; flex-direction: column; gap: 8px; }
.proj-card { text-align: left; border: 1px solid var(--border); border-radius: var(--r-md); padding: 11px 12px; background: var(--surface); display: flex; flex-direction: column; gap: 7px; transition: border-color .14s, background .14s; }
.proj-card:hover { border-color: var(--border-strong); background: var(--surface-2); }
.proj-card.active { border-color: var(--primary); background: var(--primary-soft); }
.pc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pc-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-tasktype { font-size: 11px; color: var(--muted); padding: 2px 7px; border-radius: 999px; background: var(--surface-3); white-space: nowrap; }
.pc-bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; display: flex; }
.pc-bar i { display: block; height: 100%; }
.pc-meta { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--muted); }
.invite-box { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.join-inbox { margin: 0 0 14px; text-align: left; }
.ib-head { display: flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 12.5px; }
.ib-head svg { color: var(--primary); }
.ib-head b { font-size: 13px; }
.ib-head em { margin-left: auto; min-width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-style: normal; font-weight: 700; font-size: 11px; }
.ib-list { display: flex; flex-direction: column; gap: 7px; }
.ib-card { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
.ib-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ib-main strong { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-main span { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-actions { display: flex; align-items: center; gap: 6px; }
.inbox-modal { border: 0; border-radius: 0; background: transparent; padding: 0; }
.ib-empty, .ib-loading {
  min-height: 132px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; color: var(--muted); font-size: 13px; text-align: center;
}
.ib-empty svg { width: 28px; height: 28px; color: var(--primary); opacity: .8; }

/* ---------- queue ---------- */
.queue { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.queue-head { padding: 12px 14px 10px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 9px; }
.qh-row { display: flex; align-items: center; justify-content: space-between; }
.qh-title { font-weight: 650; font-size: 14px; }
.qh-count { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.qh-actions { display: flex; gap: 7px; }

.upload-panel, .assign-panel { padding: 12px 14px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); }
.batch-row { display: flex; gap: 7px; }
.batch-row .select { flex: 1; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 5px; text-align: center; padding: 18px 12px; border: 1.5px dashed var(--border-strong); border-radius: var(--r-md); background: var(--surface); transition: border-color .14s, background .14s; }
.dropzone i { font-size: 24px; color: var(--muted-2); }
.dropzone strong { font-size: 13px; }
.dropzone.drag { border-color: var(--primary); background: var(--primary-soft); }
.dz-actions { display: flex; gap: 8px; margin-top: 6px; }
.upload-progress { display: flex; flex-direction: column; gap: 7px; }
.up-bar { height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.up-bar span { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.up-stat { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-2); }
.up-fails { display: flex; flex-direction: column; gap: 3px; max-height: 80px; overflow: auto; }
.up-fails div { font-size: 11.5px; color: var(--danger); }

.assign-panel .ap-row { display: grid; grid-template-columns: 56px 1fr; align-items: center; gap: 8px; }
.assign-panel label { font-size: 12.5px; color: var(--text-2); }

.filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.filter { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 12px; font-weight: 500; }
.filter:hover { background: var(--surface-2); }
.filter.active { background: var(--text); color: var(--surface); border-color: var(--text); }
.filter .dot { width: 7px; height: 7px; border-radius: 50%; }
.filter .cnt { font-variant-numeric: tabular-nums; opacity: .8; }

/* virtualized image list */
.image-list { position: relative; flex: 1; overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
.vlist-spacer { width: 1px; }
.vlist-window { position: absolute; top: 0; left: 0; right: 0; will-change: transform; contain: layout paint style; }
/* 文件树「表头冻结」：sticky 覆盖层固定在滚动容器顶部，不再由 JS 每帧位移。 */
.tree-freeze { position: sticky; top: 0; left: 0; right: 0; z-index: 8; height: 0; overflow: visible; pointer-events: none; }
.tree-freeze > * { pointer-events: auto; }
.tree-freeze .tree-batch, .tree-freeze .tree-round { background: var(--surface-2); border-bottom: 1px solid var(--border); box-shadow: 0 4px 9px -8px rgba(0,0,0,.45); }
.tree-freeze .tree-batch:hover, .tree-freeze .tree-round:hover { background: var(--surface-3, var(--surface-2)); }
/* file-tree rows */
.tree-batch { display: flex; align-items: center; gap: 5px; padding: 0 9px; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text-2); user-select: none; }
.tree-batch:hover { background: var(--surface-2); }
.tw-chev { display: inline-flex; font-size: 13px; color: var(--muted); transition: transform .15s; transform: rotate(-90deg); flex: 0 0 auto; }
.tw-chev.open { transform: rotate(0deg); }
.tw-folder { display: inline-flex; font-size: 14px; color: var(--primary); flex: 0 0 auto; }
.tw-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tw-count { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* assignment-round sub-folder (one 派活 round) nested under a batch */
.tree-round { display: flex; align-items: center; gap: 5px; padding: 0 9px 0 24px; cursor: pointer; font-size: 11.5px; font-weight: 600; color: var(--text-2); user-select: none; }
.tree-round:hover { background: var(--surface-2); }
.tw-folder.rnd { color: var(--st-assigned, var(--primary)); font-size: 13px; }
.tw-folder.rnd.un { color: var(--muted); }
.tw-folder.rnd.me { color: var(--primary); }
.tree-person { font-weight: 700; color: var(--text); }
.tree-person .tw-folder.rnd { color: var(--primary); }
/* spot-check toolbar */
.sc-tag { font-size: 11.5px; font-weight: 700; color: var(--st-review, #8b5cf6); background: color-mix(in srgb, var(--st-review, #8b5cf6) 16%, transparent); padding: 3px 9px; border-radius: 999px; }
.review-actions { display: flex; align-items: center; gap: 8px; }
.review-actions .btn.on { outline: 2px solid currentColor; outline-offset: 1px; }
.my-done-chip { font-size: 12px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* manager panel: member completion */
.leg-sub { font-size: 11.5px; font-weight: 700; color: var(--muted); margin: 8px 0 3px; text-transform: none; }
.member-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 12.5px; }
.member-row.me .m-name { color: var(--primary); font-weight: 600; }
.member-row .m-name { flex: 0 0 auto; min-width: 54px; max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-row .m-bar { flex: 1 1 auto; height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.member-row .m-fill { display: block; height: 100%; background: var(--st-done, var(--primary)); border-radius: 999px; transition: width .3s; }
.member-row .m-num { flex: 0 0 auto; font-variant-numeric: tabular-nums; color: var(--text-2); min-width: 48px; text-align: right; }
/* 队员面板：待抽检张数 + 每轮细分（留足行距，不挤一起） */
.leg.spot-plan-head { margin-top: 2px; }
.leg.spot-plan-head b { color: var(--st-review, #8b5cf6); }
.spot-plan { display: flex; flex-direction: column; gap: 7px; margin: 4px 0 2px; padding: 9px 11px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.spot-plan .sp-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; }
.spot-plan .sp-k { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spot-plan .sp-when { color: var(--muted); font-size: 10.5px; }
.spot-plan .sp-v { flex: 0 0 auto; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.spot-plan .sp-row.sp-empty .sp-k { color: var(--warning, #b45309); font-weight: 600; }
.spot-plan .sp-row.sp-empty .sp-v { color: var(--warning, #b45309); }
/* 无标注 → 必须填"无目标"理由（否则不能完成） */
.empty-reason { margin-top: 12px; padding: 11px 12px; background: color-mix(in srgb, var(--warning, #d97706) 10%, var(--surface-2)); border: 1px solid color-mix(in srgb, var(--warning, #d97706) 35%, var(--border)); border-radius: 10px; }
.empty-reason label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-reason textarea { width: 100%; box-sizing: border-box; resize: vertical; min-height: 44px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: 13px; }
.empty-reason .er-hint { font-size: 11px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.img-sub .img-empty { color: var(--warning, #b45309); font-weight: 600; }
.submit-check { width: 100%; margin-top: 10px; }
.submit-check.pulse { animation: scPulse 1.6s ease-in-out infinite; }
.submit-check.warn { background: var(--warning); border-color: var(--warning); color: #fff; }
@keyframes scPulse { 0%,100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 45%, transparent); } 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--primary) 0%, transparent); } }
/* non-blocking 完成→抽检 提醒卡 (does not cover the canvas) */
.finish-prompt { position: fixed; right: 20px; bottom: 20px; z-index: 60; width: min(340px, 90vw); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg, 14px); box-shadow: 0 12px 40px rgba(15,20,35,.28); padding: 16px 18px; animation: fpIn .25s ease; }
@keyframes fpIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.finish-prompt .fp-title { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 15px; color: var(--text); }
.finish-prompt .fp-desc { font-size: 13px; color: var(--text-2); margin: 7px 0 13px; line-height: 1.5; }
.finish-prompt .fp-actions { display: flex; justify-content: flex-end; gap: 8px; }
.rnd-when { font-weight: 500; color: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.img-item.tree-img { padding-left: 26px; }
.img-item.tree-img.lvl2 { padding-left: 44px; }
.img-item { display: flex; align-items: center; gap: 10px; padding: 7px 12px; cursor: pointer; border-left: 3px solid transparent; }
.img-item:hover { background: var(--surface-2); }
.img-item.active { background: var(--primary-soft); border-left-color: var(--primary); }
.img-thumb { position: relative; flex: 0 0 auto; width: 46px; height: 36px; border-radius: 6px; overflow: hidden; background: var(--surface-3); }
.img-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-thumb .badge-n { position: absolute; right: 2px; bottom: 2px; background: rgba(15,20,35,.78); color: #fff; font-size: 10px; line-height: 1; padding: 2px 4px; border-radius: 4px; }
.img-info { flex: 1; min-width: 0; }
.img-name { font-size: 12.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.img-sub { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 5px; margin-top: 1px; }
.img-stat { flex: 0 0 auto; font-size: 15px; display: inline-flex; }
.st-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
/* 「正在标注」状态：圆点轻轻呼吸 + 状态字着青色，一眼看出这张正被人标 */
.st-dot.st-annotating { animation: stPulse 1.4s ease-in-out infinite; }
.img-sub .st-dot.st-annotating { box-shadow: 0 0 0 0 var(--st-annotating); }
@keyframes stPulse { 0%,100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--st-annotating) 55%, transparent); } 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--st-annotating) 0%, transparent); } }
.img-stat.st-annotating { animation: stBlink 1.4s ease-in-out infinite; }
@keyframes stBlink { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
.img-lock { color: var(--warning); font-size: 13px; }
.list-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 30px 16px; }

/* batch-level delete stays inline; image operations live in the custom context menu */
.tree-del { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; border: none; border-radius: 6px; background: transparent; color: var(--muted); font-size: 13.5px; cursor: pointer; opacity: 0; transition: opacity .12s, background .12s, color .12s; }
.tree-batch:hover .tree-del, .tree-del:focus-visible { opacity: 1; }
.tree-del:hover { background: var(--danger-soft, rgba(220,38,38,.12)); color: var(--danger); }

/* manager file operations: compact native-feeling menu + VS Code-like drag target */
.tree-draggable { cursor: grab; }
.tree-draggable:active { cursor: grabbing; }
.tree-dragging { opacity: .42; }
.tree-round.drop-target { background: color-mix(in srgb, var(--primary) 15%, var(--surface-2)); box-shadow: inset 2px 0 0 var(--primary); }
.tree-context-menu { position: fixed; z-index: 140; width: min(248px, calc(100vw - 16px)); padding: 5px; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; box-shadow: 0 12px 32px rgba(8,12,24,.28); }
.tree-context-menu[hidden] { display: none; }
.tcm-title { min-height: 30px; display: flex; align-items: center; gap: 8px; padding: 4px 7px 6px; color: var(--text); font-size: 12.5px; font-weight: 700; }
.tcm-title > svg { width: 15px; height: 15px; color: var(--primary); }
.tcm-title small { margin-left: auto; color: var(--muted); font-size: 10.5px; font-weight: 500; font-variant-numeric: tabular-nums; }
.tcm-label { padding: 4px 8px 3px; color: var(--muted); font-size: 10.5px; font-weight: 600; }
.tcm-rounds { max-height: min(240px, 42vh); overflow: auto; }
.tcm-item { width: 100%; min-height: 30px; display: grid; grid-template-columns: 18px minmax(0,1fr) auto auto; align-items: center; gap: 7px; padding: 5px 7px; border: 0; border-radius: 5px; background: transparent; color: var(--text-2); font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
.tcm-item:hover:not(:disabled), .tcm-item:focus-visible:not(:disabled) { outline: none; background: var(--primary-soft); color: var(--text); }
.tcm-item:disabled { cursor: default; color: var(--muted); }
.tcm-item.danger { color: var(--danger); }
.tcm-item.danger:hover, .tcm-item.danger:focus-visible { background: var(--danger-soft, rgba(220,38,38,.12)); color: var(--danger); }
.tcm-ico, .tcm-check { display: inline-flex; align-items: center; justify-content: center; }
.tcm-ico svg, .tcm-check svg { width: 14px; height: 14px; }
.tcm-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcm-detail { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.tcm-check { color: var(--primary); }
.tcm-sep { height: 1px; margin: 4px 3px; background: var(--border); }

/* batch guidance / hints */
.batch-hint { font-size: 11.5px; line-height: 1.5; color: var(--muted); }
.batch-guide { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; line-height: 1.55; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 9px 11px; margin-bottom: 10px; }
.batch-guide :first-child { flex: 0 0 auto; color: var(--primary); font-size: 15px; display: inline-flex; margin-top: 1px; }

/* duplicate-skip report under the upload progress bar */
.up-dups { display: flex; flex-direction: column; gap: 3px; max-height: 168px; overflow: auto; }
.up-dups-h { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--warning); margin-top: 2px; }
.up-dups-h :first-child { display: inline-flex; font-size: 14px; }
.up-dup-line { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; font-size: 11px; color: var(--text-2); }
.udl-name, .udl-dup { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.udl-name { text-align: right; }
.udl-dup { color: var(--muted); }
.udl-arrow { color: var(--warning); font-weight: 700; }
.up-dup-more { font-size: 11px; color: var(--muted); }
.up-dup-tip { font-size: 11px; color: var(--muted); line-height: 1.5; margin-top: 3px; border-top: 1px dashed var(--border); padding-top: 5px; }

/* team / member manager (modal) */
.team-mgr { display: flex; flex-direction: column; gap: 14px; min-width: 420px; }
.tm-list { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow: auto; }
.tm-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 20px; }
.tm-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.tm-row.is-left { background: var(--surface-2); }
.tm-ava { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 13px; }
.tm-id { flex: 1; min-width: 0; }
.tm-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-you { color: var(--primary); font-weight: 600; }
.tm-left { color: var(--muted); font-weight: 600; }
.tm-mail { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-rolesel { flex: 0 0 auto; width: 104px; }
.tm-reinvite { flex: 0 0 auto; }
.tm-del { opacity: 1; }
.tm-add { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.tm-add-head { font-size: 12px; font-weight: 600; color: var(--text-2); }
.tm-add-row { display: grid; grid-template-columns: 1fr 104px auto; gap: 8px; }
.tm-pending { display: flex; flex-direction: column; gap: 6px; }
.tm-invite { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 8px; border-radius: var(--r-md); background: var(--surface-2); color: var(--text-2); font-size: 12px; }
.tm-invite span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-new { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px dashed var(--border-strong); border-radius: var(--r-md); background: var(--surface-2); }
.tm-new-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tm-new-grid .pw-wrap { display: flex; }
.tm-new-grid .pw-wrap .input { width: 100%; }
.tm-new-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tm-hint { font-size: 11px; color: var(--muted); line-height: 1.5; }

/* ---------- stage ---------- */
.stage-wrap { position: relative; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.stage-tools { height: 50px; flex: 0 0 50px; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: var(--surface); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.stage-tools::-webkit-scrollbar { display: none; }
.tool-group { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 2px; gap: 2px; }
.tool { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--r-sm); border: 1px solid transparent; background: transparent; color: var(--text-2); font-size: 16px; }
.tool:hover { background: var(--surface-3); color: var(--text); }
.tool.active { background: var(--primary); color: #fff; }
.close-image-btn:hover { background: var(--danger-soft); color: var(--danger); }
.tool-sep { width: 1px; height: 24px; background: var(--border); margin: 0 2px; }
.stage-tools-spacer { flex: 1; }
.cur-image { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.save-state { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); min-width: 0; white-space: nowrap; }
.save-state.saved { color: var(--success); }
.save-state.saving { color: var(--muted); }
.save-state .ss-ico { display: inline-flex; align-items: center; }
.save-state .ss-ico svg { width: 14px; height: 14px; }
.save-state .ss-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warning); opacity: .8; animation: ssPulse 1s ease-in-out infinite; }
.save-state .ss-spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--primary); animation: ssSpin .6s linear infinite; }
.save-state.saved.pop .ss-ico { animation: ssPop .42s cubic-bezier(.2,1.3,.4,1); }
@keyframes ssSpin { to { transform: rotate(360deg); } }
@keyframes ssPulse { 0%,100% { transform: scale(.7); opacity: .5; } 50% { transform: scale(1); opacity: .9; } }
@keyframes ssPop { 0% { transform: scale(.2); opacity: 0; } 55% { transform: scale(1.35); opacity: 1; } 100% { transform: scale(1); } }
.lock-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--warning); background: var(--warning-soft); padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.review-actions { display: inline-flex; gap: 7px; }

.stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background: var(--canvas-bg); touch-action: none; }
/* ⑨ 审核通过绿戳：公章感（旋转、双描边、半透明），盖在图左上角 */
.pass-stamp { position: absolute; top: 16px; left: 16px; z-index: 6; pointer-events: none; transform: rotate(-11deg);
  color: var(--st-done, #16a34a); border: 3px solid var(--st-done, #16a34a); border-radius: 9px;
  padding: 5px 13px; font-size: 21px; font-weight: 900; letter-spacing: 5px; line-height: 1;
  opacity: .82; background: color-mix(in srgb, var(--st-done, #16a34a) 7%, transparent);
  box-shadow: inset 0 0 0 1.5px var(--st-done, #16a34a); }
/* 审核台改好后通过：靛蓝戳，区别于原样绿色「已通过」，让队员看到我们"改正过" */
.pass-stamp.repassed { color: var(--primary, #6366f1); border-color: var(--primary, #6366f1); letter-spacing: 3px;
  background: color-mix(in srgb, var(--primary, #6366f1) 8%, transparent); box-shadow: inset 0 0 0 1.5px var(--primary, #6366f1); }
/* 二次抽检废弃：红色「未抽检」戳——这张不参与最终训练数据导出 */
.pass-stamp.discarded { color: var(--danger, #dc2626); border-color: var(--danger, #dc2626); letter-spacing: 4px;
  background: color-mix(in srgb, var(--danger, #dc2626) 9%, transparent); box-shadow: inset 0 0 0 1.5px var(--danger, #dc2626); }
/* ⑨ 打回原因框：右栏高位醒目 */
.reject-note { margin: 0 0 10px; border: 1.5px solid var(--danger, #dc2626); border-radius: 10px; background: color-mix(in srgb, var(--danger, #dc2626) 9%, transparent); padding: 9px 11px; }
.reject-note .rn-head { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; color: var(--danger, #dc2626); margin-bottom: 4px; }
.reject-note .rn-head svg { width: 13px; height: 13px; }
.reject-note .rn-text { font-size: 13px; line-height: 1.5; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* 缩放控件随工具栏排版（不再绝对定位浮在画布右下角挡住图像右下角） */
.stage-zoom { display: inline-flex; align-items: center; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 2px; flex: 0 0 auto; }
.zoom-btn { display: inline-flex; align-items: center; justify-content: center; height: 28px; min-width: 28px; padding: 0 7px; border: none; background: transparent; color: var(--text-2); border-radius: 999px; font-size: 15px; }
.zoom-btn:hover { background: var(--surface-2); }
.zoom-fit { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 48px; }

/* ---------- right rail panels ---------- */
.panel { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 13px; display: flex; flex-direction: column; gap: 11px; }
.panel.grow { flex: 1; min-height: 240px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-head h4 { margin: 0; font-size: 13px; font-weight: 650; color: var(--text); }
.progress-block { display: flex; flex-direction: column; gap: 9px; }
.prog-bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; display: flex; }
.prog-bar i { display: block; height: 100%; }
.prog-legend { display: flex; flex-direction: column; gap: 8px; }
.leg { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); }
.leg b { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--text); font-weight: 700; }
.leg .dot { width: 8px; height: 8px; border-radius: 50%; }
.leg b { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--text); }

.class-list { display: flex; flex-direction: column; gap: 5px; max-height: 168px; overflow-y: auto; }
.class-row { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: var(--r-sm); border: 1px solid transparent; cursor: pointer; }
.class-row:hover { background: var(--surface); }
.class-row.active { background: var(--surface); border-color: var(--border-strong); }
.class-sw { width: 13px; height: 13px; border-radius: 4px; flex: 0 0 auto; }
.class-idx { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.class-name { font-size: 13px; font-weight: 500; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.class-key { font-size: 10.5px; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; }

.shape-list { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; flex: 1; min-height: 0; }
.shape-row { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: var(--r-sm); cursor: pointer; border: 1px solid transparent; }
.shape-row:hover { background: var(--surface); }
.shape-row.active { background: var(--surface); border-color: var(--primary); }
.shape-ico { font-size: 14px; }
.shape-label { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shape-type { font-size: 11px; color: var(--muted); }
.shape-del { color: var(--muted); font-size: 14px; opacity: 0; }
.shape-row:hover .shape-del { opacity: 1; }
.shape-del:hover { color: var(--danger); }
.shapes-empty { text-align: center; color: var(--muted); font-size: 12.5px; padding: 18px 8px; }

.export-row { display: flex; gap: 7px; }
.export-row .btn { flex: 1; }
.export-options { margin: 2px 0 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-sm); background: color-mix(in srgb, var(--primary) 7%, transparent); }
.export-check { margin: 0; }
.export-progress { margin: 10px 0 2px; padding: 10px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); }
.ep-top { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 12.5px; }
.ep-spin { width: 14px; height: 14px; border: 2px solid color-mix(in srgb, var(--primary) 22%, transparent); border-top-color: var(--primary); border-radius: 999px; animation: spin .8s linear infinite; flex: none; }
.ep-bar { margin-top: 8px; height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--border) 80%, transparent); overflow: hidden; }
.ep-bar > div { width: 0%; height: 100%; border-radius: inherit; background: var(--primary); transition: width .18s ease; }

/* ---------- toast ---------- */
.toast-wrap { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 90; align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 9px; padding: 11px 16px; border-radius: var(--r-md); background: var(--text); color: var(--surface); font-size: 13.5px; line-height: 1.4; box-shadow: var(--shadow-lg); max-width: min(440px, 90vw); white-space: nowrap; animation: toastIn .22s ease; }
.toast.error, .toast.warn { white-space: normal; }
.toast i, .toast svg { font-size: 16px; flex: 0 0 auto; }
.toast.error { background: var(--danger); color: #fff; }
.toast.success { background: var(--success); color: #fff; }
.toast.warn { background: var(--warning); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(12, 16, 28, .5); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 80; animation: fade .16s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 480px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); max-height: 88vh; display: flex; flex-direction: column; animation: modalIn .2s ease; }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.99); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 12px; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 4px 20px 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 14px 20px 18px; display: flex; gap: 10px; justify-content: flex-end; }
.modal-foot.spread { justify-content: space-between; }
.class-builder { display: flex; flex-direction: column; gap: 7px; }
.cb-row { display: flex; align-items: center; gap: 8px; }
.cb-row .cb-idx { width: 22px; color: var(--muted); font-size: 12px; text-align: center; }
.cb-row .cb-sw { width: 20px; height: 20px; border-radius: 5px; border: none; flex: 0 0 auto; cursor: pointer; }
.cb-row input { flex: 1; }
.cb-del { color: var(--muted); }
.cb-del:hover { color: var(--danger); }
.member-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.member-row .mr-name { flex: 1; font-size: 13.5px; }
.member-row .mr-name small { display: block; color: var(--muted); font-size: 11.5px; }

/* ---------- assignment grid (Roboflow-style multi-select) ---------- */
.assign-overlay { position: fixed; inset: 0; z-index: 70; background: var(--bg); display: flex; flex-direction: column; animation: fade .16s ease; }
.ao-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface); flex-wrap: wrap; }
.ao-title { font-weight: 650; font-size: 15px; margin-right: 6px; }
.ao-head .select { width: auto; min-width: 120px; }
.ao-spacer { flex: 1; }
.ao-count { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ao-reassign { font-size: 12px; display: flex; align-items: center; gap: 5px; color: var(--text-2); white-space: nowrap; }
/* 虚拟滚动：网格只是滚动容器，卡片由 JS 绝对定位 + 只渲染可视区域（上万张也流畅） */
.ao-grid { flex: 1; overflow-y: auto; position: relative; }
.ao-grid.marqueeing { cursor: crosshair; user-select: none; }
.ao-grid.marqueeing .ao-card { cursor: crosshair; }
.ao-content { position: relative; width: 100%; }
/* rubber-band selection box (hold left button + drag, wheel to extend) */
.ao-marquee { position: absolute; z-index: 5; pointer-events: none; border: 1.5px solid var(--primary); background: color-mix(in srgb, var(--primary) 16%, transparent); border-radius: 3px; }
.ao-search { height: 30px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: 13px; min-width: 190px; }
.ao-search::placeholder { color: var(--muted); }
.ao-view { flex: 0 0 auto; }
.ao-view button { font-size: 13px; padding: 4px 8px; line-height: 1; }
.ao-card { position: absolute; box-sizing: border-box; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; cursor: pointer; background: var(--surface); transition: border-color .12s, box-shadow .12s; user-select: none; }
.ao-card:hover { border-color: var(--border-strong); }
.ao-card.sel { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.ao-thumb { flex: 1 1 auto; width: 100%; min-height: 0; background: var(--surface-3); object-fit: cover; display: block; }
.ao-check { position: absolute; top: 7px; left: 7px; width: 20px; height: 20px; border-radius: 5px; border: 2px solid #fff; background: rgba(15, 20, 35, .35); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; box-shadow: 0 1px 3px rgba(0,0,0,.3); z-index: 2; }
.ao-card.sel .ao-check { background: var(--primary); }
.ao-badge { position: absolute; top: 7px; right: 7px; font-size: 10px; padding: 2px 7px; border-radius: 999px; color: #fff; font-weight: 500; z-index: 2; }
.ao-meta { flex: 0 0 auto; padding: 5px 9px 7px; }
.ao-fn { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ao-sub { font-size: 11px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ao-empty { position: absolute; top: 40px; left: 0; right: 0; text-align: center; color: var(--muted); padding: 50px 16px; font-size: 14px; }
/* 列表视图：缩略小图 + 文件名 + 状态 + 派给，一行展示，便于按名称/时间快速浏览 */
.ao-card.list { flex-direction: row; align-items: center; gap: 12px; padding-right: 12px; }
.ao-card.list .ao-check { position: static; flex: 0 0 auto; margin-left: 10px; }
.ao-card.list .ao-lthumb { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: var(--surface-3); }
.ao-card.list .ao-lfn { flex: 1 1 auto; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ao-card.list .ao-badge { position: static; flex: 0 0 auto; }
.ao-card.list .ao-lsub { flex: 0 0 auto; font-size: 12px; color: var(--muted); min-width: 96px; text-align: right; white-space: nowrap; }
@media (max-width: 680px) { .ao-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); } .ao-title { width: 100%; } }

/* ---------- responsive ---------- */
.mobile-tabbar { display: none; }
.mobile-only { display: none; }

@media (max-width: 1100px) {
  :root { --rail-left: 260px; --rail-right: 244px; }
}
@media (max-width: 920px) {
  .login-view { grid-template-columns: 1fr; }
  .login-aside { display: none; }
  /* tablet: collapse right rail into a drawer, keep left + stage */
  .wb-body { grid-template-columns: var(--rail-left) 1fr; }
  .rail-right {
    position: fixed; top: var(--topbar-h); right: 0; bottom: 0; width: 300px; z-index: 50;
    transform: translateX(100%); transition: transform .22s ease; box-shadow: var(--shadow-lg);
  }
  .rail-right.open { transform: translateX(0); }
  .rail-right .rail-resizer { display: none; }
  .my-progress { display: none !important; }
  /* 窄屏：顶栏改为可横向滑动，控件不再被挤出屏幕（只在放不下时才出现滚动） */
  .topbar { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .topbar::-webkit-scrollbar { display: none; height: 0; }
  .topbar > * { flex-shrink: 0; }
}
@media (max-width: 680px) {
  :root { --topbar-h: 52px; }
  .brand-name { display: none; }
  .wb-body { grid-template-columns: 1fr; position: relative; }
  /* mobile: panels become slide-over drawers, stage is primary */
  .rail-left {
    position: fixed; top: var(--topbar-h); left: 0; bottom: 48px; width: 86%; max-width: 340px; z-index: 50;
    border-right: 1px solid var(--border); transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg);
  }
  .rail-left.open { transform: translateX(0); }
  .rail-resizer { display: none; }
  .rail-right { top: var(--topbar-h); bottom: 48px; width: 86%; max-width: 320px; }
  .user-name { display: none; }
  .ib-card { grid-template-columns: 1fr; }
  .ib-actions { justify-content: flex-end; }
  /* 手机：去掉弹性占位的"撑开"，让控件向左紧凑排列、超出部分靠左滑露出（顶栏 + 小顶栏一致） */
  .topbar-spacer, .stage-tools-spacer { flex: 0 0 6px; }
  .stage-tools > * { flex-shrink: 0; }
  .proj-btn { max-width: 148px; }
  .stage-tools::-webkit-scrollbar { display: none; height: 0; }
  .mobile-tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: 48px; z-index: 60;
    background: var(--surface); border-top: 1px solid var(--border);
  }
  .mobile-tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: none; background: none; color: var(--muted); font-size: 10.5px; }
  .mobile-tabbar button i { font-size: 18px; }
  .mobile-tabbar button.active { color: var(--primary); }
  .mobile-only { display: inline-flex; }
}
.scrim { position: fixed; inset: 0; background: rgba(10,14,24,.4); z-index: 45; animation: fade .16s ease; }

/* ===== 质检：检查单 / 异常面板 / 异常确认 ===== */
.tool-guide { color: var(--warning); }
/* modal */
.modal-overlay { position: fixed; inset: 0; z-index: 220; display: grid; place-items: center; padding: 24px; background: rgba(8,10,18,.62); backdrop-filter: blur(4px); animation: fade .16s ease; }
.modal-card { width: 100%; max-width: 460px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 22px 22px 20px; max-height: 86vh; overflow: auto; }
.modal-h { display: flex; align-items: center; gap: 9px; }
.modal-h h3 { margin: 0; font-size: 17px; font-weight: 700; }
.modal-h i { width: 22px; height: 22px; color: var(--primary); flex: 0 0 auto; }
.modal-h.warn i { color: var(--warning); }
.modal-sub { margin: 10px 0 14px; color: var(--text-2); font-size: 13.5px; line-height: 1.6; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.modal-foot .btn { min-width: 96px; justify-content: center; }
/* checklist */
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; line-height: 1.55; color: var(--text); }
.chk-n { flex: 0 0 auto; width: 20px; height: 20px; border-radius: 6px; background: var(--surface-2); color: var(--primary); font-size: 12px; font-weight: 700; display: grid; place-items: center; margin-top: 1px; }
/* anomaly side panel */
.anomaly-panel { border-color: var(--warning); box-shadow: 0 0 0 1px var(--warning) inset; }
.anomaly-panel .panel-head h4 { display: flex; align-items: center; gap: 6px; color: var(--warning); }
.anomaly-panel .panel-head i { width: 16px; height: 16px; }
.badge-warn { background: var(--warning); color: #fff; }
.anom-list { display: flex; flex-direction: column; gap: 6px; max-height: 148px; overflow: auto; }
.anom-row { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 9px; background: var(--warning-soft); border: 1px solid transparent; cursor: pointer; transition: border-color .12s; }
.anom-row:hover { border-color: var(--warning); }
.anom-row .ar-seq { flex: 0 0 auto; font-weight: 700; font-size: 13px; color: var(--warning); min-width: 34px; }
.anom-row .ar-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.anom-row .ar-msg { font-size: 12.5px; line-height: 1.45; color: var(--text); }
.anom-row .ar-who { font-size: 11.5px; color: var(--text-2); }
.anom-row.anom-empty .ar-seq { color: var(--danger); }
@keyframes anomShake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-5px)} 40%{transform:translateX(5px)} 60%{transform:translateX(-3px)} 80%{transform:translateX(3px)} }
.anomaly-panel.shake { animation: anomShake .5s ease; }
/* alert popup list */
.anom-mlist { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 7px; max-height: 46vh; overflow: auto; }
.anom-mlist li { display: flex; align-items: baseline; gap: 8px; padding: 8px 10px; border-radius: 9px; background: var(--warning-soft); font-size: 13px; line-height: 1.5; }
.anom-mlist .al-seq { font-weight: 700; color: var(--warning); flex: 0 0 auto; }
.anom-mlist .al-who { color: var(--text-2); flex: 0 0 auto; }
.anom-mlist .al-msg { color: var(--text); }
/* tree row + thumb markers */
.img-item.img-anom { background: var(--warning-soft); }
.img-item.img-anom:hover { background: var(--warning-soft); }
.img-warn { color: var(--warning); display: inline-flex; width: 15px; height: 15px; flex: 0 0 auto; }
.img-warn svg { width: 15px; height: 15px; }
/* shape-list banner */
.anom-banner { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 9px 11px; margin-bottom: 10px; border-radius: 10px; background: var(--warning-soft); border: 1px solid var(--warning); }
.anom-banner .ab-msg { display: flex; align-items: center; gap: 7px; font-size: 12.5px; line-height: 1.45; color: var(--text); flex: 1 1 160px; }
.anom-banner .ab-msg i { color: var(--warning); width: 16px; height: 16px; flex: 0 0 auto; }
.anom-banner .ab-ack { flex: 0 0 auto; }
/* ack modal textarea */
.ack-ta { width: 100%; box-sizing: border-box; resize: vertical; margin-top: 4px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); color: var(--text); font: inherit; font-size: 13.5px; }
.ack-ta:focus { outline: none; border-color: var(--primary); }

/* 项目「标注规则」编辑区（每项目自定义，去硬编码） */
.rule-sec { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.rule-sec-h { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 10px; }
.rule-sec-h svg, .rule-sec-h i { width: 15px; height: 15px; color: var(--warning, #d97706); }
.rule-check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--text); margin: 10px 0; }
.rule-check input { width: 16px; height: 16px; accent-color: var(--primary); flex: none; }
.rule-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rule-nums .field { margin: 0; }
.rule-sec .er-hint { font-size: 11px; color: var(--muted); margin-top: 8px; line-height: 1.5; }

/* AI 辅助质检 UI（设置面板徽标 + 抽检 AI 复核按钮/结论） */
.btn.xs { padding: 3px 9px; font-size: 11px; border-radius: 7px; line-height: 1.5; }
.anom-row .ar-body { flex: 1 1 auto; }
.anom-row .ar-ai { flex: 0 0 auto; margin-left: auto; }
.ai-chip { display: inline-block; margin-top: 3px; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 700; }
.ai-chip.suspect { background: var(--danger-soft); color: var(--danger); }
.ai-chip.ok { background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--success); }
.ai-status { margin-top: 14px; }
.ai-badge { display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 8px; font-size: 12.5px; font-weight: 600; }
.ai-badge.ok { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }
.ai-badge.warn { background: var(--warning-soft); color: var(--warning); }
