:root {
  --bg: #f4f1ea;
  --paper: #fffdf8;
  --ink: #1d1b16;
  --muted: #6f6a5f;
  --line: #e2ddd0;
  --accent: #b4441f;
  --accent-ink: #fff;
  --accent-soft: #f6e2d8;
  --warn: #9a6400;
  --warn-soft: #fbeccb;
  --ok-soft: #e3eedc;
  --danger: #b3261e;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(40, 30, 10, .06), 0 4px 16px rgba(40, 30, 10, .06);
  --safe-b: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17150f; --paper: #221f18; --ink: #f1ece0; --muted: #a39d8f; --line: #36322a;
    --accent: #e0754d; --accent-ink: #1b120d; --accent-soft: #3a2519;
    --warn: #e9b44c; --warn-soft: #3a2f16; --ok-soft: #22301d; --danger: #f2867d;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); }
body { overscroll-behavior-y: none; }
[hidden] { display: none !important; }
button, input, a.btn { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.view { min-height: 100dvh; }
#view-main, #view-preview { -webkit-user-select: none; user-select: none; }
#view-main input { -webkit-user-select: text; user-select: text; }

/* ---------- 通用组件 ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .02em; font-size: 17px; }
.brand-mark { width: 32px; height: 32px; display: block; flex: none; }
.brand-btn { border: 0; background: none; padding: 4px 6px 4px 0; color: var(--ink); cursor: pointer; border-radius: 10px; font-family: inherit; }
.brand-btn:active { opacity: .7; }
.login-card .brand-mark { width: 40px; height: 40px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: 6px; vertical-align: 1px; }
.dot.on { background: #34a853; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--paper); text-decoration: none; font-size: 16px; white-space: nowrap;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .45; pointer-events: none; }
.icon-btn { width: 44px; height: 44px; border: 0; background: transparent; display: grid; place-items: center; border-radius: 12px; color: var(--ink); }
.icon-btn:active { background: var(--line); }
.icon-btn-spacer { width: 44px; }
.link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; text-decoration: underline; }

label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 14px; }
label input { display: block; width: 100%; margin-top: 6px; height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); padding: 0 14px; font-size: 17px; color: var(--ink); }
label input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.form-error { min-height: 20px; color: var(--danger); font-size: 14px; margin: 0 0 10px; }

/* ---------- 登录 ---------- */
#view-login { display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--paper); border-radius: 20px; padding: 28px 22px; box-shadow: var(--shadow); }
.login-card .brand { margin-bottom: 26px; font-size: 20px; }

/* ---------- 主界面 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: max(10px, env(safe-area-inset-top)) 12px 10px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.topbar-title { font-weight: 600; }
.banner { margin: 0 16px 8px; padding: 10px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-size: 14px; }
.banner.info { background: var(--ok-soft); color: var(--ink); }
#list-wrap { padding: 4px 12px calc(96px + var(--safe-b)); max-width: 760px; margin: 0 auto; }

.empty { display: grid; place-items: center; min-height: 60dvh; }
.upload-hero {
  width: min(320px, 90%); aspect-ratio: 1 / 1.1; border: 2px dashed var(--line); border-radius: 24px; background: var(--paper);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; font-size: 20px; font-weight: 600;
}
.upload-hero .plus { width: 72px; height: 72px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 40px; font-weight: 400; }
.upload-hero small { font-size: 13px; font-weight: 400; color: var(--muted); padding: 0 24px; text-align: center; line-height: 1.5; }

.summary { font-size: 13px; color: var(--muted); padding: 4px 6px 10px; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.summary .la-link { flex: none; font-size: 14px; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.row {
  display: grid; grid-template-columns: 34px 64px 1fr auto; align-items: center; gap: 10px;
  background: var(--paper); border-radius: var(--radius); padding: 8px 6px 8px 0; box-shadow: var(--shadow);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.row.piece { margin-left: 18px; }
.handle { height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); touch-action: none; cursor: grab; }
.handle .num { font-size: 12px; font-variant-numeric: tabular-nums; margin-top: 2px; }
.handle svg { width: 18px; height: 18px; }
.thumb { border: 0; padding: 0; width: 64px; height: 64px; border-radius: 8px; background: var(--bg); display: grid; place-items: center; overflow: hidden; position: relative; }
.thumb img { max-width: 100%; max-height: 100%; display: block; pointer-events: none; }
.thumb .ori { position: absolute; right: 3px; bottom: 3px; font-size: 10px; padding: 1px 4px; border-radius: 4px; background: rgba(0,0,0,.55); color: #fff; }
.info { min-width: 0; }
.info .name { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.info .meta { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 6px; background: var(--bg); color: var(--muted); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.split { background: var(--accent-soft); color: var(--accent); }
.tag.piece { background: var(--ok-soft); }
.acts { display: flex; }
.acts .icon-btn { width: 40px; height: 44px; color: var(--muted); }
.acts .icon-btn.del { color: var(--danger); }

.row.dragging { position: fixed; z-index: 50; pointer-events: none; box-shadow: 0 12px 32px rgba(0,0,0,.22); transform: scale(1.02); opacity: .96; }
.placeholder { border: 2px dashed var(--accent); border-radius: var(--radius); background: var(--accent-soft); }

.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px;
  padding: 10px 12px calc(10px + var(--safe-b)); background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line);
}
.bottombar .btn { min-height: 50px; }
.bottombar .btn.primary { grid-column: span 2; }
@media (min-width: 760px) { .bottombar { padding-left: calc(50vw - 370px); padding-right: calc(50vw - 370px); } }

/* ---------- 预览 ---------- */
.pages { padding: 8px 16px calc(96px + var(--safe-b)); display: flex; flex-direction: column; align-items: center; gap: 18px; }
.page-wrap { width: 100%; max-width: 520px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.page { position: relative; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.15); width: 100%; }
.page.L { width: 100%; }
.page.P { width: 72%; }
.page img { position: absolute; display: block; }
.page-wrap .page { cursor: zoom-in; }
.page .margin-guide { position: absolute; border: 1px dashed rgba(180, 68, 31, .25); pointer-events: none; }
.page-cap { font-size: 12px; color: var(--muted); }
@media (min-width: 900px) {
  .pages { flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: flex-start; }
  .page-wrap { width: 260px; }
}

/* ---------- 底部弹层 ---------- */
.sheet { position: fixed; inset: 0; z-index: 30; background: rgba(20, 15, 5, .38); display: flex; align-items: flex-end; justify-content: center; }
.sheet-panel {
  width: 100%; max-width: 560px; max-height: 92dvh; overflow: auto; background: var(--paper); border-radius: 22px 22px 0 0;
  padding: 8px 18px calc(20px + var(--safe-b)); animation: up .18s ease-out;
}
@keyframes up { from { transform: translateY(30px); opacity: .6; } }
@media (min-width: 760px) { .sheet { align-items: center; } .sheet-panel { border-radius: 22px; } }
.sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 10px; }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.detail-title { font-size: 17px; font-weight: 600; word-break: break-all; }
.detail-meta { font-size: 13px; color: var(--muted); margin-top: 4px; }
.detail-img { position: relative; display: block; width: 100%; padding: 0; border: 0; background: var(--bg); border-radius: 12px; height: 38dvh; overflow: hidden; margin-bottom: 12px; cursor: zoom-in; }
.detail-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.zoom-hint { position: absolute; right: 8px; bottom: 8px; font-size: 12px; padding: 3px 8px; border-radius: 8px; background: rgba(0,0,0,.55); color: #fff; }
.detail-row { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.detail-row .btn { flex: 1; }
.split-box { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.split-title { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; flex: 0 0 auto !important; }
.stepper .btn { border: 0; border-radius: 0; min-width: 44px; padding: 0; }
.stepper span { min-width: 26px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; line-height: 1.5; }

.setting { padding: 12px 0; border-bottom: 1px solid var(--line); }
.setting-label { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.setting-value { font-size: 15px; }
.seg { display: flex; background: var(--bg); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: transparent; font-size: 15px; }
.seg button.on { background: var(--paper); box-shadow: var(--shadow); font-weight: 600; }
.settings-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }

/* ---------- 等待与提示 ---------- */
.busy { position: fixed; inset: 0; z-index: 60; background: rgba(20, 15, 5, .3); display: grid; place-items: center; }
.busy-card { background: var(--paper); border-radius: 16px; padding: 22px 26px; min-width: 220px; text-align: center; box-shadow: var(--shadow); }
.spinner { width: 34px; height: 34px; margin: 0 auto 12px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress { height: 6px; border-radius: 3px; background: var(--line); margin-top: 12px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.toast {
  position: fixed; left: 50%; bottom: calc(86px + var(--safe-b)); transform: translateX(-50%); z-index: 70;
  max-width: calc(100% - 32px); background: var(--ink); color: var(--bg); padding: 11px 16px; border-radius: 12px; font-size: 14px; line-height: 1.5;
  white-space: pre-line;
}

/* ---------- 直连打印 ---------- */
.stepper.wide { width: max-content; }
.stepper.wide span { min-width: 48px; font-size: 18px; }
.pstatus { text-align: center; padding: 18px 0 8px; }
.pstatus .spinner { margin-bottom: 14px; }
.pstatus-icon { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; font-weight: 700; margin: 0 auto 10px; color: #fff; }
.pstatus-icon.ok { background: #34a853; }
.pstatus-icon.bad { background: var(--danger); }
.pstatus-text { font-size: 17px; font-weight: 600; }
.pstatus .hint { margin-top: 8px; }
.device { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; }
.device .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.device .dot.on { background: #3f9b4b; }
.device .dinfo { flex: 1; min-width: 0; font-size: 14px; }
.device .dinfo small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.steps { padding-left: 20px; font-size: 14px; line-height: 1.6; margin: 0 0 10px; }
.cmd { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; word-break: break-all; margin-bottom: 8px; -webkit-user-select: all; user-select: all; }

/* ---------- 全屏查看 ---------- */
.viewer { position: fixed; inset: 0; z-index: 80; background: rgba(18, 16, 12, .94); display: flex; flex-direction: column; color: #f1ece0; touch-action: pan-y; -webkit-user-select: none; user-select: none; }
.viewer-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(10px, env(safe-area-inset-top)) 12px 6px 18px; }
.viewer-title { font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer .icon-btn { color: #f1ece0; }
.viewer .icon-btn:active { background: rgba(255,255,255,.12); }
.viewer-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 4px 8px; }
.viewer-page { flex: none; box-shadow: 0 6px 30px rgba(0,0,0,.5); background: #fff; }
.viewer-page .margin-guide { border-color: rgba(180, 68, 31, .55); }
.viewer-nav { flex: none; width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255,255,255,.1); color: #f1ece0; display: grid; place-items: center; }
.viewer-nav:hover { background: rgba(255,255,255,.18); }
.viewer-nav[disabled] { visibility: hidden; }
.viewer-foot { text-align: center; font-size: 12px; color: #b9b2a3; padding: 6px 16px calc(12px + var(--safe-b)); }
@media (max-width: 700px) { .viewer-nav { display: none; } }
.notice { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-size: 13px; line-height: 1.6; }
.notice .cmd { margin-top: 8px; color: var(--ink); }
#p-sides button { font-size: 14px; }
.seg button[disabled] { opacity: .35; cursor: not-allowed; }

/* ---------- 转线稿 ---------- */
.la { display: flex; flex-direction: column; height: 100dvh; min-height: 0; }
.la-top { position: static; gap: 10px; }
.la-top .topbar-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.la-top .btn { min-height: 40px; }
.la-body { flex: 1; min-height: 0; display: flex; gap: 12px; padding: 0 12px 12px; }
.la-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.la-tabs { align-self: center; width: min(460px, 100%); }
.la-tabs button { font-size: 14px; }
.la-stage { flex: 1; min-height: 0; display: flex; gap: 12px; align-items: center; justify-content: center; background: var(--line); border-radius: 14px; padding: 10px; overflow: hidden; }
.la-pane { flex: 1; min-width: 0; height: 100%; display: flex; align-items: center; justify-content: center; }
.la-frame { position: relative; display: inline-block; line-height: 0; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.12); }
.la-frame img { display: block; max-width: 100%; max-height: var(--la-h, 70dvh); -webkit-user-drag: none; user-select: none; }
.la-frame canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
#la-marks { opacity: .42; cursor: crosshair; }
#la-fix { opacity: 1; }
.la-stage.fixing #la-fix { cursor: crosshair; }
.la-busy { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255,255,255,.45); }
.la-tip { font-size: 12.5px; color: var(--muted); text-align: center; min-height: 18px; }
.la-side { width: 320px; flex: none; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.la-side section { background: var(--paper); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); }
.la-side h3 { margin: 0 0 10px; font-size: 15px; }
.la-side h3 small { font-weight: 400; font-size: 12px; color: var(--muted); margin-left: 4px; }
.la-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.la-tools button { display: grid; grid-template-columns: 14px 1fr; column-gap: 7px; align-items: center; text-align: left; padding: 7px 8px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--paper); font-size: 13.5px; font-weight: 600; }
.la-tools button small { grid-column: 2; font-weight: 400; font-size: 11px; color: var(--muted); }
.la-tools button i { width: 14px; height: 14px; border-radius: 4px; grid-row: span 2; }
.la-tools button i.eraser { background: repeating-linear-gradient(45deg, #bbb 0 3px, #fff 3px 6px); border: 1px solid #aaa; }
.la-tools button.on { border-color: var(--accent); background: var(--accent-soft); }
.la-row { display: flex; gap: 6px; margin: 6px 0; flex-wrap: wrap; }
.la-row > * { flex: 1; }
.btn.small { min-height: 36px; font-size: 13.5px; padding: 0 10px; }
.seg.small button { min-height: 32px; font-size: 13px; }
.la-range { display: block; font-size: 13px; color: var(--ink); margin: 8px 0; }
.la-range b { font-weight: 600; color: var(--accent); margin-left: 4px; }
.la-range input { display: block; width: 100%; height: auto; margin: 4px 0 0; padding: 0; border: 0; background: none; accent-color: var(--accent); }
.la-field { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0; font-size: 13px; }
.la-field .seg { flex: 0 0 190px; }
#la-fix-tool.on { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
@media (max-width: 860px) {
  .la { height: auto; min-height: 100dvh; }
  .la-body { flex-direction: column; }
  .la-stage { height: 58dvh; flex: none; }
  .la-side { width: auto; overflow: visible; }
  .la-stage.compare { flex-direction: column; }
}
.la-cursor { position: fixed; z-index: 90; pointer-events: none; border: 2px solid #222; border-radius: 50%; transform: translate(-50%, -50%); box-shadow: 0 0 0 1px rgba(255,255,255,.9); }
.la-stage.fixing #la-fix, #la-marks { cursor: crosshair; }
.ai-btn { border-color: #b9a5e6; background: linear-gradient(180deg, #faf7ff, #f2ecff); color: #4b2e9e; font-weight: 600; margin-bottom: 8px; }
.ai-btn[disabled] { opacity: .5; }
.ai-note { margin: -2px 0 8px; }
.la-base { display: flex; justify-content: space-between; align-items: center; font-size: 13px; padding: 6px 10px; background: var(--bg); border-radius: 10px; margin-bottom: 8px; }
.la-base b { color: var(--accent); }
@media (prefers-color-scheme: dark) { .ai-btn { background: #2a2340; color: #cdbdff; border-color: #4d3f7a; } }
.la-mode { margin-bottom: 0; flex: none; }
.la-mode button { font-size: 14px; min-height: 40px; }
.la-desc { font-size: 13px; line-height: 1.6; color: var(--muted); margin: 0 0 10px; }
.la-desc b { color: var(--ink); font-weight: 600; }
#la-extra { width: 100%; resize: vertical; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 13.5px; background: var(--bg); color: var(--ink); margin-bottom: 10px; }
#la-ai-go { min-height: 48px; font-size: 16px; }
.la-more { margin-top: 6px; font-size: 13px; }
.la-more summary { cursor: pointer; color: var(--muted); padding: 4px 0; }
.la-fixrow { align-items: center; }
.la-fixrow .btn { flex: 0 0 auto; }
.la-fixrow input { flex: 1; accent-color: var(--accent); }
.la-tools button small { font-size: 10.5px; }
.la-empty { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.6; font-size: 15px; color: var(--muted); background: #fff; }
.la-empty small { font-size: 12px; }
.la-stage.aimode #la-marks { display: none; }
/* AI 模型选择 */
.la-model { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 10px 0; margin-bottom: 10px; }
.la-model-head { display: flex; justify-content: space-between; align-items: center; }
.la-k { font-size: 12px; color: var(--muted); }
.la-link { border: 0; background: none; color: var(--accent); font: inherit; font-size: 13px; padding: 2px 0; cursor: pointer; }
.la-model-name { font-size: 15px; font-weight: 600; margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.la-model-sub { font-size: 12px; color: var(--muted); margin-top: 2px; word-break: break-all; }
.la-tag { font-size: 11px; font-weight: 500; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; margin-left: 6px; }
.la-model-name .la-tag { margin-left: 0; }
.la-model-list { margin-top: 10px; max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.la-model-note { font-size: 11.5px; color: var(--muted); margin: 0; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.la-model-row { display: grid; grid-template-columns: 1fr auto; column-gap: 8px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); font: inherit; padding: 8px 10px; cursor: pointer; }
.la-model-row:last-child { border-bottom: 0; }
.la-model-row:hover { background: var(--bg); }
.la-model-row.on { background: var(--accent-soft); }
.la-model-row .nm { font-size: 13.5px; font-weight: 600; }
.la-model-row .pr { font-size: 12.5px; color: var(--ink); font-variant-numeric: tabular-nums; }
.la-model-row .id { grid-column: 1 / -1; font-size: 11px; color: var(--muted); word-break: break-all; }
.la-last { display: flex; align-items: baseline; gap: 8px; font-size: 13px; margin-top: 10px; padding: 8px 10px; border-radius: 10px; background: var(--bg); }
.la-last span { color: var(--muted); font-size: 12px; }
.la-last b { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.la-last em { font-style: normal; font-variant-numeric: tabular-nums; }
/* 用户管理 */
.u-list { margin-top: 12px; border-top: 1px solid var(--line); }
.u-row { display: flex; flex-direction: column; gap: 3px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); padding: 12px 2px; cursor: pointer; }
.u-row:active { background: var(--bg); }
.u-name { font-size: 16px; font-weight: 600; display: flex; align-items: center; }
.u-sub { font-size: 13px; color: var(--muted); }
.la-tag.warn { color: var(--warn); border-color: var(--warn); }
.ue-limits { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.ue-limits label { margin-bottom: 0; font-size: 13px; }
.ue-limits[hidden] { display: none; }
.ue-usage { font-size: 13px; color: var(--muted); margin-top: 10px; line-height: 1.6; }
#ue-form .setting:last-of-type { margin-bottom: 14px; }
label.check { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 14px; }
label.check input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--accent); }
.cred { margin: 0 0 6px; padding: 14px; border-radius: 12px; background: var(--bg); font: inherit; font-size: 15px; line-height: 1.8; white-space: pre-wrap; word-break: break-all; user-select: all; -webkit-user-select: all; }

/* 选择模式 */
.pick { display: none; }
.selecting .row .handle { display: none; }
.selecting .row .pick { display: grid; place-items: center; height: 64px; }
.selecting .row .pick::before { content: ""; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--muted); box-sizing: border-box; }
.selecting .row.picked .pick::before { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--paper); }
.selecting .row .acts { visibility: hidden; }
.selecting .row { cursor: pointer; }
.selecting .row.picked { box-shadow: 0 0 0 2px var(--accent); }
.selbar .btn[disabled] { opacity: .4; }

/* 框选修改文字 */
.te-stage { flex: 1; min-height: 0; position: relative; display: flex; overflow: auto; background: var(--line); border-radius: 14px; padding: 10px; -webkit-overflow-scrolling: touch; }
.te-frame { flex: none; position: relative; margin: auto; line-height: 0; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.12); }
.te-frame img { display: block; width: 100%; height: 100%; -webkit-user-drag: none; user-select: none; }
.te-frame canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.te-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 22px; }
.te-bar .la-tip { text-align: left; flex: 1; }
.te-zoom { display: flex; align-items: center; gap: 10px; font-size: 13px; flex: none; }
.te-zoom b { font-weight: 500; color: var(--muted); min-width: 40px; text-align: center; font-variant-numeric: tabular-nums; }
#te-text { width: 100%; resize: vertical; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 15px; background: var(--bg); color: var(--ink); margin-bottom: 4px; }
.te-stepper { height: 36px; }
.te-stepper .btn { min-width: 40px; min-height: 36px; }
.te-stepper span { min-width: 64px; font-size: 13px; }
#view-edit .la-field .seg { flex: 0 0 200px; }
#view-edit input[type=color] { width: 64px; height: 32px; padding: 0 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.te-item { display: flex; gap: 8px; align-items: baseline; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); padding: 8px 2px; font: inherit; font-size: 13.5px; cursor: pointer; }
.te-item:last-child { border-bottom: 0; }
.te-item span { color: var(--muted); font-size: 12px; flex: none; }
.te-item b { font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.te-item.on b { color: var(--accent); }
@media (max-width: 860px) { .te-stage { height: 58dvh; flex: none; } }
#te-form.locked > :not(#te-src):not(.la-row) { display: none; }
.te-bgrow { display: flex; gap: 8px; align-items: center; }
.te-bgrow .seg { flex: 0 0 150px; }
#te-bgmode button { font-size: 13px; }
.te-ai { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
.te-cands { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.te-cands:empty { display: none; }
.te-cands button { border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 8px; padding: 4px 10px; font: inherit; font-size: 13px; cursor: pointer; }
.te-cands button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.te-orig { font-size: 13px; flex: none; -webkit-user-select: none; user-select: none; touch-action: none; }
