:root {
  --bg: #f5f6f8;
  --panel: #fff;
  --panel-2: #fafafa;
  --text: #1f2937;
  --text-2: #374151;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #9ca3af;
  --input-border: #d1d5db;
  --sidebar: #1f2937;
  --primary: #2563eb;
  --primary-soft: #eff4ff;
  --primary-line: #bfdbfe;
  --primary-text: #1e40af;
  --green: #059669;
  --green-soft: #ecfdf5;
  --orange: #d97706;
  --orange-soft: #fff7ed;
  --orange-faint: #fffdf8;
  --orange-line: #fed7aa;
  --orange-text: #9a3412;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --red-line: #fecaca;
  --gray-soft: #f3f4f6;
  --radius: 8px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --panel: #181b21;
    --panel-2: #1d2027;
    --text: #e5e7eb;
    --text-2: #cbd0d8;
    --muted: #9097a3;
    --line: #2a2e36;
    --line-strong: #4b515c;
    --input-border: #353a44;
    --sidebar: #12141a;
    --primary: #3b82f6;
    --primary-soft: #1a2540;
    --primary-line: #2f4a80;
    --primary-text: #a9c4ff;
    --green: #10b981;
    --green-soft: #12291f;
    --orange: #f59e0b;
    --orange-soft: #2c2010;
    --orange-faint: #1f1b14;
    --orange-line: #6b4a17;
    --orange-text: #fcd28d;
    --red: #f05252;
    --red-soft: #2e1616;
    --red-line: #6b2222;
    --gray-soft: #22262e;
  color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115;
  --panel: #181b21;
  --panel-2: #1d2027;
  --text: #e5e7eb;
  --text-2: #cbd0d8;
  --muted: #9097a3;
  --line: #2a2e36;
  --line-strong: #4b515c;
  --input-border: #353a44;
  --sidebar: #12141a;
  --primary: #3b82f6;
  --primary-soft: #1a2540;
  --primary-line: #2f4a80;
  --primary-text: #a9c4ff;
  --green: #10b981;
  --green-soft: #12291f;
  --orange: #f59e0b;
  --orange-soft: #2c2010;
  --orange-faint: #1f1b14;
  --orange-line: #6b4a17;
  --orange-text: #fcd28d;
  --red: #f05252;
  --red-soft: #2e1616;
  --red-line: #6b2222;
  --gray-soft: #22262e;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; overscroll-behavior: none; }
.layout, .sidebar, .nav, .main { overscroll-behavior: none; }
a { color: var(--primary); text-decoration: none; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; }
input, select, textarea, button { font: inherit; color: inherit; }

/* 布局 */
.layout { display: flex; min-height: 100vh; }
/* z-index：侧栏浮层要压住主栏，否则「手机登录」侧向浮窗会被主内容盖住 */
.sidebar { width: 200px; background: var(--sidebar); color: #d1d5db; flex-shrink: 0; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; z-index: 20; }
.brand { font-weight: 700; font-size: 18px; color: #fff; padding: 18px 20px; letter-spacing: 1px; }
.nav { flex: 1; overflow-y: auto; padding: 4px 10px; }
.nav a { display: flex; align-items: center; color: #d1d5db; padding: 9px 12px; border-radius: 6px; margin-bottom: 2px; }
.nav a:hover { background: rgba(255,255,255,.06); }
.nav a.active { background: #374151; color: #fff; }
.nav .sep { height: 1px; background: #374151; margin: 8px 4px; }
.userbox { padding: 10px; border-top: 1px solid #374151; font-size: 13px; flex-shrink: 0; }
.userbox .name { color: #fff; font-weight: 600; }
.userbox a { color: #9ca3af; margin-right: 12px; }
/* 账号选单侧向浮窗：手机登录 / 切换人员视角 共用 .um-float（即时显隐、同款面板） */
.um-float {
  position: absolute; z-index: 960;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px;
  box-shadow: none;
  transition: none !important; animation: none !important;
}
.tm-viewas { position: relative; }
.tm-viewas-btn { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; color: var(--text-2); padding: 7px 8px; border-radius: 4px; cursor: pointer; font-size: 13px; text-align: left; }
.tm-viewas-btn:hover, .tm-viewas.open .tm-viewas-btn { background: var(--gray-soft); color: var(--text); }
.tm-viewas-btn .ic { width: 18px; height: 18px; color: var(--muted); }
.tm-viewas-pop {
  left: calc(100% + 6px); bottom: 0;
  min-width: 180px; max-width: 240px; max-height: min(280px, 46vh); overflow-y: auto; padding: 4px;
}
.viewas-item {
  display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none;
  color: var(--text-2); padding: 6px 8px; border-radius: 4px; cursor: pointer; font: inherit; font-size: 13px; text-align: left;
}
.viewas-item:hover { background: var(--gray-soft); color: var(--text); }
.viewas-item-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewas-empty { padding: 10px 8px; font-size: 12px; }
@media (max-width: 700px) {
  .tm-viewas-pop { left: 0; right: 0; bottom: calc(100% + 4px); max-width: none; }
}
.main { flex: 1; min-width: 0; padding: 24px 28px 60px; max-width: 1200px; }
.topbar { display: none; }
/* 各主内容页标题统一槽位：同一起点、同一行高，旁侧控件不挤偏标题 */
.page-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 18px;
  min-height: 32px;
}
.page-head > h1 {
  font-size: 20px;
  font-weight: 700;
  line-height: 32px;
  margin: 0;
  flex: 0 0 auto;
}
.page-head > .back-link {
  line-height: 32px;
  min-height: 32px;
}
.page-head .spacer { flex: 1; min-width: 8px; }

.nav-backdrop { display: none; }
@media (max-width: 800px) {
  .layout { display: block; }
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(0, 0, 0, .35);
    border: 0;
    padding: 0;
    cursor: pointer;
  }
  /* 100svh：浏览器底栏展开时侧栏仍落在可见视口内，避免账号入口被挡 */
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 50;
    transform: translateX(-100%); transition: transform .2s; width: 230px;
    height: 100vh; height: 100dvh; height: 100svh;
    padding-top: env(safe-area-inset-top, 0px);
    box-sizing: border-box;
  }
  .sidebar.open { transform: none; }
  /* 账号入口：预留手机浏览器底栏(~56px) + 8px 呼吸 + home indicator 安全区 */
  .userbox {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }
  .topbar { display: flex; align-items: center; gap: 10px; background: var(--sidebar); color: #fff; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); position: sticky; top: 0; z-index: 40; }
  .topbar button { background: none; border: 0; color: #fff; font-size: 22px; padding: 0 4px; }
  .topbar .t { font-weight: 600; }
  .main { padding: 14px 12px 60px; padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }
  .hide-m { display: none !important; }
}

/* 通用组件 */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card.tight { padding: 12px 14px; }
.grid { display: grid; gap: 12px; }
.grid.stats { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 14px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat .v { font-size: 24px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 13px; }
a.stat { color: inherit; }
a.stat:hover { border-color: var(--line-strong); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); padding: 7px 14px; border-radius: 6px; cursor: pointer; white-space: nowrap; color: var(--text); }
.btn:hover { border-color: var(--line-strong); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.orange { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn.danger { color: var(--red); border-color: var(--red-line); }
.btn.danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn.lg { padding: 11px 18px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.link-btn { background: none; border: 0; color: var(--primary); cursor: pointer; padding: 0; }

.field { margin-bottom: 14px; }
.field > label { display: block; font-weight: 600; margin-bottom: 5px; font-size: 13px; }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--input-border); border-radius: 6px; padding: 8px 10px; background: var(--panel); }
.input:focus { outline: 2px solid var(--primary-line); border-color: var(--primary); }
textarea.input { min-height: 80px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .row2 { grid-template-columns: 1fr; } }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button { border: 1px solid var(--line); background: var(--panel); padding: 5px 12px; border-radius: 99px; cursor: pointer; font-size: 13px; }
.tabs button.on { background: var(--text); color: var(--bg); border-color: var(--text); }
/* 目标商品列表：紧凑状态分段 + 独立「我的」 */
.lead-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.seg-control { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--panel); }
.seg-control button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 12px; padding: 4px 9px; cursor: pointer; line-height: 1.35; }
.seg-control button + button { border-left: 1px solid var(--line); }
.seg-control button:hover:not(.on) { color: var(--text-2); }
.seg-control button.on { color: var(--text); background: var(--gray-soft); font-weight: 600; }
.seg-control button.soft:not(.on) { color: #b0b6be; }
.filter-toggle { border: 1px solid var(--line); background: var(--panel); color: var(--muted); font: inherit; font-size: 12px; padding: 4px 10px; border-radius: 6px; cursor: pointer; line-height: 1.35; }
.filter-toggle:hover:not(.on) { color: var(--text-2); border-color: var(--line-strong); }
.filter-toggle.on { color: var(--text); border-color: var(--text); background: var(--gray-soft); font-weight: 600; }
.lead-adv-wrap { position: relative; display: inline-flex; align-items: center; margin-left: 2px; }
.lead-adv-btn.on { color: var(--text); background: var(--gray-soft); }
.lead-adv-btn.active { color: var(--primary); background: var(--primary-soft); }
.lead-adv-btn.active:hover { color: var(--primary-text); background: var(--primary-soft); }
.lead-adv-pop {
  right: 0; left: auto; top: calc(100% + 6px);
  width: min(320px, 92vw); padding: 12px 12px 10px;
  display: flex; flex-direction: column; gap: 12px; z-index: 40;
  border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .08);
}
.lead-adv-field { display: flex; flex-direction: column; gap: 8px; }
.lead-adv-field + .lead-adv-field { padding-top: 10px; border-top: 1px solid var(--line); }
.lead-adv-label { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.lead-adv-pop .people-grid { gap: 8px 6px; }
.lead-adv-clear {
  width: 100%; margin-top: 2px; padding: 8px 12px; font-size: 13px; font-weight: 600;
  border-radius: 8px; border-color: var(--line-strong); background: var(--gray-soft);
}
.lead-adv-clear:hover { border-color: var(--text); background: var(--panel-2); }
.person.dim, .person:disabled { opacity: .38; cursor: default; color: var(--muted); }
.person.dim:hover, .person:disabled:hover { color: var(--muted); }
.person.dim:hover .person-ava, .person:disabled:hover .person-ava { box-shadow: none; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.toolbar .input { width: auto; flex: 1; min-width: 160px; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; background: var(--gray-soft); color: var(--muted); white-space: nowrap; }
.badge.quiet { background: transparent; border: 1px solid var(--line); color: var(--text-2); border-radius: 4px; padding: 0 6px; font-weight: 500; }
.badge.blue { background: var(--primary-soft); color: var(--primary); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.orange { background: var(--orange-soft); color: var(--orange); }
.badge.red { background: var(--red-soft); color: var(--red); }

/* 仓库：类型筛选为主，少胶囊 */
.stock-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.stock-toolbar .stock-kind { flex: 0 1 148px; min-width: 120px; font-weight: 600; }
.stock-toolbar .stock-q { flex: 1 1 180px; min-width: 140px; }
.stock-toolbar .stock-status { flex: 0 1 132px; min-width: 110px; }
@media (max-width: 560px) {
  .stock-toolbar .stock-kind, .stock-toolbar .stock-status { flex: 1 1 calc(50% - 4px); }
}
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, Menlo, monospace; }
.price { font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.pre { white-space: pre-wrap; word-break: break-word; }

table.t { width: 100%; border-collapse: collapse; background: var(--panel); }
table.t th, table.t td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--panel-2); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; }

/* 列表卡片 */
.list-item { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px; color: inherit; }
a.list-item:hover { border-color: var(--line-strong); }
.list-item .top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.list-item .title { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .meta { color: var(--muted); font-size: 12px; margin-top: 4px; display: flex; gap: 12px; flex-wrap: wrap; }
.list-item.locked { border-left: 4px solid var(--orange); background: var(--orange-faint); }
.list-item.masked { color: var(--muted); background: var(--panel-2); }
.specs { font-size: 13px; margin-top: 6px; color: var(--text-2); }
.specs span + span::before { content: " · "; color: #9ca3af; }

.lock-banner { background: var(--orange-soft); border: 1px solid var(--orange-line); color: var(--orange-text); padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; font-weight: 600; }
.lock-banner.mine { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary-text); }

.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs .th { position: relative; width: 84px; height: 84px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); background: var(--gray-soft); }
.thumbs .th img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.thumbs .th .x { position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,.6); color: #fff; border: 0; border-radius: 50%; width: 20px; height: 20px; line-height: 18px; cursor: pointer; }
.thumbs .add { width: 84px; height: 84px; border: 1px dashed var(--line-strong); border-radius: 6px; display: flex; align-items: center; justify-content: center; color: var(--muted); cursor: pointer; font-size: 26px; }

.kv { display: grid; grid-template-columns: 90px 1fr; gap: 6px 12px; }
.kv .k { color: var(--muted); }

.parts-edit .prow { display: grid; grid-template-columns: 108px 1fr 60px 1fr 30px; gap: 8px; align-items: start; margin-bottom: 8px; }
.parts-edit .cat { font-weight: 600; font-size: 13px; white-space: nowrap; padding-top: 8px; }
.parts-edit.priced .prow { grid-template-columns: 108px 1fr 60px 110px 1fr 30px; }
.parts-edit .price-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.parts-edit.config-edit .prow { grid-template-columns: 108px 1fr 1fr 30px; }
.config-view { display: flex; flex-direction: column; gap: 6px; }
.config-row { display: grid; grid-template-columns: 88px 1fr; gap: 8px 12px; align-items: baseline; font-size: 14px; line-height: 1.45; }
.config-row .config-cat { color: var(--muted); font-weight: 600; font-size: 13px; }
.config-row .config-note { grid-column: 2; font-size: 13px; }
.parts-total { text-align: right; font-size: 13px; color: var(--muted); margin: 4px 0 8px; }
.price-hint { font-size: 11px; line-height: 1.3; margin-top: 2px; }
@media (max-width: 700px) {
  .parts-edit .prow, .parts-edit.priced .prow { grid-template-columns: 1fr 56px 30px; background: var(--panel-2); padding: 8px; border-radius: 6px; align-items: center; }
  .parts-edit.config-edit .prow { grid-template-columns: 1fr 30px; }
  .parts-edit .cat { grid-column: 1 / -1; padding-top: 0; }
  .parts-edit .pnote, .parts-edit .price-cell { grid-column: 1 / -1; }
}

/* 权限选单：模板在上、按业务域分组；单行勾选，说明放悬停 tip */
.perm-picker { display: flex; flex-direction: column; gap: 14px; }
.perm-presets-h, .perm-group-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.perm-presets-h .muted, .perm-group-h .muted { font-weight: 500; }
.perm-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.perm-chip { appearance: none; border: 1px solid var(--line); background: var(--panel); color: var(--text-2); font: inherit; font-size: 12px; line-height: 1.2; padding: 5px 10px; border-radius: 999px; cursor: pointer; }
.perm-chip:hover { color: var(--text); border-color: var(--line-strong); }
.perm-chip.on { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); font-weight: 600; }
.perm-chip.quiet { color: var(--muted); }
.perm-chip:disabled { opacity: .4; cursor: default; }
.perm-groups { display: flex; flex-direction: column; gap: 10px; }
.perm-group + .perm-group { padding-top: 10px; border-top: 1px solid var(--line); }
.perm-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 1px 8px; }
.perm-item { display: flex; align-items: center; gap: 7px; margin: 0; padding: 5px 4px; border-radius: 4px; cursor: pointer; font-weight: normal; color: var(--text-2); }
.perm-item:hover { background: var(--gray-soft); color: var(--text); }
.perm-item.on { color: var(--text); }
.perm-item input { margin: 0; flex-shrink: 0; }
.perm-item-text { min-width: 0; }
.perm-item-label { font-size: 13px; line-height: 1.25; }
.perm-item[data-tip]::after { white-space: normal; max-width: 220px; text-align: left; left: 0; transform: none; }
@media (max-width: 560px) { .perm-list { grid-template-columns: 1fr; } }

/* 弹窗与提示 */
.modal-mask { position: fixed; inset: 0; background: rgba(17,24,39,.5); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--panel); color: var(--text); border-radius: 10px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; padding: 20px; }
.modal.wide { max-width: 760px; }
.modal h2 { margin-bottom: 10px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal.warn { border-top: 6px solid var(--red); }
.modal.warn .big { font-size: 17px; font-weight: 700; color: var(--red); margin-bottom: 8px; }
.toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 200; max-width: 90vw; display: flex; align-items: center; gap: 12px; }
.toast.err { background: var(--red); }
.toast-act { background: none; border: 0; color: #93c5fd; font: inherit; font-weight: 600; cursor: pointer; padding: 0; }
.toast-act:hover { color: #bfdbfe; }
.img-view { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 150; display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.img-view img { max-width: 95vw; max-height: 95vh; }
.qr-box { text-align: center; }
.qr-box img { width: 260px; max-width: 100%; }

/* 目标商品：谈判/检视模式 + 详情分层布局（非卡片墙） */
.mode-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--panel); }
.mode-switch button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; padding: 5px 10px; cursor: pointer; }
.mode-switch button + button { border-left: 1px solid var(--line); }
.mode-switch button.on { color: var(--text); background: var(--gray-soft); font-weight: 600; }
.lead-detail { max-width: 920px; }
.lead-detail .page-head { position: relative; gap: 8px; }
.lead-layout { display: flex; gap: 28px; align-items: flex-start; }
.lead-col { flex: 1; min-width: 0; }
.lead-band { padding: 14px 0; border-bottom: 1px solid var(--line); }
.lead-band:last-child { border-bottom: 0; }
.lead-h { margin: 0 0 8px; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .04em; text-transform: none; }
.lead-h .muted { font-weight: 500; letter-spacing: 0; }
.lead-h-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.lead-h-row .lead-h { margin: 0; }
.lead-id-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
button.lead-code { font-size: 15px; font-weight: 600; color: var(--text-2); background: none; border: 0; padding: 0; cursor: pointer; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
button.lead-code:hover { color: var(--text); }
.lead-price { font-size: 20px; font-weight: 700; }
.lead-title { margin: 0 0 8px; font-size: 18px; font-weight: 600; line-height: 1.35; word-break: break-word; }
.lead-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 13px; color: var(--muted); }
.lead-meta a { color: var(--primary-text); }
.lead-uploader { display: inline-flex; line-height: 0; border-radius: 50%; }
.lead-link-row { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.lead-url { flex: 1; min-width: 0; font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-link-row .link-btn { flex-shrink: 0; font-size: 13px; color: var(--muted); }
.lead-link-row .link-btn:hover { color: var(--primary-text); }
/* 桌面：宽屏 QR 侧栏；窄桌面用链接区 inline；谈判自动展示 / 检视留白 */
.lead-qr-aside { flex: 0 0 200px; position: sticky; top: 12px; }
.lead-qr-panel-inline { display: none; margin-top: 12px; }
.lead-qr-inline { display: flex; align-items: center; gap: 14px; padding: 4px 0 0; }
.lead-qr-inline.stacked { flex-direction: column; align-items: flex-start; gap: 10px; }
.lead-qr-inline img {
  width: 180px; height: 180px; flex-shrink: 0;
  image-rendering: pixelated; background: #fff;
  border: 1px solid var(--line); border-radius: 4px;
}
.lead-qr-panel-inline .lead-qr-inline img { width: 160px; height: 160px; }
.lead-qr-caption { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.lead-qr-caption p { margin: 0; }
.lead-qr-caption .btn .ic { width: 14px; height: 14px; }
.lead-qr-slot {
  display: block; width: 180px; height: 180px; padding: 0;
  border: 1px dashed var(--line); border-radius: 4px;
  background: transparent; cursor: pointer;
}
.lead-qr-slot.sm { width: 160px; height: 160px; }
.lead-qr-slot:hover:not(:disabled) { border-color: var(--line-strong); background: var(--gray-soft); }
.lead-qr-slot:disabled { cursor: wait; opacity: .7; }
.lead-lock-line {
  display: flex; align-items: center; gap: 6px;
  margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--primary-text);
}
.lead-lock-line.other { color: var(--orange-text); }
.lead-lock-line .ic { width: 14px; height: 14px; }
.lead-ops { margin: 0; }
.lead-result-note, .lead-unqual-body { margin: 8px 0 0; font-size: 14px; color: var(--text-2); white-space: pre-wrap; line-height: 1.5; }
.lead-unqual .lead-unqual-body { margin-top: 0; }
.lead-admin-empty { margin: 0; }
.lead-more-toggle {
  display: inline-flex; align-items: baseline; gap: 8px;
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--text-2);
}
.lead-more-toggle:hover { color: var(--text); }
.lead-more-body { margin-top: 10px; }
.lead-more-block + .lead-more-block { margin-top: 14px; }
.lead-band .pre { margin: 0; font-size: 14px; line-height: 1.55; }
.list-item .meta .avatar { vertical-align: -4px; margin-right: 2px; }
.list-item .lead-unqual-reason { color: var(--text-2); max-width: 42%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 860px) {
  .lead-qr-aside { display: none; }
  .lead-qr-panel-inline { display: block; }
  .lead-detail { max-width: 720px; }
}
@media (max-width: 700px) {
  .page-head .mode-switch { order: 3; width: 100%; margin-top: 4px; }
  .lead-layout { display: block; }
  .lead-band { padding: 12px 0; }
  .lead-price { font-size: 18px; }
  .lead-title { font-size: 16px; }
}

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login .brand { display: flex; align-items: center; gap: 8px; }
.login-logo { width: 26px; height: 26px; }
.login { width: 100%; max-width: 360px; }
.login .brand { color: var(--text); padding: 0 0 6px; font-size: 24px; }

.hist { font-size: 13px; }
.hist .h { padding: 8px 0; border-bottom: 1px solid var(--line); }
.hist .h:last-child { border-bottom: 0; }
.chg { font-size: 12px; color: var(--muted); margin-top: 3px; }
.chg del { color: var(--red); }
.chg ins { color: var(--green); text-decoration: none; }

.combo { position: relative; }
.combo .input { padding-right: 28px; }
.combo .caret { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); color: var(--muted); cursor: pointer; font-size: 12px; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 2px); background: var(--panel); border: 1px solid var(--input-border); border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.12); max-height: 240px; overflow-y: auto; z-index: 30; }
.combo-list .opt { padding: 7px 10px; cursor: pointer; font-size: 13px; line-height: 1.35; }
.combo-list .opt:hover, .combo-list .opt.hi { background: var(--gray-soft); }
.combo-list .opt.hi { outline: none; }

.ic { width: 18px; height: 18px; fill: currentColor; flex-shrink: 0; vertical-align: middle; }
.tm-mask { position: fixed; inset: 0; z-index: 940; }
.tm-list { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 950; min-width: 160px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: none; padding: 4px; }
.tm-list button { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; color: var(--text-2); padding: 7px 8px; border-radius: 4px; cursor: pointer; font-size: 13px; text-align: left; }
.tm-list button:hover { background: var(--gray-soft); }
.tm-list button.on { color: var(--text); font-weight: 600; }
.tm-list button span { flex: 1; }
.tm-list .ic { width: 18px; height: 18px; color: var(--muted); }
.tm-sep { height: 1px; background: var(--line); margin: 4px 2px; }
.user-menu { position: relative; }
.user-menu.open { z-index: 950; }
.um-trigger { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; padding: 6px 10px; border-radius: 6px; cursor: pointer; color: inherit; text-align: left; }
.um-trigger:hover { background: #374151; }
.um-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.um-trigger .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.um-sub { font-size: 11px; color: #fbbf24; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; height: 32px; }
.view-switch button { border: 0; background: var(--panel); color: var(--text); padding: 0 14px; height: 32px; line-height: 30px; cursor: pointer; }
.view-switch button.on { background: var(--gray-soft); color: var(--text); font-weight: 600; }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; margin-bottom: 12px; }
.filters .input { padding: 6px 8px; }
.result-count-row { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; min-height: 24px; }
.result-count { color: var(--muted); font-size: 13px; margin: 0; }
.sort-wrap { position: relative; display: inline-flex; }
.sort-btn.on { color: var(--text); background: var(--gray-soft); }
.sort-pop { left: 0; top: calc(100% + 4px); min-width: 148px; padding: 4px; display: flex; flex-direction: column; gap: 1px; }
.sort-pop button { border: 0; background: transparent; text-align: left; font: inherit; font-size: 13px; color: var(--text-2); padding: 7px 10px; border-radius: 6px; cursor: pointer; line-height: 1.3; }
.sort-pop button:hover { background: var(--gray-soft); color: var(--text); }
.sort-pop button.on { color: var(--text); font-weight: 600; background: var(--gray-soft); }
.viewas-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--orange-soft); border: 1px solid var(--orange-line); color: var(--orange-text); padding: 8px 12px; border-radius: var(--radius); margin-bottom: 14px; }
.viewas-bar .btn { margin-left: auto; }
.avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; background: #f0f0f0; display: block; }
.avatar-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.avatar-opt { border: 2px solid transparent; border-radius: 50%; padding: 2px; background: none; cursor: pointer; }
.avatar-opt:hover { border-color: var(--line-strong); }
.count-dot { display: inline-block; min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; text-align: center; margin-left: 4px; }

/* 我的账号 */
.me-head { display: flex; gap: 14px; align-items: center; }
.me-avatar { position: relative; }
.avatar-btn { position: relative; background: none; border: 0; padding: 0; cursor: pointer; border-radius: 50%; display: block; }
.avatar-edit { position: absolute; inset: 0; border-radius: 50%; background: rgba(0,0,0,.42); color: #fff; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s; }
.avatar-edit .ic { width: 20px; height: 20px; }
.avatar-btn:hover .avatar-edit, .avatar-btn:focus-visible .avatar-edit { opacity: 1; }
.me-info { flex: 1; min-width: 0; }
.me-name { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.icon-btn { background: none; border: 0; padding: 3px; border-radius: 4px; color: var(--muted); cursor: pointer; display: inline-flex; line-height: 0; }
.icon-btn:hover { color: var(--text); background: var(--gray-soft); }
.me-id { display: flex; align-items: center; gap: 4px; }
.role-ic { color: var(--green); display: inline-flex; cursor: default; }
.role-ic .ic { width: 15px; height: 15px; }
.nick-edit { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.nick-edit .input { width: 140px; padding: 5px 8px; }
.nick-edit .hint { flex-basis: 100%; }
.pop { position: absolute; z-index: 61; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.14); padding: 10px; }
/* 须高于 .tm-mask(940)，否则遮罩挡掉上传/换一批点击 */
.avatar-pop { left: 0; top: calc(100% + 6px); width: 282px; z-index: 950; }
.avatar-pop .avatar-grid { gap: 4px; }
.pop-foot { display: flex; gap: 14px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.icon-text { display: inline-flex; align-items: center; gap: 5px; background: none; border: 0; padding: 0; color: var(--muted); font-size: 13px; cursor: pointer; }
.icon-text:hover { color: var(--text); }
.me-actions { display: flex; gap: 20px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }

/* 图标在各处的尺寸与对齐 */
.back-link { display: inline-flex; align-items: center; gap: 2px; }
.back-link .ic { width: 18px; height: 18px; }
.with-ic { display: inline-flex; align-items: center; gap: 3px; }
.with-ic .ic { width: 15px; height: 15px; }
.thumbs .th .x { display: flex; align-items: center; justify-content: center; padding: 0; }
.thumbs .th .x .ic { width: 14px; height: 14px; }
.thumbs .add .ic { width: 22px; height: 22px; }
.combo .caret { display: inline-flex; }
.combo .caret .ic { width: 14px; height: 14px; }
.topbar button .ic { width: 22px; height: 22px; display: block; }
.link-btn .ic { width: 14px; height: 14px; }
.lock-banner .ic, .hint .ic { width: 14px; height: 14px; vertical-align: -2px; }

/* 共享悬停浮窗 .ui-tip：由 UiTip JS 挂到 body；[data-tip] 触发；无过渡、无延迟 */
.ui-tip {
  position: fixed;
  z-index: 1000;
  box-sizing: border-box;
  max-width: min(280px, calc(100vw - 16px));
  padding: 4px 8px;
  border-radius: 4px;
  background: #111827;
  color: #f9fafb;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  /* 即时显隐：禁止任何过渡/延迟 */
  transition: none !important;
  animation: none !important;
}
.ui-tip[hidden] { display: none !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ui-tip { background: #e5e7eb; color: #111827; }
}
:root[data-theme="dark"] .ui-tip { background: #e5e7eb; color: #111827; }

/* 页面主操作：顶部一行靠左；表单提交：右对齐页脚 */
.action-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

/* 首页：信息/待办在上；下方安静描边入口（可点、非大主按钮墙） */
.home-info { margin-bottom: 14px; max-width: 560px; }
.home-msg {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; margin-bottom: 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); color: inherit; text-decoration: none;
}
.home-msg:hover { border-color: var(--line-strong); }
.home-msg.hot { border-color: var(--primary-line); background: var(--primary-soft); }
.home-msg-ic { display: flex; color: var(--muted); flex-shrink: 0; }
.home-msg.hot .home-msg-ic { color: var(--primary-text); }
.home-msg-ic .ic { width: 20px; height: 20px; }
.home-msg-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.home-msg-title { font-weight: 600; font-size: 14px; line-height: 1.3; }
.home-msg-sum { font-size: 13px; color: var(--text-2); line-height: 1.35; }
.home-msg > .ic { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.home-sec-label {
  font-size: 12px; font-weight: 600; color: var(--muted);
  letter-spacing: .02em; margin: 0 0 6px; padding: 0 2px;
}
.home-todos { display: flex; flex-direction: column; gap: 2px; }
.home-todo {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 6px;
  color: inherit; text-decoration: none; font-size: 14px;
}
.home-todo:hover { background: var(--panel-2); }
.home-todo-l { flex: 1; min-width: 0; color: var(--text); }
.home-todo-v {
  font-variant-numeric: tabular-nums; font-weight: 600;
  color: var(--text-2); font-size: 13px; min-width: 1.5em; text-align: right;
}
.home-calm { margin: 4px 2px 0; font-size: 13px; }

.home-quick {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  max-width: 560px; margin-top: 10px; padding: 0;
}
.home-quick-link {
  display: inline-flex; align-items: center; justify-content: center;
  box-sizing: border-box; min-height: 36px; padding: 8px 14px;
  border: 1px solid var(--primary); border-radius: 6px;
  background: var(--primary-soft); color: var(--primary-text);
  font-size: 13px; font-weight: 600; line-height: 1.3;
  text-decoration: none; cursor: pointer;
}
.home-quick-link:hover {
  border-color: var(--primary); color: var(--primary-text);
  background: var(--panel);
}
.home-quick-link:active { background: var(--panel-2); }

@media (max-width: 800px) {
  .home-info, .home-quick { max-width: none; }
  .home-msg { padding: 11px 12px; }
  .home-todo { padding: 9px 8px; }
  .home-quick-link { min-height: 40px; padding: 10px 16px; }
}
.form-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.form-foot .btn { min-width: 84px; }

/* 个人设置 */
.choice-row { display: flex; gap: 8px; flex-wrap: wrap; }
.choice { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--text-2); padding: 8px 14px; border-radius: 6px; cursor: pointer; }
.choice:hover { border-color: var(--line-strong); }
.choice.on { border-color: var(--text); color: var(--text); font-weight: 600; }
/* 上传表单：标签右侧的扫码入口 */
.label-row { display: flex; align-items: center; justify-content: space-between; }
.scan-btn { margin-bottom: 4px; }

/* 在线状态（仅超管的账号列表） */
.presence { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 400; }
.presence i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.presence.on i { background: var(--green); }

/* 消息（站内信）：单一主表面，点开展开，无二级菜单 */
.net-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; margin-bottom: 12px; border-radius: var(--radius);
  font-size: 13px; font-weight: 600; border: 1px solid transparent;
}
.net-bar .ic { width: 18px; height: 18px; }
.net-bar.off { background: color-mix(in srgb, var(--red) 12%, var(--panel)); border-color: var(--red-line); color: var(--red); }
.net-bar.ok { background: color-mix(in srgb, #16a34a 12%, var(--panel)); border-color: color-mix(in srgb, #16a34a 35%, var(--line)); color: #15803d; }
.letter-bar { display: flex; align-items: center; gap: 8px; background: var(--primary-soft); border: 1px solid var(--primary-line); color: var(--primary-text); padding: 9px 14px; border-radius: var(--radius); margin-bottom: 14px; font-weight: 600; }
.letter-bar .spacer { flex: 1; }
.letter-bar:hover { border-color: var(--primary); }
.letters-page .page-head { flex-wrap: wrap; gap: 8px 12px; }
.letters-page .page-head .letter-filters { flex-shrink: 0; }
.letters-page .page-head .view-switch button { padding: 0 10px; font-size: 13px; }
.letter-compose { margin-bottom: 14px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex-shrink: 0; }
.letter-row { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); margin-bottom: 8px; overflow: hidden; }
.letter-row.open { border-color: var(--line-strong); }
.letter-row-head { display: block; width: 100%; text-align: left; border: 0; background: none; color: inherit; padding: 12px 14px; cursor: pointer; font: inherit; }
.letter-row-head:hover { background: var(--panel-2); }
.letter-preview { color: var(--text-2); font-size: 14px; margin: 6px 0 0 36px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.letter-row.unread .letter-preview { color: var(--text); font-weight: 600; }
.letter-from { display: flex; align-items: center; gap: 8px; }
.letter-from .spacer { flex: 1; }
.letter-chevron { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.letter-row.open .letter-chevron { transform: rotate(0deg); }
.letter-expand { padding: 0 14px 14px; border-top: 1px solid var(--line); }
/* 顶栏右侧：已读头像（明暗）→ 状态胶囊 → 箭头；胶囊宽度统一对齐 */
.letter-readers-mini { display: inline-flex; align-items: center; gap: 2px; flex-shrink: 0; }
.letter-status { flex-shrink: 0; min-width: 4.2em; text-align: center; }
.letter-action-mode { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 8px 0 4px; }
.letter-action-mode .view-switch { flex-wrap: wrap; }
.letter-action-mode .view-switch button { padding: 0 10px; font-size: 12px; height: 28px; line-height: 26px; }
.letter-row.archived-row { opacity: .88; }
.letter-row.pinned { border-color: color-mix(in srgb, var(--orange-line, #f59e0b) 55%, var(--line)); }
.letter-pin-mark {
  flex-shrink: 0; font-size: 10px; font-weight: 700; line-height: 1;
  padding: 2px 5px; border-radius: 3px; background: var(--orange-soft, #fff7ed); color: var(--orange-text, #c2410c);
}
.letter-ctx {
  position: fixed; z-index: 1100; min-width: 148px; padding: 4px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0,0,0,.16); transition: none !important;
}
.letter-ctx button {
  display: block; width: 100%; border: 0; background: none; text-align: left;
  font: inherit; font-size: 13px; color: var(--text-2); padding: 8px 10px; border-radius: 4px; cursor: pointer;
}
.letter-ctx button:hover { background: var(--gray-soft); color: var(--text); }
.letter-ctx button:disabled { opacity: .45; cursor: default; }
.job-title-edit { display: flex; gap: 8px; align-items: center; }
.job-title-edit .input { flex: 1; min-width: 0; }
.reader-ava { display: inline-flex; align-items: center; color: var(--text-2); }
.reader-ava.named { flex-direction: column; gap: 4px; width: 48px; text-align: center; }
.reader-ava-img { position: relative; display: block; line-height: 0; border-radius: 50%; }
/* 未读淡化；已读正常亮度——不用绿色勾 */
.reader-ava.unread .avatar { opacity: .38; filter: grayscale(.6); }
.reader-ava.unread .reader-name { opacity: .5; }
.reader-name { display: block; width: 100%; font-size: 11px; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-ava { border-radius: 50%; background: var(--gray-soft); color: var(--muted); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.chat-ava.sm { width: 28px; height: 28px; }
.letter-body { white-space: pre-wrap; word-break: break-word; line-height: 1.7; }
.ref-chip { display: inline-flex; align-items: center; gap: 4px; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; color: var(--text-2); background: var(--panel); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; margin: 0 2px; }
a.ref-chip:hover { border-color: var(--line-strong); }
.ref-chip .ic { width: 14px; height: 14px; color: var(--muted); }
.group-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.group-chip { display: inline-flex; align-items: center; gap: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--panel); }
.group-chip > button { border: 0; background: none; color: var(--text-2); font-size: 12px; padding: 3px 8px; cursor: pointer; line-height: 1.3; }
.group-chip > button:hover { color: var(--text); background: var(--gray-soft); }
.group-chip > button.x { padding: 3px 5px; color: var(--muted); border-left: 1px solid var(--line); }
.group-chip > button.x .ic { width: 12px; height: 12px; }
.tag-filter { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.filter-chip { border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 12px; padding: 3px 9px; border-radius: 6px; cursor: pointer; line-height: 1.3; }
.filter-chip:hover { color: var(--text-2); border-color: var(--line-strong); }
.filter-chip.on { color: var(--text); border-color: var(--text); background: var(--gray-soft); font-weight: 500; }
.tag-pill { display: inline-block; padding: 1px 7px; margin: 1px 3px 1px 0; border-radius: 6px; font-size: 12px; background: var(--gray-soft); color: var(--text-2); white-space: nowrap; }
.tag-pill.pick { border: 1px solid var(--line); background: var(--panel); cursor: pointer; margin: 0; }
.tag-pill.pick.on { border-color: var(--text); color: var(--text); background: var(--gray-soft); font-weight: 500; }
.tag-pick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.count-tag { display: inline-block; margin-left: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.choice.sm { padding: 4px 10px; font-size: 13px; }
/* 收信人：头像在上、昵称在下（昵称短，格子尽量窄；无卡片底） */
.people-grid { display: flex; flex-wrap: wrap; gap: 6px 4px; }
.person { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 48px; border: 0; background: none; color: var(--muted); padding: 2px 0 0; border-radius: 0; cursor: pointer; text-align: center; }
.person.static { cursor: default; color: var(--text-2); }
.person-ava { position: relative; display: block; line-height: 0; border-radius: 50%; box-shadow: 0 0 0 1.5px transparent; transition: box-shadow .12s; }
.person-name { display: block; width: 100%; font-size: 12px; line-height: 1.15; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-check { display: none; position: absolute; right: -2px; bottom: -2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text); color: var(--panel); align-items: center; justify-content: center; box-shadow: 0 0 0 1.5px var(--bg); }
.person-check .ic { width: 10px; height: 10px; }
.person:hover { color: var(--text-2); }
.person:hover .person-ava { box-shadow: 0 0 0 1.5px var(--line-strong); }
.person.on { color: var(--text); }
.person.on .person-ava { box-shadow: 0 0 0 1.5px var(--text); }
.person.on .person-check { display: flex; }
.check-row { display: flex; align-items: center; gap: 8px; margin: 4px 0 0; cursor: pointer; }
.picker-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.picker-list { max-height: 50vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; }
.picker-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; background: none; border: 0; border-top: 1px solid var(--line); cursor: pointer; text-align: left; color: var(--text); }
.picker-row .grow { flex: 1; min-width: 0; }
.picker-row:first-child { border-top: 0; }
.picker-row:hover { background: var(--panel-2); }
.picker-row.on { background: var(--gray-soft); }

/* 扫码弹窗：近全幅取景，引导框只做轻提示（解码用整帧） */
.scan-modal { max-width: min(560px, 94vw); width: 100%; }
.scan-view { position: relative; background: #000; border-radius: 8px; overflow: hidden; aspect-ratio: 1; }
.scan-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* 桌面端预览镜像（用户期望）；解码仍用未镜像帧。手机触控设备不加 .mirror */
.scan-view video.mirror { transform: scaleX(-1); }
.scan-frame {
  position: absolute; inset: 4%;
  border: 1.5px solid rgba(255,255,255,.78);
  border-radius: 8px;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.18);
  pointer-events: none;
}
.scan-modal .foot { justify-content: flex-start; }
.scan-modal .foot .spacer { flex: 1; }
@media (min-width: 800px) {
  .scan-modal { max-width: 640px; }
  .scan-view { aspect-ratio: 4 / 3; }
}

/* 在手机上登录：悬停二维码（与视角浮窗同 .um-float） */
.phone-qr { position: relative; display: inline-flex; }
.phone-qr-pop.um-float {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 220px; padding: 12px; text-align: center;
}
.phone-qr-pop.below { top: calc(100% + 6px); left: 50%; transform: translateX(-50%); }
.phone-qr-pop.side { left: calc(100% + 6px); bottom: -4px; }
.phone-qr-pop.right { left: calc(100% + 12px); top: 50%; transform: translateY(-50%); }
.phone-qr-pop img { width: 180px; height: 180px; image-rendering: pixelated; }
.phone-qr-pop::before { content: ''; position: absolute; inset: -10px; z-index: -1; }
.login-phone { display: flex; justify-content: center; margin: 14px auto 0; width: fit-content; }
.tm-list .phone-qr { display: flex; width: 100%; }
.tm-list .phone-qr-trigger { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border-radius: 4px; font-size: 13px; color: var(--text-2); }
.tm-list .phone-qr-trigger:hover { background: var(--gray-soft); }
.tm-list .phone-qr-trigger .ic { color: var(--muted); }
.tm-list button.danger, .tm-list button.danger .ic { color: var(--red); }
.tm-logout-confirm {
  display: flex; flex-direction: column; gap: 6px; padding: 6px 8px 8px;
  border-radius: 4px; background: var(--gray-soft);
}
.tm-logout-q {
  display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); font-weight: 600;
}
.tm-logout-q .ic { width: 18px; height: 18px; color: var(--red); }
.tm-logout-acts { display: flex; gap: 6px; }
.tm-logout-acts button {
  flex: 1; justify-content: center; width: auto; padding: 6px 8px; font-size: 13px;
  border: 1px solid var(--line); border-radius: 4px; background: var(--panel); color: var(--text-2);
}
.tm-logout-acts button:hover { background: var(--panel); color: var(--text); border-color: var(--line-strong); }
.tm-logout-acts button.danger {
  color: #fff; background: var(--red); border-color: var(--red); font-weight: 600;
}
.tm-logout-acts button.danger:hover { filter: brightness(0.95); color: #fff; background: var(--red); }
.tm-logout-acts button.danger .ic { color: #fff; }
.phone-qr-pop .mono { color: var(--text-2); }

/* 链接按钮、导航、图标、图片都不允许拖出来（像桌面应用一样） */
a, img, svg, button, .btn { -webkit-user-drag: none; user-drag: none; }
.btn, .nav a, .tabs button, .view-switch button, .seg-control button, .filter-toggle, .mode-switch button, .um-trigger, .tm-list button, .icon-text, .chat-item { user-select: none; -webkit-user-select: none; }

/* 管理页 / 人员：头像+昵称在下；在线人数与「管理」同字号、仅颜色更淡 */
/* 与「管理」同字号，颜色再淡一档（比 --muted 更安静） */
.page-head .staff-count { font-size: 20px; font-weight: 400; line-height: 1.2; color: color-mix(in srgb, var(--muted) 58%, transparent); }
.staff-block { margin-bottom: 16px; }
.staff-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 6px; margin-bottom: 6px; }
.staff-switch { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.staff-ava { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 48px; color: var(--text-2); text-decoration: none; border-radius: 6px; padding: 2px 0; background: none; border: 0; cursor: pointer; font: inherit; }
.staff-ava:hover { color: var(--text); }
.staff-ava.cur { color: var(--text); }
.staff-ava.cur .staff-ava-img { outline: 2px solid var(--primary); outline-offset: 1px; }
.staff-ava-img { position: relative; display: block; line-height: 0; border-radius: 50%; }
.staff-ava.off .avatar { opacity: .45; filter: grayscale(.6); }
.staff-ava.off .staff-name { opacity: .55; }
.staff-ava i { position: absolute; right: 0; bottom: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); border: 2px solid var(--bg); }
.staff-ava i.on { background: var(--green); }
.staff-name { display: block; width: 100%; font-size: 11px; line-height: 1.15; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 人员面板 */
.staff-actions { flex-wrap: wrap; align-items: center; gap: 10px; }
.staff-edit-title { margin: 0 0 12px; font-size: 15px; font-weight: 600; }

/* 已读：小图标 + 悬停头像；未读的变淡 */
.read-ind { position: relative; display: inline-flex; color: var(--line-strong); cursor: default; padding: 2px; }
.read-ind.all { color: var(--green); }
.read-ind .ic { width: 16px; height: 16px; }
.read-pop { display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 70; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.14); padding: 8px; min-width: 150px; max-width: 280px; flex-wrap: wrap; gap: 6px; }
.read-pop::before { content: ''; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }
.read-ind:hover .read-pop { display: flex; }
.read-person { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.read-person.unread { opacity: .4; filter: grayscale(1); }
/* 登录页：二维码贴着登录框右侧浮出，不挡输入框 */
.login { position: relative; }
.login .phone-qr.login-phone { position: static; }
.login .phone-qr-pop.right { left: calc(100% + 12px); top: auto; bottom: 0; transform: none; }
@media (max-width: 700px) { .login .phone-qr-pop.right { left: 50%; top: calc(100% + 8px); bottom: auto; transform: translateX(-50%); } }
.letter-bar .bar-x { color: inherit; opacity: .6; margin-left: 4px; } .letter-bar .bar-x:hover { opacity: 1; background: none; }

/* 侧栏的数字：不用红圆点，靠右的灰色小数字 */
.nav .count-dot { margin-left: auto; background: rgba(255,255,255,.12); color: #e5e7eb; font-weight: 600; min-width: 20px; height: 18px; line-height: 18px; border-radius: 9px; }
.nav a.active .count-dot { background: rgba(255,255,255,.2); }

/* 消息展开区：正文、处理备注、回信（已读并入顶栏头像角标，不再占大块底栏） */
.letter-body { margin-top: 12px; }
.letter-progress { margin-top: 8px; }
.letter-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.letter-actions .spacer { flex: 1; }
.done-note { margin-top: 8px; color: var(--text-2); font-size: 13px; white-space: pre-wrap; padding: 6px 8px; background: var(--panel-2); border-radius: 6px; }
.letter-replies { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.letter-reply { display: flex; gap: 8px; align-items: flex-start; }
.letter-reply-main { flex: 1; min-width: 0; }
.letter-reply-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; font-size: 13px; }
.letter-reply-body { white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height: 1.55; color: var(--text); }
.letter-reply-form { margin-top: 12px; display: flex; gap: 8px; align-items: flex-end; }
.letter-reply-form .input { flex: 1; min-height: 44px; resize: vertical; }
.letter-reply-form .btn { flex-shrink: 0; }
@media (max-width: 640px) {
  .letters-page .page-head .letter-filters { order: 3; width: 100%; overflow-x: auto; }
  .letters-page .page-head .view-switch { display: flex; width: max-content; max-width: 100%; }
  .letter-reply-form { flex-direction: column; align-items: stretch; }
}
/* 侧栏左上角：只放一个灰度的小箱子 */
.brand-logo { display: block; padding: 18px 20px 14px; width: fit-content; }
.brand-logo img { width: 22px; height: 22px; display: block; filter: grayscale(1); opacity: .55; transition: opacity .15s; }
.brand-logo:hover img { opacity: .85; }

/* ---------- 价格表（紧凑长列表 + 可折叠档位） ---------- */
/* 价格表：一板（分类+列表+添加），高密度，少装饰 */
.price-list-page { max-width: 640px; }
.price-list-page .page-head.compact { margin-bottom: 6px; gap: 8px; align-items: center; }
.price-list-page .page-head.compact h1 { margin: 0; font-size: 18px; line-height: 1.2; }
.price-list-page .page-head .price-search {
  width: min(180px, 36vw); height: 26px; padding: 2px 8px; font-size: 12.5px; flex: 0 1 180px;
}

.price-panel {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); overflow: hidden;
  display: flex; flex-direction: column; min-height: 0;
}
.price-cats {
  display: flex; flex-wrap: wrap; gap: 0;
  border-bottom: 1px solid var(--line); background: var(--panel-2);
}
.price-cats button {
  margin: 0; border: 0; border-right: 1px solid var(--line); border-radius: 0;
  background: transparent; color: var(--muted); font: inherit; font-size: 12px;
  padding: 4px 9px; cursor: pointer; line-height: 1.2;
}
.price-cats button:last-child { border-right: 0; }
.price-cats button:hover { color: var(--text); background: var(--panel); }
.price-cats button.on { color: var(--text); font-weight: 600; background: var(--panel); }

.price-list-scroll {
  max-height: min(68vh, 620px); overflow: auto; overscroll-behavior: contain;
}
.price-block { border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }
.price-block:last-child { border-bottom: 0; }
.price-block.dragging { opacity: .45; }
.price-block.drag-over > .price-row { box-shadow: inset 0 2px 0 var(--primary); }
.price-list-page.proto.edit .price-block { cursor: grab; }
.price-list-page.proto.edit .price-block:active { cursor: grabbing; }
.price-block.saving > .price-row { background: color-mix(in srgb, var(--primary) 5%, transparent); }

.price-list-page.proto .price-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px;
  gap: 0 8px; align-items: center;
  padding: 0 8px; min-height: 24px; position: relative;
}
.price-list-page.proto.edit .price-row {
  grid-template-columns: minmax(0, 1fr) 84px 22px;
  padding-right: 4px;
}
.price-row.price-colhead {
  min-height: 18px; padding-top: 3px; padding-bottom: 1px;
  font-size: 10px; font-weight: 600; letter-spacing: .02em; color: var(--muted);
  border-bottom: 1px solid var(--line); background: var(--panel);
  position: sticky; top: 0; z-index: 1;
}
.price-row.price-colhead .col-price { text-align: right; padding-right: 2px; }
.price-row .col-name { min-width: 0; display: flex; align-items: center; }
.price-row .col-name .input.bare { flex: 1; min-width: 0; width: 100%; }
.price-row .name-ro {
  font-size: 12.5px; font-weight: 500; line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 3px 0;
}
.price-row .col-price {
  text-align: right; display: flex; align-items: center; justify-content: flex-end; gap: 2px; min-width: 0;
}
.price-row .col-price .yen { flex: 0 0 auto; font-size: 11px; color: var(--muted); line-height: 1; }
.price-row .col-price .price {
  display: block; width: 100%; font-variant-numeric: tabular-nums; font-size: 12.5px; line-height: 1.2; padding: 3px 0;
}
.price-list-page.proto .price-row .input.bare {
  border: 0; background: transparent; height: 22px; padding: 1px 0; font-size: 12.5px; border-radius: 0;
  box-shadow: none;
}
.price-list-page.proto .price-row .input.bare:focus {
  outline: none; background: color-mix(in srgb, var(--primary) 5%, transparent);
}
.price-list-page.proto .price-row .price-inp {
  flex: 1 1 auto; min-width: 0; width: auto; text-align: right; font-variant-numeric: tabular-nums;
}
.price-list-page.proto .row-del {
  opacity: 0; pointer-events: none;
  width: 20px; height: 20px; padding: 0; border: 0; border-radius: 3px;
  background: transparent; color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.price-list-page.proto .price-row:hover .row-del,
.price-list-page.proto .price-row:focus-within .row-del { opacity: 1; pointer-events: auto; }
.price-list-page.proto .row-del:hover { color: var(--red); background: color-mix(in srgb, var(--red) 12%, transparent); }
.price-list-page.proto .row-del .ic { width: 13px; height: 13px; }

.price-add-row {
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--primary) 4%, var(--panel));
  margin: 0; width: 100%; box-sizing: border-box;
  flex-shrink: 0; min-height: 28px;
}
.price-add-row .col-name .input.bare::placeholder,
.price-add-row .price-inp::placeholder { color: var(--muted); opacity: 1; }
.price-list-page.proto .row-add {
  width: 22px; height: 22px; padding: 0; border: 1px solid var(--line); border-radius: 3px;
  background: var(--panel); color: var(--text); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.price-list-page.proto .row-add:hover:not(:disabled),
.price-list-page.proto .row-add:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.price-list-page.proto .row-add:disabled { opacity: .4; cursor: default; border-color: var(--line); color: var(--muted); }
.price-list-page.proto .row-add .ic { width: 14px; height: 14px; }

.empty-row { padding: 8px; text-align: center; font-size: 12px; }

.price-note-block.compact {
  margin: 10px 0 0; padding: 0; border: 0; background: transparent; border-radius: 0;
}
.price-note-h { display: flex; align-items: center; gap: 6px; min-height: 20px; margin-bottom: 2px; }
.price-note-label { font-size: 11px; font-weight: 600; color: var(--muted); }
.price-note-body.md, .price-note-banner.md, .md { font-size: 12.5px; line-height: 1.45; color: var(--text-2); }
.price-note-body.md :is(h2, h3, h4), .price-note-banner.md :is(h2, h3, h4), .md :is(h2, h3, h4) {
  margin: 0.3em 0 0.15em; color: var(--text); font-size: 13px;
}
.price-note-body.md p, .price-note-banner.md p, .md p { margin: 0.2em 0; }
.price-note-body.md ul, .price-note-body.md ol,
.price-note-banner.md ul, .price-note-banner.md ol,
.md ul, .md ol { margin: 0.2em 0; padding-left: 1.2em; }
.price-note-body.md code, .price-note-banner.md code, .md code {
  font-family: ui-monospace, Menlo, monospace; font-size: 11px;
  background: var(--panel-2); padding: 0 4px; border-radius: 3px;
}
.price-note-banner {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 12px; margin-bottom: 10px;
}
.price-note-edit .btn-row.tight { margin-top: 6px; gap: 6px; }
.price-note-add { margin-top: 8px; font-size: 12px; color: var(--muted); }
.price-note-add:hover { color: var(--primary); }

.icon-btn.sm {
  width: 26px; height: 26px; padding: 0; border: 0; border-radius: 4px;
  background: transparent; color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px;
}
.icon-btn.sm:hover { background: var(--panel-2); color: var(--text); }
.icon-btn.sm.danger:hover { color: var(--red); background: color-mix(in srgb, var(--red) 12%, transparent); }
.icon-btn.sm .ic { width: 15px; height: 15px; }

@media (max-width: 700px) {
  .price-list-page.proto .price-row { grid-template-columns: minmax(0, 1fr) 72px; padding: 0 6px; }
  .price-list-page.proto.edit .price-row { grid-template-columns: minmax(0, 1fr) 72px 20px; }
  .price-cats { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .price-cats button { flex: 0 0 auto; }
  .price-list-scroll { max-height: min(62vh, 520px); }
}


/* ---------- 搜集 master–detail（桌面左右；窄屏详情全幅） ---------- */
.lead-md {
  display: grid;
  grid-template-columns: minmax(280px, 40%) minmax(0, 1fr);
  gap: 0 14px;
  align-items: start;
}
.lead-md:not(.open) { grid-template-columns: 1fr; }
.lead-md:not(.open) .lead-md-placeholder { display: none; }
.lead-md-master { min-width: 0; }
.lead-md-detail {
  min-width: 0;
  position: sticky;
  top: 6px;
  max-height: calc(100vh - 20px);
  overflow: auto;
  border-left: 1px solid var(--line);
  padding-left: 14px;
}
.lead-md-placeholder {
  display: flex; align-items: center; justify-content: center;
  min-height: 220px; color: var(--muted); font-size: 13px;
  border-left: 1px solid var(--line); padding: 24px;
}
.lead-md .list-item.on {
  background: var(--gray-soft);
  box-shadow: inset 3px 0 0 var(--primary);
}
@media (max-width: 860px) {
  .lead-md { display: block; }
  .lead-md.open .lead-md-master { display: none; }
  .lead-md.open .lead-md-detail {
    border-left: 0; padding-left: 0; position: static; max-height: none; overflow: visible;
  }
  .lead-md-placeholder { display: none !important; }
}
