:root {
  --bg: #f2f4f7;
  --card: #ffffff;
  --ink: #17212b;
  --ink-2: #5b6b7b;
  --ink-3: #93a1b0;
  --brand: #1f5ce0;
  --brand-2: #4f8bff;
  --brand-soft: #eaf0fd;
  --green: #0f9d58;
  --green-soft: #e7f6ee;
  --amber: #b46a00;
  --amber-soft: #fdf3e3;
  --red: #d23f31;
  --red-soft: #fdecea;
  --hair: rgba(23, 33, 43, 0.05);
  --shadow-card: 0 0 0 1px rgba(23, 33, 43, 0.03), 0 1px 2px rgba(23, 33, 43, 0.04), 0 4px 16px rgba(23, 33, 43, 0.06);
  --shadow-pop: 0 2px 6px rgba(23, 33, 43, 0.08), 0 12px 32px rgba(23, 33, 43, 0.14);
  --shadow-brand: 0 2px 8px rgba(31, 92, 224, 0.30);
  --r-lg: 18px;
  --r-md: 12px;
  --r-in: 10px;   /* 卡片内嵌面（与卡片外径保持同心） */
  --r-sm: 8px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
}

.num { font-variant-numeric: tabular-nums; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- 顶栏 ---------- */
header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(242, 244, 247, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 14px 16px 10px;
  box-shadow: 0 1px 0 var(--hair);
}
header h1 { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; text-wrap: balance; }
header .sub { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
header .badge {
  float: right; margin-top: 2px;
  font-size: 11px; font-weight: 600; color: var(--brand);
  background: var(--brand-soft); border-radius: 999px; padding: 4px 10px;
}

/* ---------- 页面容器 ---------- */
main { padding: 4px 14px 130px; }
.page { display: none; }
.page.active { display: block; animation: pageIn 0.22s var(--ease); }
@keyframes pageIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: 14px;
  margin-bottom: 12px;
}
.card.slim { padding: 11px 14px; }
.card h3 { font-size: 14px; font-weight: 650; margin-bottom: 8px; text-wrap: balance; }
.muted { color: var(--ink-2); font-size: 13px; }
.tiny { color: var(--ink-3); font-size: 11.5px; }

/* ---------- 聊天 ---------- */
#chat-log { display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }
.msg { display: flex; gap: 8px; opacity: 0; transform: translateY(6px); animation: rise 0.32s var(--ease) forwards; }
@keyframes rise { to { opacity: 1; transform: translateY(0); } }
.msg.user { flex-direction: row-reverse; }
.avatar {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 10px;
  display: grid; place-items: center; font-size: 15px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff;
  box-shadow: 0 2px 6px rgba(31, 92, 224, 0.35);
}
.msg.user .avatar { background: #dfe5ec; color: var(--ink-2); box-shadow: none; }
.bubble {
  max-width: 86%;
  background: var(--card); border-radius: 16px; border-top-left-radius: 6px;
  box-shadow: var(--shadow-card);
  padding: 10px 12px; font-size: 14px;
}
.msg.user .bubble {
  background: linear-gradient(180deg, #2b6af0, #1d55d6); color: #fff;
  border-radius: 16px; border-top-right-radius: 6px;
  box-shadow: var(--shadow-brand);
}
.bubble .b-title { font-weight: 650; font-size: 13.5px; margin-bottom: 6px; }

/* AI 结果卡内的行 */
.hit {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--r-in);
  background: #f7f9fb; margin-top: 6px;
}
.hit .ico {
  width: 38px; height: 38px; flex: 0 0 38px; border-radius: 10px;
  display: grid; place-items: center; font-size: 19px;
  background: #fff; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.hit .info { flex: 1; min-width: 0; }
.hit .l1 { font-size: 13.5px; font-weight: 600; }
.hit .l2 { font-size: 11.5px; color: var(--ink-3); }
.hit .qty { font-size: 15px; font-weight: 700; color: var(--brand); white-space: nowrap; }
.hit .qty small { font-size: 11px; font-weight: 500; color: var(--ink-3); }

.tag { display: inline-block; font-size: 10.5px; font-weight: 600; border-radius: 6px; padding: 1.5px 6px; margin-left: 5px; vertical-align: 1px; }
.tag.vw   { background: var(--brand-soft); color: var(--brand); }
.tag.vac  { background: var(--green-soft); color: var(--green); }
.tag.wh   { background: #eef1f5; color: var(--ink-2); }
.tag.rent { background: var(--amber-soft); color: var(--amber); }
.tag.hi   { background: var(--red-soft); color: var(--red); }

/* 意图确认卡 / 差异表 */
.intent { border-radius: var(--r-in); background: #f7f9fb; padding: 10px 12px; margin-top: 8px; font-size: 13px; }
.intent .row { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.intent .row .k { color: var(--ink-3); flex: 0 0 auto; }
.intent .row .v { text-align: right; font-weight: 600; }
.fee { color: var(--brand); font-weight: 700; }

.ai-note {
  margin-top: 8px; padding: 9px 11px; border-radius: var(--r-in);
  background: var(--amber-soft); color: var(--amber); font-size: 12.5px;
}
.ai-note.ok { background: var(--green-soft); color: var(--green); }

.diff-row { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid #f0f2f5; font-size: 13.5px; }
.diff-row:last-child { border-bottom: none; }
.diff-delta { font-weight: 700; }
.diff-delta.minus { color: var(--red); }
.diff-delta.plus { color: var(--green); }
.diff-delta.zero { color: var(--ink-3); font-weight: 500; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px;
  border: none; border-radius: var(--r-md);
  background: linear-gradient(180deg, #2b6af0, #1d55d6); color: #fff;
  box-shadow: var(--shadow-brand);
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer;
  transition-property: transform, opacity, filter, background-color;
  transition-duration: 0.15s;
  transition-timing-function: var(--ease);
}
.btn:active { transform: scale(0.96); }
.btn.ghost { background: var(--brand-soft); color: var(--brand); box-shadow: none; }
.btn.danger { background: linear-gradient(180deg, #e05343, #cb3a2c); box-shadow: 0 2px 8px rgba(210, 63, 49, 0.30); }
.btn.small { min-height: 36px; padding: 0 13px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; margin-top: 10px; }
.btn:disabled { opacity: 0.45; pointer-events: none; }
@media (hover: hover) {
  .btn:hover { filter: brightness(1.06); }
  .chip:hover { transform: translateY(-1px); }
  .room-card:hover, .sku-row:hover { transform: translateY(-1px); box-shadow: var(--shadow-pop); }
  .idle-row:hover { background: #f7f9fb; }
}

/* 快捷指令条 */
#chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 4px; scrollbar-width: none; }
#chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; min-height: 40px; display: inline-flex; align-items: center; gap: 5px;
  background: var(--card); border-radius: 999px; padding: 0 14px;
  font-size: 13px; font-weight: 550; color: var(--ink);
  box-shadow: var(--shadow-card); border: none; font-family: inherit; cursor: pointer;
  transition-property: transform; transition-duration: 0.15s; transition-timing-function: var(--ease);
}
.chip:active { transform: scale(0.96); }

/* 输入区 */
#composer {
  position: fixed; bottom: 60px; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; padding: 8px 14px 10px;
  background: linear-gradient(to top, var(--bg) 75%, transparent);
  display: flex; gap: 8px; z-index: 25;
}
#composer input {
  flex: 1; min-height: 44px; border: none; border-radius: 999px;
  background: var(--card); box-shadow: var(--shadow-card);
  padding: 0 16px; font-size: 14px; font-family: inherit; color: var(--ink);
  outline: none;
}
#composer input::placeholder { color: var(--ink-3); }
#composer input:focus-visible { outline: 2px solid var(--brand); outline-offset: 0; }
#composer .btn { border-radius: 999px; min-width: 64px; }
#cam-btn, #mic-btn {
  min-width: 44px; width: 44px; padding: 0; border-radius: 999px;
  border: none; cursor: pointer; min-height: 44px;
  display: grid; place-items: center;
  background: var(--card); color: var(--ink-2); box-shadow: var(--shadow-card);
  font-size: 18px; font-family: inherit;
  transition-property: transform; transition-duration: 0.15s; transition-timing-function: var(--ease);
}
#cam-btn:active, #mic-btn:active { transform: scale(0.96); }

/* 录音态：隐藏常规输入，仅显示录音条 */
#composer.recording #cam-btn, #composer.recording #mic-btn,
#composer.recording #chat-input, #composer.recording #send-btn { display: none; }
#rec-bar {
  flex: 1; display: flex; align-items: center; gap: 9px;
  min-height: 44px; padding: 0 5px 0 6px;
  background: var(--card); border-radius: 999px; box-shadow: var(--shadow-card);
}
#rec-bar[hidden] { display: none; }
#rec-cancel {
  min-width: 34px; width: 34px; min-height: 34px; border: none; border-radius: 999px;
  background: #f0f2f5; color: var(--ink-2); font-size: 14px; font-weight: 700;
  cursor: pointer; font-family: inherit;
}
.rec-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: var(--red); animation: recPulse 1s ease-in-out infinite; }
@keyframes recPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
#rec-time { font-size: 12.5px; font-weight: 650; color: var(--ink-2); min-width: 32px; }
.wave { flex: 1; display: flex; align-items: center; justify-content: center; gap: 3.5px; height: 24px; }
.wave i {
  width: 3px; border-radius: 2px; height: 100%;
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
  animation: wv 0.9s ease-in-out infinite; transform-origin: center;
}
.wave i:nth-child(1) { animation-delay: 0s;    height: 34%; }
.wave i:nth-child(2) { animation-delay: 0.12s; height: 62%; }
.wave i:nth-child(3) { animation-delay: 0.24s; height: 88%; }
.wave i:nth-child(4) { animation-delay: 0.36s; height: 50%; }
.wave i:nth-child(5) { animation-delay: 0.48s; height: 74%; }
.wave i:nth-child(6) { animation-delay: 0.60s; height: 42%; }
.wave i:nth-child(7) { animation-delay: 0.72s; height: 90%; }
.wave i:nth-child(8) { animation-delay: 0.84s; height: 58%; }
.wave i:nth-child(9) { animation-delay: 0.96s; height: 38%; }
@keyframes wv { 0%, 100% { transform: scaleY(0.45); } 50% { transform: scaleY(1); } }

/* 转写规范化预览条（发送前确认） */
#voice-strip {
  position: fixed; bottom: 118px; left: 50%; transform: translateX(-50%);
  width: calc(100% - 28px); max-width: 452px; z-index: 26;
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow-pop);
  padding: 10px 34px 10px 12px;
  animation: rise 0.28s var(--ease);
}
#voice-strip[hidden] { display: none; }
.vs-x {
  position: absolute; top: 7px; right: 7px;
  min-width: 26px; width: 26px; min-height: 26px; border: none; border-radius: 999px;
  background: #f0f2f5; color: var(--ink-3); font-size: 12px; cursor: pointer; font-family: inherit;
}
.vs-raw { font-size: 12px; color: var(--ink-3); }
.vs-clean { font-size: 13.5px; font-weight: 650; margin-top: 3px; display: flex; align-items: center; gap: 7px; }
.vs-badges { font-size: 10.5px; color: var(--green); margin-top: 4px; font-weight: 550; }

/* ---------- 底部导航 ---------- */
nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 30;
  display: flex;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 -1px 0 rgba(23, 33, 43, 0.07);
  padding-bottom: env(safe-area-inset-bottom);
}
nav button {
  flex: 1; min-height: 56px; border: none; background: none; font-family: inherit;
  font-size: 10.5px; font-weight: 600; color: var(--ink-3); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  transition-property: color, transform; transition-duration: 0.15s; transition-timing-function: var(--ease);
  position: relative;
}
nav button:active { transform: scale(0.96); }
nav button .ni { display: grid; place-items: center; height: 22px; }
nav button .ni svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
nav button.on { color: var(--brand); }
nav button.on .ni svg { stroke-width: 2.1; }

.nav-badge {
  position: absolute; top: 7px; left: calc(50% + 6px);
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700;
  display: grid; place-items: center;
}
.nav-badge[hidden] { display: none; }

/* ---------- 台账 ---------- */
.seg {
  display: flex; gap: 2px; margin: 10px 0;
  background: #e6eaef; border-radius: var(--r-md); padding: 3px;
}
.seg button {
  flex: 1; min-height: 34px; border: none; border-radius: 9px;
  background: none; font-family: inherit; font-size: 13px; font-weight: 600;
  color: var(--ink-2); cursor: pointer;
  transition-property: background-color, color, box-shadow; transition-duration: 0.18s; transition-timing-function: var(--ease);
}
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(23, 33, 43, 0.10); }

.search {
  width: 100%; min-height: 42px; border: none; border-radius: var(--r-md);
  background: var(--card); box-shadow: var(--shadow-card);
  padding: 0 14px; font-size: 14px; font-family: inherit; color: var(--ink);
  outline: none; margin-bottom: 12px;
  -webkit-appearance: none;
}
.search::placeholder { color: var(--ink-3); }
.search:focus-visible { outline: 2px solid var(--brand); outline-offset: 0; }

.bsel { display: flex; gap: 7px; overflow-x: auto; padding: 0 0 12px; scrollbar-width: none; }
.bsel::-webkit-scrollbar { display: none; }
.bsel button {
  flex: 0 0 auto; min-height: 38px; padding: 0 15px; border: none; border-radius: 999px;
  background: var(--card); box-shadow: var(--shadow-card);
  font-size: 13px; font-weight: 600; color: var(--ink-2); font-family: inherit; cursor: pointer;
  transition-property: background-color, color, transform; transition-duration: 0.15s; transition-timing-function: var(--ease);
}
.bsel button:active { transform: scale(0.96); }
.bsel button.on { background: linear-gradient(180deg, #2b6af0, #1d55d6); color: #fff; box-shadow: var(--shadow-brand); }

.room-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.room-card {
  background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow-card);
  padding: 12px; cursor: pointer;
  opacity: 0; animation: rise 0.3s var(--ease) forwards;
  transition-property: transform, box-shadow; transition-duration: 0.18s; transition-timing-function: var(--ease);
}
.room-card:active { transform: scale(0.97); }
.room-card .rid { font-size: 15px; font-weight: 700; }
.room-card .rmeta { font-size: 11.5px; color: var(--ink-3); margin: 2px 0 8px; }
.room-card .rcnt { font-size: 12.5px; color: var(--ink-2); }
.room-card .rcnt b { color: var(--brand); font-size: 15px; }

.inv-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f0f2f5; }
.inv-row:last-child { border-bottom: none; }
.inv-row .ico { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; background: #f7f9fb; }
.inv-row .info { flex: 1; }
.inv-row .l1 { font-size: 13.5px; font-weight: 600; }
.inv-row .l2 { font-size: 11.5px; color: var(--ink-3); }
.inv-row .qty { font-size: 16px; font-weight: 700; }

.flow-row { padding: 8px 0; border-bottom: 1px solid #f0f2f5; font-size: 12.5px; }
.flow-row:last-child { border-bottom: none; }
.flow-row .f1 { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.flow-row .f1 .via { flex: 0 0 auto; font-weight: 600; color: var(--brand); font-size: 10.5px; background: var(--brand-soft); border-radius: 6px; padding: 1px 7px; height: fit-content; }
.flow-row .f2 { color: var(--ink-3); font-size: 11.5px; margin-top: 1px; }

.back-btn { background: none; border: none; color: var(--brand); font-size: 14px; font-weight: 600; font-family: inherit; padding: 6px 0 10px; cursor: pointer; min-height: 40px; }

/* SKU 类目视图 */
.cat-h { display: flex; align-items: center; gap: 10px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin: 16px 2px 8px; letter-spacing: 0.05em; }
.cat-h::after { content: ''; flex: 1; height: 1px; background: rgba(23, 33, 43, 0.07); }
.cat-h:first-of-type { margin-top: 4px; }
.sku-row {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 11px 12px; margin-bottom: 8px;
  transition-property: transform, box-shadow; transition-duration: 0.18s; transition-timing-function: var(--ease);
}
.sku-row:active { transform: scale(0.98); }
.sku-row .ico { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 11px; display: grid; place-items: center; font-size: 20px; background: #f7f9fb; }
.sku-row .info { flex: 1; min-width: 0; }
.sku-row .l1 { font-size: 13.5px; font-weight: 650; }
.sku-row .l2 { font-size: 11.5px; color: var(--ink-3); }
.sku-row .r { text-align: right; }
.sku-row .qty { font-size: 15px; font-weight: 700; }
.sku-row .qty small { font-size: 10.5px; font-weight: 500; color: var(--ink-3); }
.sku-row .idle { font-size: 10.5px; color: var(--green); font-weight: 600; }
.chev { color: var(--ink-3); font-size: 16px; font-weight: 600; padding-left: 2px; }

.sku-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.sku-head .ico.big { width: 52px; height: 52px; flex: 0 0 52px; border-radius: 14px; display: grid; place-items: center; font-size: 27px; background: #f7f9fb; }
.mini-stats { display: flex; gap: 6px; }
.mini-stats > div {
  flex: 1; background: #f7f9fb; border-radius: var(--r-in); padding: 9px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.mini-stats b { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.mini-stats span { font-size: 10.5px; color: var(--ink-3); }

/* 空状态 */
.empty { text-align: center; padding: 44px 20px; }
.empty .ei { font-size: 30px; margin-bottom: 8px; opacity: 0.75; }
.empty .et { font-size: 13px; color: var(--ink-3); }

/* ---------- 搬运单 ---------- */
.move-card { position: relative; }
.move-card .mid { font-size: 14px; font-weight: 700; }
.move-card .mst { position: absolute; top: 14px; right: 14px; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 3px 10px; }
.mst.pending { background: var(--amber-soft); color: var(--amber); }
.mst.done { background: var(--green-soft); color: var(--green); }
.mst.approved { background: var(--brand-soft); color: var(--brand); }
.move-card .mroute { font-size: 13px; color: var(--ink-2); margin: 3px 0 7px; }
.move-card .mitems { font-size: 12.5px; color: var(--ink-2); background: #f7f9fb; border-radius: var(--r-in); padding: 8px 10px; }
.move-card .mfee { margin-top: 8px; font-size: 13px; display: flex; justify-content: space-between; align-items: baseline; }

/* 审批链 */
.chain { display: flex; align-items: center; gap: 3px; margin-top: 9px; flex-wrap: wrap; }
.chain .cstep {
  display: inline-flex; align-items: center;
  border-radius: 999px; padding: 3px 8px;
  background: #f0f2f5; color: var(--ink-3);
  font-size: 10.5px; font-weight: 650; white-space: nowrap;
}
.chain .cstep.done { background: var(--green-soft); color: var(--green); }
.chain .cstep.now { background: var(--amber-soft); color: var(--amber); }
.chain .cstep.skip { opacity: 0.55; }
.chain .arr { color: var(--ink-3); font-size: 10px; }

.lock-hint {
  margin-top: 10px; padding: 9px 11px; border-radius: var(--r-in);
  background: #f0f2f5; color: var(--ink-2); font-size: 12.5px;
}

/* ---------- 看板 ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.stat {
  position: relative; overflow: hidden;
  background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow-card); padding: 13px 14px;
}
.stat::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #d7dde5, #e8ecf1);
}
.stat.brand::before { background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.stat.good::before { background: linear-gradient(90deg, #0f9d58, #4cc98a); }
.stat.warn::before { background: linear-gradient(90deg, #b46a00, #e0a23e); }
.stat.bad::before { background: linear-gradient(90deg, #d23f31, #ef7a6e); }
.stat .sv { font-size: 21px; font-weight: 750; letter-spacing: -0.02em; }
.stat .sv small { font-size: 12px; font-weight: 550; color: var(--ink-3); margin-left: 2px; letter-spacing: 0; }
.stat .sk { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.stat.brand .sv { color: var(--brand); }
.stat.good .sv { color: var(--green); }
.stat.warn .sv { color: var(--amber); }
.stat.bad .sv { color: var(--red); }

.bars { display: flex; align-items: flex-end; gap: 9px; height: 110px; padding-top: 8px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.bar-col .bv { font-size: 9.5px; color: var(--ink-3); }
.bar-col .bar { width: 100%; max-width: 34px; border-radius: 7px 7px 3px 3px; background: linear-gradient(180deg, #c3d4f6, #d9e3f8); }
.bar-col.hot .bar { background: linear-gradient(180deg, var(--brand-2), var(--brand)); box-shadow: 0 2px 6px rgba(31, 92, 224, 0.25); }
.bar-col .bl { font-size: 10.5px; color: var(--ink-2); font-weight: 550; }

.idle-row { display: flex; align-items: center; gap: 10px; padding: 8px 6px; margin: 0 -6px; border-radius: var(--r-in); border-bottom: 1px solid #f0f2f5; font-size: 13px; cursor: pointer; transition-property: background-color; transition-duration: 0.15s; }
.idle-row:last-child { border-bottom: none; }
.idle-row .ico { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 9px; display: grid; place-items: center; font-size: 16px; background: #f7f9fb; }
.idle-row .n { flex: 1; font-weight: 600; }
.idle-row .v { color: var(--ink-2); }

.prog { height: 6px; border-radius: 999px; background: #edf0f4; margin-top: 10px; overflow: hidden; }
.prog-in { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width 0.5s var(--ease); }

.oa-card { background: linear-gradient(180deg, #fdfefe, #f8fafc); }

/* 盘点照片占位 */
.photo-ph {
  border-radius: var(--r-in); overflow: hidden; margin-top: 8px;
  outline: 1px solid rgba(0, 0, 0, 0.1); outline-offset: -1px;
}
.photo-ph img, .photo-ph canvas, .photo-ph svg { display: block; width: 100%; height: auto; }

.scan {
  margin-top: 8px; display: flex; align-items: center; gap: 9px;
  font-size: 13px; color: var(--ink-2);
}
.spinner {
  width: 16px; height: 16px; border-radius: 50%; display: inline-block;
  border: 2px solid var(--brand-soft); border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.footnote { text-align: center; padding: 18px 20px 6px; }

/* Toast */
#toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%) translateY(-4px); z-index: 99;
  background: rgba(23, 33, 43, 0.92); color: #fff;
  font-size: 13px; font-weight: 600; padding: 9px 18px; border-radius: 999px;
  box-shadow: var(--shadow-pop);
  opacity: 0; pointer-events: none; max-width: 86%; text-align: center;
  transition-property: opacity, transform; transition-duration: 0.25s; transition-timing-function: var(--ease);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 身份与权限 ---------- */
#role-pill {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 8px; min-height: 34px; padding: 0 12px;
  border: none; border-radius: 999px; cursor: pointer;
  background: var(--card); box-shadow: var(--shadow-card);
  font-size: 12.5px; font-weight: 650; color: var(--ink); font-family: inherit;
  transition-property: transform; transition-duration: 0.15s; transition-timing-function: var(--ease);
}
#role-pill:active { transform: scale(0.96); }
#role-pill .sw { color: var(--brand); font-weight: 600; font-size: 11.5px; margin-left: 2px; }

#sheet-mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(23, 33, 43, 0.42);
  display: flex; align-items: flex-end; justify-content: center;
}
#sheet-mask[hidden] { display: none; }
#role-sheet {
  width: 100%; max-width: 480px;
  background: var(--card); border-radius: 20px 20px 0 0;
  box-shadow: var(--shadow-pop);
  padding: 16px 16px calc(18px + env(safe-area-inset-bottom));
  animation: sheetUp 0.28s var(--ease);
}
@keyframes sheetUp { from { transform: translateY(24px); opacity: 0.4; } to { transform: translateY(0); opacity: 1; } }
.sheet-title { font-size: 15px; font-weight: 700; margin-bottom: 8px; text-align: center; }
.role-opt {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 10px; border-radius: var(--r-md); cursor: pointer;
  transition-property: background-color, transform; transition-duration: 0.15s; transition-timing-function: var(--ease);
}
.role-opt:active { transform: scale(0.98); }
.role-opt.on { background: var(--brand-soft); }
.role-opt .re { font-size: 24px; width: 36px; text-align: center; }
.role-opt .rn { font-size: 14px; font-weight: 650; }
.role-opt .rd { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }

/* ============ Web 端（桌面 ≥960px）：侧边栏管理台布局，手机端规则不受影响 ============ */
@media (min-width: 960px) {
  body { max-width: none; margin: 0; }

  /* 底部导航 → 左侧边栏 */
  nav {
    left: 0; top: 0; bottom: 0; transform: none;
    width: 232px; max-width: none;
    flex-direction: column; justify-content: flex-start; gap: 4px;
    padding: 92px 14px 18px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 1px 0 0 var(--hair);
  }
  nav::before {
    content: "汇融资产管理系统";
    position: absolute; top: 24px; left: 26px;
    font-size: 16px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink);
  }
  nav::after {
    content: "AI 资产管家 · Web 管理台";
    position: absolute; top: 51px; left: 26px;
    font-size: 11.5px; color: var(--ink-3);
  }
  nav button {
    flex: none; flex-direction: row; justify-content: flex-start; gap: 12px;
    width: 100%; padding: 11px 14px; border-radius: 12px;
    font-size: 14px; font-weight: 600;
  }
  nav button.on { background: var(--brand-soft); }
  nav button .ni { height: auto; }
  .nav-badge { position: static; margin-left: auto; }

  /* 顶栏与内容区让出侧边栏 */
  header { margin-left: 232px; padding: 16px 40px 12px; }
  main { margin-left: 232px; padding: 14px 40px 150px; }
  .page.active { max-width: 1080px; margin: 0 auto; }

  /* 助手页：居中会话列 */
  #chips { flex-wrap: wrap; max-width: 840px; margin: 0 auto; }
  #chat-log { max-width: 840px; margin: 0 auto; }
  .bubble { max-width: 68%; }
  #composer {
    left: calc(232px + (100vw - 232px) / 2);
    max-width: 720px;
  }
  #voice-strip {
    left: calc(232px + (100vw - 232px) / 2);
    max-width: 680px;
  }

  /* 台账：房间四列、SKU 目录双列 */
  .room-grid { grid-template-columns: repeat(4, 1fr); }
  #ledger-list:has(.sku-row) { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
  #ledger-list:has(.sku-row) > .card.slim { grid-column: 1 / -1; }
  #ledger-list:has(.sku-row) > .card { margin-bottom: 0; }
  #ledger-list:has(.sku-row) > .cat-h { grid-column: 1 / -1; margin: 8px 2px -2px; }
  #ledger-list:has(.sku-row) > .cat-h:first-of-type { margin-top: 0; }
  .search { max-width: 480px; }

  /* 搬运单：双列卡片 */
  #moves-body:has(.move-card) { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
  #moves-body .move-card { margin-bottom: 0; }
  #moves-body .footnote { grid-column: 1 / -1; }

  /* 看板：统计三列 + 卡片双列 */
  #dash-body { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
  #dash-body > .stat-grid { grid-column: 1 / -1; grid-template-columns: repeat(3, 1fr); margin-bottom: 0; }
  #dash-body > .card { margin-bottom: 0; }
  #dash-body > .footnote { grid-column: 1 / -1; }

  /* 身份切换：底部抽屉 → 居中弹窗 */
  #sheet-mask { align-items: center; }
  #role-sheet { max-width: 400px; border-radius: 20px; padding-bottom: 18px; }
}

/* ============ v3：楼层导航 / 看板 / 结算 / 权限 / AI 代审 / API / 登录 ============ */

/* 标签补充 */
.tag.rep { background: var(--amber-soft); color: var(--amber); }
.tag.int { background: #eef; color: #5b5bd6; }

/* 楼层选择条 */
.fsel { display: flex; gap: 6px; overflow-x: auto; padding: 0 0 12px; scrollbar-width: none; }
.fsel::-webkit-scrollbar { display: none; }
.fchip {
  position: relative; flex: 0 0 auto; min-height: 32px; padding: 0 11px;
  border: none; border-radius: 999px; background: var(--card); box-shadow: var(--shadow-card);
  font-size: 12px; font-weight: 600; color: var(--ink-2); font-family: inherit; cursor: pointer;
  transition-property: background-color, color, transform; transition-duration: 0.15s; transition-timing-function: var(--ease);
}
.fchip:active { transform: scale(0.94); }
.fchip.on { background: linear-gradient(180deg, #2b6af0, #1d55d6); color: #fff; box-shadow: var(--shadow-brand); }
.fchip.int { color: #5b5bd6; }
.fchip.int.on { color: #fff; }
.fchip .dot { position: absolute; top: 4px; right: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--green); display: block; }
.fchip.on .dot { background: #b9f6d3; }

.room-card.dim { opacity: 0; animation: rise 0.3s var(--ease) forwards; }
.room-card.dim .rid, .room-card.dim .rcnt { color: var(--ink-3); }
.room-card.dim .rcnt b { color: var(--ink-3); }

.vw-note { border-left: 3px solid var(--brand); }
.inv-row .age { color: var(--ink-3); font-size: 11px; }

/* 年限分布 */
.yr-row { display: flex; align-items: center; gap: 9px; padding: 5px 0; font-size: 12px; }
.yr-row .yl { flex: 0 0 128px; color: var(--ink-2); font-weight: 600; }
.yr-row .yb { flex: 1; height: 8px; border-radius: 999px; background: #edf0f4; overflow: hidden; }
.yr-row .yin { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #b0c4ec, #c9d8f4); }
.yr-row .yin.new { background: linear-gradient(90deg, var(--green), #4cc98a); }
.yr-row .yq { flex: 0 0 44px; text-align: right; color: var(--ink-2); font-weight: 650; }

/* 任务看板 */
.kanban { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kcol { background: #eaeef3; border-radius: var(--r-lg); padding: 8px; min-height: 68px; }
.kcol-h {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; color: var(--ink-2); padding: 3px 4px 8px;
}
.kcol-h::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--kc, var(--ink-3)); }
.kcol-h .kn { margin-left: auto; background: var(--card); border-radius: 999px; min-width: 20px; height: 20px; display: grid; place-items: center; font-size: 11px; color: var(--ink-2); padding: 0 5px; }
.kempty { text-align: center; color: var(--ink-3); font-size: 11.5px; padding: 12px 0 8px; }
.kcard {
  background: var(--card); border-radius: 13px; box-shadow: var(--shadow-card);
  padding: 10px 11px; margin-bottom: 8px; cursor: pointer;
  transition-property: transform, box-shadow; transition-duration: 0.16s; transition-timing-function: var(--ease);
}
.kcard:active { transform: scale(0.97); }
.kcard.mine { outline: 2px solid rgba(31, 92, 224, 0.35); outline-offset: -1px; }
.kc-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.ktag { font-size: 10px; font-weight: 700; border-radius: 6px; padding: 1.5px 6px; background: var(--brand-soft); color: var(--brand); }
.ktag.pur { background: #f3ecfd; color: #7a3ff2; }
.kid { font-size: 10.5px; color: var(--ink-3); font-weight: 650; }
.kc-items { font-size: 12px; font-weight: 650; margin-top: 5px; line-height: 1.4; }
.kc-route { font-size: 11px; color: var(--ink-3); margin-top: 1px; }
.kc-foot { display: flex; justify-content: space-between; align-items: baseline; margin-top: 6px; font-size: 11px; color: var(--ink-3); }
.kc-foot .num:first-child { font-size: 13px; font-weight: 750; color: var(--ink); }
.kc-wait { margin-top: 6px; font-size: 10.5px; font-weight: 650; color: var(--ink-3); background: #f0f2f5; border-radius: 7px; padding: 3px 7px; display: inline-block; }
.kc-wait.hot { background: var(--amber-soft); color: var(--amber); }

.move-card.focus { outline: 2px solid var(--brand); outline-offset: 2px; transition: outline-color 0.4s; }

/* 结算 */
.settle-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.settle-row .sl { font-size: 12px; color: var(--ink-2); font-weight: 600; flex: 0 0 auto; }
.settle-in {
  flex: 1; min-width: 0; min-height: 38px; border: 1.5px solid #dfe5ec; border-radius: 10px;
  padding: 0 10px; font-size: 15px; font-weight: 700; font-family: inherit; color: var(--ink);
  background: #fbfcfe; outline: none;
}
.settle-in:focus { border-color: var(--brand); }
.settled { margin-top: 10px; font-size: 13px; color: var(--ink-2); }

/* 权限矩阵 */
.perm-row { padding: 9px 0; border-bottom: 1px solid #f0f2f5; }
.perm-row:last-of-type { border-bottom: none; }
.pr-name { font-size: 13px; font-weight: 650; margin-bottom: 6px; }
.pr-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pchip {
  border: 1.5px solid #e2e7ee; border-radius: 999px; background: var(--card);
  font-size: 11px; font-weight: 600; color: var(--ink-3); font-family: inherit;
  min-height: 28px; padding: 0 10px; cursor: pointer;
  transition-property: background-color, color, border-color, transform; transition-duration: 0.15s; transition-timing-function: var(--ease);
}
.pchip:active { transform: scale(0.94); }
.pchip.on { background: var(--brand-soft); border-color: rgba(31, 92, 224, 0.35); color: var(--brand); }
.pchip.ro { cursor: default; opacity: 0.85; }
.pchip.ro:active { transform: none; }

/* AI 代审 */
.airule-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f0f2f5; }
.airule-row:last-of-type { border-bottom: none; }
.airule-row .ar-l { flex: 1; }
.airule-row .ar-t { font-size: 13px; font-weight: 650; }
.airule-row .ar-d { margin-top: 3px; display: flex; align-items: center; gap: 4px; }
.fee-in {
  width: 74px; min-height: 30px; border: 1.5px solid #dfe5ec; border-radius: 8px;
  padding: 0 8px; font-size: 13px; font-weight: 700; font-family: inherit; color: var(--ink);
  background: #fbfcfe; outline: none; text-align: right;
}
.fee-in:focus { border-color: var(--brand); }
.switch {
  flex: 0 0 auto; width: 46px; height: 27px; border: none; border-radius: 999px;
  background: #d8dee6; cursor: pointer; position: relative; padding: 0;
  transition: background-color 0.2s var(--ease);
}
.switch i { position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.2); transition: left 0.2s var(--ease); }
.switch.on { background: var(--green); }
.switch.on i { left: 22px; }
.switch.ro { cursor: default; opacity: 0.7; }

/* API 接入 */
.api-sec { border: 1px solid #eef1f5; border-radius: var(--r-in); padding: 11px 12px; margin-bottom: 10px; background: #fbfcfe; }
.api-h { font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.api-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 6px; }
.api-grid label { display: flex; flex-direction: column; gap: 3px; font-size: 10.5px; color: var(--ink-3); font-weight: 600; }
.api-grid input, .api-grid select {
  min-height: 36px; border: 1.5px solid #e2e7ee; border-radius: 9px; background: var(--card);
  padding: 0 9px; font-size: 12.5px; font-family: inherit; color: var(--ink); outline: none;
  -webkit-appearance: none; width: 100%;
}
.api-grid input:focus, .api-grid select:focus { border-color: var(--brand); }
.api-grid input:disabled, .api-grid select:disabled { background: #f4f6f9; color: var(--ink-3); }

/* 企微登录 */
#login-mask {
  position: fixed; inset: 0; z-index: 80;
  background: linear-gradient(160deg, #eef3fb, #e6ecf6 55%, #eef1f7);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
#login-mask[hidden] { display: none; }
#login-card {
  width: 100%; max-width: 360px; background: var(--card); border-radius: 22px;
  box-shadow: var(--shadow-pop); padding: 34px 26px 26px; text-align: center;
  animation: rise 0.35s var(--ease);
}
.lg-logo {
  width: 62px; height: 62px; margin: 0 auto 14px; border-radius: 17px;
  background: linear-gradient(150deg, #2b6af0, #1d55d6); color: #fff;
  font-size: 30px; font-weight: 800; display: grid; place-items: center;
  box-shadow: var(--shadow-brand);
}
.lg-title { font-size: 19px; font-weight: 750; letter-spacing: -0.01em; }
.lg-sub { font-size: 12px; color: var(--ink-3); margin: 3px 0 22px; }
.btn.wecom { background: linear-gradient(180deg, #12b76a, #0a9e57); box-shadow: 0 2px 8px rgba(10, 158, 87, 0.35); }
.lg-loading { display: flex; align-items: center; justify-content: center; gap: 9px; font-size: 13px; color: var(--ink-2); padding: 14px 0; }
.lg-loading[hidden] { display: none; }
#login-roles { text-align: left; }
#login-roles[hidden] { display: none; }
#login-roles .role-opt { border: 1px solid #eef1f5; margin-bottom: 8px; }

/* v3 桌面端补充 */
@media (min-width: 960px) {
  .kanban { grid-template-columns: repeat(4, 1fr); }
  #moves-body:has(.move-card) .seg, #moves-body .kanban { grid-column: 1 / -1; }
  #moves-body .seg { max-width: 360px; }
  #admin-body { max-width: 860px; margin: 0 auto; }
  #dash-body > .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .fsel { flex-wrap: wrap; }
}
