/* ============================================================
   调度台组件层
   ------------------------------------------------------------
   2026-09 重构要点：
   · 删除全部死类（.st-ok/.st-err/.st-warn/.st-busy/.st-wait/.st-dead、
     .switch/.sw-track、.token-locked、.token-change、.token-state*、.card .foot）
   · 表格 → 卡片：新增批次卡 .bcard（含订单子卡 .bcard-order）、任务卡 .tcard
   · 新增详情抽屉 .drawer、状态时间线 .timeline、审计日志 .audit、分段控件 .seg
   · 破坏性操作收敛到右键菜单，不再有行内破坏性按钮样式
   ============================================================ */

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 16px; border: 1px solid var(--ink); border-radius: var(--radius-s);
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 600;
  font-family: inherit; cursor: pointer; letter-spacing: .02em;
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .06s ease, box-shadow .15s ease;
}
.btn svg { width: 15px; height: 15px; flex: none; }
.btn:hover { background: #000; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { border-color: var(--ink); background: var(--surface); box-shadow: var(--shadow-1); }
.btn.danger { background: var(--red); border-color: var(--red); }
.btn.danger:hover { background: var(--red-deep); }
.btn.danger.ghost { background: transparent; color: var(--red); border-color: var(--red); }
.btn.danger.ghost:hover { background: var(--red-soft); }
.btn.ok { background: var(--ok); border-color: var(--ok); }
.btn.ok:hover { background: #0b6140; }
.btn.sm { padding: 5px 11px; font-size: 12px; }
.btn.sm svg { width: 13px; height: 13px; }
.btn-block { width: 100%; justify-content: center; padding: 10px 0; font-size: 14px; }

/* ---------- 标签导航（页面头内，固定不滚动） ---------- */
.tabs {
  display: flex; align-items: stretch; gap: 2px;
  border-bottom: 1px solid var(--line-strong); margin-bottom: 12px;
}
.tab {
  position: relative; padding: 9px 18px 11px;
  font-size: 13.5px; font-weight: 600; color: var(--ink-3);
  background: none; border: none; cursor: pointer; font-family: inherit;
  transition: color .15s ease;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); }
.tab.active::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px;
  height: 2px; background: var(--red);
}
.tab:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }

/* ---------- 分段控件（活跃 / 历史 / 全部） ---------- */
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-s); overflow: hidden; }
.seg-btn {
  padding: 7px 14px; font-size: 12.5px; font-weight: 600; font-family: inherit;
  color: var(--ink-2); background: var(--surface); border: none; cursor: pointer;
  border-right: 1px solid var(--line); transition: background .15s ease, color .15s ease;
}
.seg-btn:last-child { border-right: none; }
.seg-btn:hover { background: var(--paper); color: var(--ink); }
.seg-btn.active { background: var(--ink); color: #fff; }
.seg-btn:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }

/* ---------- 工具栏（搜索 + 分段 + 筛选） ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 0 0 14px; }
.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 10px; width: 15px; height: 15px; color: var(--ink-3); pointer-events: none; }
.search input {
  padding: 8px 12px 8px 33px; border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  background: var(--surface); color: var(--ink); font-size: 13px; width: 290px; font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(23, 23, 28, .06); }
.filter {
  padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  background: var(--surface); color: var(--ink); font-size: 13px; font-family: inherit; cursor: pointer;
}
.filter:focus { outline: none; border-color: var(--ink); }
.spacer { flex: 1; }

/* ---------- 网格与卡片 ---------- */
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--line);
  padding: 18px 20px 20px; position: relative;
}
.grid + .card, .card + .card { margin-top: 18px; }
.card-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border-bottom: 2px solid var(--ink); padding-bottom: 9px; margin-bottom: 14px;
}
.card-head h2 {
  font-size: 12.5px; font-weight: 700; letter-spacing: .07em;
  color: var(--ink-2); display: flex; align-items: center; gap: 7px;
}
.card-head h2 .h-ico { width: 15px; height: 15px; color: var(--ink-2); }
.card-head .tag { margin-left: 2px; }
.card-note { font-size: 12.5px; color: var(--ink-3); line-height: 1.7; margin-bottom: 4px; }
.col-6 { grid-column: span 6; }
.col-12 { grid-column: 1 / -1; }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; font-size: 11px; border: 1px solid var(--line-strong);
  color: var(--ink-2); background: var(--paper); white-space: nowrap;
  font-variant-numeric: tabular-nums; border-radius: var(--radius-s);
}
.tag svg { width: 11px; height: 11px; }

/* ---------- 状态色（订单 / 批次 / 任务通用语义） ---------- */
.tag.green { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.tag.red { color: var(--red); border-color: var(--red); background: var(--red-soft); }
.tag.orange { color: var(--amber); border-color: var(--amber); background: var(--amber-soft); }
.tag.blue { color: var(--blue); border-color: var(--blue); background: var(--blue-soft); }
.tag.violet { color: var(--violet); border-color: var(--violet); background: var(--violet-soft); }
.tag.gray { color: var(--ink-3); border-color: var(--line-strong); background: var(--paper); }

/* ---------- 告警 / 认证提示 ---------- */
.alerts { display: flex; flex-direction: column; border: 1px solid var(--line); }
.auth-banner {
  border: 2px solid var(--red); background: var(--red-soft); color: var(--red);
  padding: 13px 16px; font-size: 14px; font-weight: 700; margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px; flex: none;
}
.auth-banner svg { width: 17px; height: 17px; flex: none; }
.auth-banner .hint { font-weight: 400; font-size: 12.5px; color: var(--ink-2); margin-left: 4px; }
.alert {
  padding: 9px 14px; font-size: 13px; border-bottom: 1px solid var(--line);
  display: flex; align-items: baseline; gap: 10px;
}
.alert:last-child { border-bottom: none; }
.alert::before { content: ""; display: inline-block; width: 8px; height: 8px; flex: none; align-self: center; border-radius: 2px; }
.alert.warn::before { background: var(--amber); }
.alert.bad::before { background: var(--red); }
.alert.ok::before { background: var(--ok); }
.alert.bad { color: var(--red); font-weight: 600; }
.alert.warn { color: var(--amber); font-weight: 600; }
.alert.ok { color: var(--ink-2); }

/* ---------- 键值 / 机器人卡操作 ---------- */
.kv { display: grid; grid-template-columns: 116px 1fr; gap: 7px 14px; font-size: 13px; }
.kv > span { color: var(--ink-3); font-size: 12px; letter-spacing: .02em; }
.kv > b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; word-break: break-all; }
.kv .mono { font-family: var(--mono); font-size: 12px; }
.kv .stale { color: var(--red); font-weight: 700; }
.kv .stale-soft { color: var(--amber); }
.card.stretch { display: flex; flex-direction: column; }
.card.stretch .ops { margin-top: auto; padding-top: 16px; }
.kv-group + .kv-group { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
/* 两个主按钮 + 「更多操作」：等宽一行 */
.ops { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.ops .btn { padding: 8px 6px; font-size: 12.5px; white-space: nowrap; }

/* ---------- 配送数据：批次卡（包裹订单子卡） ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); gap: 16px; align-items: start; }
.bcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
  overflow: hidden; cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease;
}
.bcard:hover { border-color: var(--line-strong); box-shadow: var(--shadow-1); }
.bcard:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
/* 整行头部：底色由状态决定（JS 注入 --bh），白字 */
.bcard-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 14px; background: var(--bh, var(--ink)); color: #fff;
}
.bcard-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.bcard-title b { font-size: 14px; font-weight: 700; letter-spacing: .01em; }
.bcard-title .full { font: 11px var(--mono); color: rgba(255, 255, 255, .72); word-break: break-all; }
.bcard-tags { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-shrink: 0; }
.bcard-tags .tag { background: rgba(255, 255, 255, .18); color: #fff; border-color: rgba(255, 255, 255, .4); }
.bcard-tags .tag.solid { background: #fff; color: var(--ink); border-color: #fff; }
.bcard-body { padding: 12px 14px 14px; }
.bcard-line { display: flex; align-items: baseline; gap: 8px; padding: 3px 0; font-size: 12.5px; }
.bcard-line .k { color: var(--ink-3); width: 62px; flex: none; font-size: 12px; }
.bcard-line .v { color: var(--ink); word-break: break-all; }
.bcard-line .v.mono { font-family: var(--mono); font-size: 12px; }
.bcard-line .v.weak { color: var(--ink-3); }

/* 批次内订单子卡 */
.bcard-orders { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.bcard-order { background: #f8f9fb; border: 1px solid var(--line); border-radius: var(--radius-m); padding: 9px 11px; }
.bcard-order:hover { background: #f3f5f9; }
.bcard-order-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-bottom: 7px; border-bottom: 1px solid var(--line); }
.bcard-order-head b { font-size: 12.5px; font-weight: 700; }
.bcard-order-head .lm { font-size: 11px; color: var(--blue); background: var(--blue-soft); border-radius: 3px; padding: 1px 6px; }
.bcard-order-head .st { margin-left: auto; }
.bcard-order-body { padding-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.bcard-order-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 6px; font-size: 11.5px; color: var(--ink-3); }
.bcard-order-foot b { color: var(--ink-2); font-weight: 600; }
.bcard-more { font-size: 11.5px; color: var(--ink-3); padding: 6px 2px 0; }

/* 商品行（缩略图 + 名称 + 数量 + 金额） */
.o-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.o-thumb {
  width: 28px; height: 28px; border-radius: 4px; object-fit: cover;
  background: #eef0f3; flex: none; border: 1px solid var(--line);
}
.o-thumb.ph { display: inline-block; }
.o-name { color: var(--ink); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o-qty { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.o-price { color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---------- 配送数据：任务卡 ---------- */
.tcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
  padding: 11px 14px; cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease;
}
.tcard:hover { border-color: var(--line-strong); box-shadow: var(--shadow-1); }
.tcard:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.tcard-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.tcard-head b { font-size: 13px; font-weight: 700; }
.tcard-head .st { margin-left: auto; }
.tcard-line { display: flex; align-items: baseline; gap: 8px; padding: 3px 0; font-size: 12.5px; }
.tcard-line .k { color: var(--ink-3); width: 62px; flex: none; font-size: 12px; }
.tcard-line .v { color: var(--ink); word-break: break-all; }
.tcard-line .v.mono { font-family: var(--mono); font-size: 12px; }

/* ---------- 详情抽屉（时间线 + 实时位置 + 商品明细） ---------- */
.drawer { position: fixed; inset: 0; z-index: var(--z-modal); display: flex; justify-content: flex-end; }
.drawer-mask { position: absolute; inset: 0; background: rgba(15, 18, 26, .38); }
.drawer-panel {
  position: relative; width: min(560px, 94vw); height: 100%;
  background: var(--surface); border-left: 1px solid var(--line-strong);
  box-shadow: var(--shadow-2); display: flex; flex-direction: column;
  animation: drawer-in .18s ease;
}
@keyframes drawer-in { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 18px 12px; border-bottom: 3px solid var(--ink); flex: none;
}
.drawer-head h3 { font-size: 15px; font-weight: 700; letter-spacing: .01em; }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px 40px; }
.drawer-sec { margin-bottom: 20px; }
.drawer-sec > h4 {
  font-size: 11.5px; font-weight: 700; letter-spacing: .08em; color: var(--ink-2);
  border-bottom: 1px solid var(--line-strong); padding-bottom: 6px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.drawer-sec > h4 svg { width: 13px; height: 13px; color: var(--ink-3); }
.drawer-ops { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 状态时间线 ---------- */
.timeline { display: flex; flex-direction: column; }
.tl-item { position: relative; padding: 0 0 14px 20px; border-left: 2px solid var(--line); }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong);
}
.tl-item.ok::before { border-color: var(--ok); background: var(--ok-soft); }
.tl-item.busy::before { border-color: var(--blue); background: var(--blue-soft); }
.tl-item.bad::before { border-color: var(--red); background: var(--red-soft); }
.tl-item.wait::before { border-color: var(--violet); background: var(--violet-soft); }
.tl-item.warn::before { border-color: var(--amber); background: var(--amber-soft); }
.tl-item.inferred { border-left-style: dashed; }
.tl-item.inferred::before { border-style: dashed; }
.tl-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tl-time { font: 11.5px var(--mono); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tl-text { font-size: 13px; font-weight: 600; color: var(--ink); }
.tl-actor { font-size: 11px; color: var(--ink-3); border: 1px solid var(--line); border-radius: 3px; padding: 0 5px; }
.tl-note { font-size: 12px; color: var(--ink-2); margin-top: 3px; line-height: 1.6; word-break: break-all; }
.tl-inferred-tag { font-size: 10.5px; color: var(--ink-3); border: 1px dashed var(--line-strong); border-radius: 3px; padding: 0 5px; }

/* ---------- 审计日志 ---------- */
.audit-filter { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.audit-input {
  padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  background: var(--surface); color: var(--ink); font-size: 12.5px; font-family: inherit; width: 210px;
}
.audit-input:focus { outline: none; border-color: var(--ink); }
.audit { border: 1px solid var(--line); }
.audit-row {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 12.5px;
}
.audit-row:last-child { border-bottom: none; }
.audit-row:hover { background: #fafafb; }
.audit-row.fail { background: var(--red-soft); }
.audit-row.fail:hover { background: #fbe4e9; }
.audit-time { font: 11.5px var(--mono); color: var(--ink-3); font-variant-numeric: tabular-nums; flex: none; }
.audit-who { font-weight: 600; color: var(--ink); flex: none; }
.audit-act { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.audit-tgt { font: 11.5px var(--mono); color: var(--blue); }
.audit-detail { color: var(--ink-2); flex: 1; min-width: 180px; word-break: break-all; }
.audit-badge { font-size: 10.5px; font-weight: 700; border-radius: 3px; padding: 0 5px; flex: none; }
.audit-badge.ok { color: var(--ok); background: var(--ok-soft); border: 1px solid var(--ok); }
.audit-badge.err { color: var(--red); background: var(--red-soft); border: 1px solid var(--red); }
.audit-ip { font: 11px var(--mono); color: var(--ink-3); flex: none; }
.audit-foot { display: flex; align-items: center; gap: 8px; padding-top: 10px; }

/* ---------- 折叠卡（状态字典 / 会话回显） ---------- */
.card.fold { padding: 0; }
.card.fold > summary {
  list-style: none; cursor: pointer; padding: 14px 20px;
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 700; letter-spacing: .06em; color: var(--ink-2);
}
.card.fold > summary::-webkit-details-marker { display: none; }
.card.fold > summary::after { content: "展开"; margin-left: auto; font-size: 11px; font-weight: 400; color: var(--ink-3); }
.card.fold[open] > summary::after { content: "收起"; }
.card.fold > summary .h-ico { width: 15px; height: 15px; color: var(--ink-2); }
.card.fold > summary + * { margin: 0 20px 18px; }

/* ---------- 选择弹窗（召唤目标点 / 开关舱） ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(15, 18, 26, .48); display: flex; align-items: center; justify-content: center; z-index: var(--z-modal); }
.modal { width: min(430px, calc(100vw - 40px)); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-m); box-shadow: var(--shadow-2); overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 15px; margin: 0; }
.modal-x { background: none; border: 0; cursor: pointer; color: var(--ink-3); padding: 4px; display: inline-flex; border-radius: var(--radius-s); }
.modal-x:hover { color: var(--ink); background: var(--paper); }
.modal-x svg { width: 16px; height: 16px; }
.modal-body { padding: 12px 16px 6px; max-height: 62vh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px 14px; }
.pick-group { font-size: 11px; color: var(--ink-3); letter-spacing: .08em; margin: 10px 0 6px; }
.pick-group:first-child { margin-top: 2px; }
.pick-item { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 9px 12px; margin: 4px 0; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); cursor: pointer; font: inherit; text-align: left; transition: border-color .12s ease, background .12s ease; }
.pick-item:hover { border-color: var(--ink); }
.pick-item.sel { border-color: var(--red); background: var(--red-soft); }
.pick-item b { font-size: 13px; color: var(--ink); font-weight: 600; }
.pick-item span { font-size: 11px; color: var(--ink-3); }
.pick-item.big b { font-size: 14px; }
.pick-hint { font-size: 12px; color: var(--ink-3); margin: 10px 0 4px; line-height: 1.5; }
.pick-hint.warn { color: var(--red); }

/* 确认对话框（危险操作二次确认，替代浏览器原生 confirm） */
.confirm-body { font-size: 13px; line-height: 1.7; color: var(--ink); white-space: pre-line; margin: 2px 0 10px; }
.confirm-body .warn { color: var(--red); font-weight: 600; }
.confirm-steps { margin: 0 0 12px; padding-left: 22px; font-size: 13px; line-height: 1.9; color: var(--ink); }

/* ---------- 操作行 ---------- */
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* ---------- 空状态 / 骨架 ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 34px 16px; color: var(--ink-3); font-size: 12.5px;
}
.empty svg { width: 34px; height: 34px; color: var(--line-strong); }
.skel { padding: 12px 8px; color: var(--ink-3); font-size: 12.5px; display: flex; align-items: center; gap: 8px; }
.mini { font-size: 11px; color: var(--ink-3); }
.num { font-family: var(--mono); font-size: 12px; }
.stale { color: var(--red); font-weight: 700; }
.stale-soft { color: var(--amber); }

/* ---------- 只读提示条 ---------- */
/* 配送数据页：删除订单/清理批次已迁到商家端小程序，本页只监控。写清楚原因，
   否则运维会以为菜单里的删除项是"漏了"，反复找。 */
.readonly-hint {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 12px; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: rgba(138, 138, 148, .06);
  font-size: 12px; line-height: 1.5; color: var(--ink-3);
}
.readonly-hint svg { width: 15px; height: 15px; flex: none; color: var(--line-strong); }

/* ---------- 日志（本次会话回显） ---------- */
.log {
  max-height: 250px; overflow: auto;
  background: var(--surface); border: 1px solid var(--line);
  padding: 12px 14px; font: 12px/1.7 var(--mono); color: var(--ink-2);
  white-space: pre-wrap; border-radius: var(--radius-s);
}
.log .warn { color: var(--amber); }
.log .bad { color: var(--red); }
.log .green { color: var(--ok); }

/* ---------- 状态字典 ---------- */
.dict { display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 3px 16px; font-size: 12px; }
.dict span { color: var(--ink-3); }
.dict b { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.dict .divider { grid-column: 1 / -1; border-top: 1px solid var(--line); margin: 6px 0; padding-top: 6px; color: var(--ink-2); }

/* ---------- 右键菜单（破坏性操作的唯一入口） ---------- */
.ctxmenu {
  position: fixed; z-index: var(--z-menu); min-width: 178px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
  box-shadow: var(--shadow-2); padding: 5px; display: flex; flex-direction: column;
  animation: pop .12s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(-3px) scale(.98); } to { opacity: 1; transform: none; } }
.ctxmenu .ctx-title { padding: 6px 10px 5px; font-size: 11px; color: var(--ink-3); letter-spacing: .04em; border-bottom: 1px solid var(--line); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctxmenu .ctx-item {
  display: flex; align-items: center; gap: 9px; padding: 7px 10px;
  font-size: 12.5px; color: var(--ink); border: none; background: none;
  cursor: pointer; text-align: left; border-radius: var(--radius-s); font-family: inherit;
  transition: background .1s ease, color .1s ease;
}
.ctxmenu .ctx-item svg { width: 14px; height: 14px; color: var(--ink-3); flex: none; }
.ctxmenu .ctx-item:hover { background: var(--paper); }
.ctxmenu .ctx-item.danger { color: var(--red); }
.ctxmenu .ctx-item.danger svg { color: var(--red); }
.ctxmenu .ctx-item.danger:hover { background: var(--red-soft); }

/* ---------- 轻提示 ---------- */
.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: var(--z-toast);
  max-width: 420px; padding: 11px 16px; border-radius: var(--radius-m);
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-2); display: flex; align-items: center; gap: 9px;
  animation: toast-in .2s ease;
}
.toast svg { width: 15px; height: 15px; flex: none; }
.toast.ok svg { color: #7ddfae; }
.toast.err svg { color: #ff9aa8; }
.toast.warn svg { color: #f5c14e; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 设置：账号 / 令牌区 ---------- */
.token-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.token-box + .token-box { margin-top: 12px; }
.token-label { font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; width: 56px; flex: none; }
.token-input-wrap { position: relative; flex: 1; min-width: 180px; max-width: 320px; }
.token-input-wrap input {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  background: var(--surface); color: var(--ink); font-size: 13.5px; font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.token-input-wrap input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(23, 23, 28, .06); }
.token-msg { margin-top: 8px; font-size: 12.5px; min-height: 18px; }
.token-msg.err { color: var(--red); font-weight: 600; }
.token-msg.ok { color: var(--ok); font-weight: 600; }
.account-name { font-size: 15px; color: var(--ink); font-weight: 700; }
#accountRole { margin-left: 8px; }

/* ---------- 设置：危险操作 ---------- */
.danger-box { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.danger-note { font-size: 12px; color: var(--ink-3); max-width: 620px; line-height: 1.7; }

/* ---------- 管理员登录 ---------- */
.login-mask {
  position: fixed; inset: 0; z-index: var(--z-menu);
  background: rgba(246, 247, 249, .96);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card {
  width: 340px; max-width: 94vw; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-m);
  box-shadow: var(--shadow-2); padding: 34px 32px 26px;
  display: flex; flex-direction: column; gap: 12px; text-align: center;
}
.login-brand {
  width: 52px; height: 52px; margin: 0 auto; border-radius: 14px;
  background: #e4002b; color: #fff; display: flex; align-items: center; justify-content: center;
}
.login-brand svg { width: 28px; height: 28px; }
.login-card h2 { font-size: 19px; letter-spacing: .04em; margin: 2px 0 6px; }
.login-field input {
  width: 100%; box-sizing: border-box; padding: 11px 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  background: var(--surface); color: var(--ink); font-size: 14px; font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.login-field input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(23, 23, 28, .06); }
.login-err { color: var(--red); font-size: 12.5px; font-weight: 600; min-height: 16px; }
.login-hint { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }

/* ---------- 商家管理（商家账号） ---------- */
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .3px; }
.merchant-list { display: flex; flex-direction: column; gap: 8px; }
.merchant-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  background: var(--surface);
}
.merchant-row + .merchant-row { margin-top: 0; }
.merchant-main { min-width: 0; }
.merchant-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.merchant-ops { display: flex; gap: 6px; flex: none; }
.row-radio { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.radio { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.radio input { accent-color: var(--blue); width: 15px; height: 15px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  .sidenav { width: 58px; }
  .brand { padding: 0 0 14px; justify-content: center; }
  .brand-txt, .nav-item .lbl, .sidenav .foot { display: none; }
  .nav-item { justify-content: center; padding: 12px 0; }
  .col-6 { grid-column: 1 / -1; }
  .cards { grid-template-columns: 1fr; }
  .main { padding: 0 18px; }
  .search input { width: 100%; }
}
