/* 服务端渲染（Python）页面专用：只补链接化组件与无脚本提示的样式，
   其余外观全部复用 css/app.css */

/* 侧边栏 / 底栏 / 卡片列表在 SSR 版本里是 <a>，去掉默认链接样式 */
.nav-item, .tab, .chip, .mini-tab, .conv-item, .m-card, .btn, .lang-btn,
.m-card-call, .drawer-close, .ssr-row-link {
  text-decoration: none;
  color: inherit;
}
.nav-item, .tab, .conv-item, .m-card, .chip, .mini-tab { cursor: pointer; }
.nav-item span, .tab span { color: inherit; }
.drawer-close {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: #f2f5fa; color: #6d7f96; font-size: 14px; flex: none;
}
.drawer-close:hover { background: #e8eef7; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.ssr-row-link { font-weight: 700; color: #16283f; }
.ssr-row-link:hover { color: #1a68d4; }

/* 表单内联排布（制单员切换 / 推送制单员） */
.ssr-inline { display: flex; align-items: center; gap: 6px; }
form.assign-row { display: flex; gap: 8px; }
form.assign-row .select { flex: 1; }
form.search { display: flex; align-items: center; }
form.quick-chips { display: flex; gap: 6px; }
form.inputbar { display: flex; }
.form-foot button { flex: 1; }

/* 服务端 Toast：每条操作结果都弹一条，4.6 秒后自动收，点一下或点 ✕ 立刻收 */
.ssr-toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 60;
  pointer-events: auto; cursor: pointer; max-width: min(92vw, 560px);
  display: flex; align-items: center; gap: 9px; line-height: 1.35;
  animation: ssrToastIn .22s ease;
}
.ssr-toast.out {
  opacity: 0; transform: translateX(-50%) translateY(-8px);
  transition: opacity .24s ease, transform .24s ease;
}
@keyframes ssrToastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.ssr-toast .toast-ico { display: flex; flex: none; }
.ssr-toast .toast-ico svg { width: 15px; height: 15px; fill: currentColor; }
.ssr-toast .toast-txt { flex: 1 1 auto; }
.ssr-toast .toast-x {
  flex: none; width: 20px; height: 20px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255, 255, 255, .18); color: inherit; font-size: 11px; line-height: 1;
  display: grid; place-items: center; font-family: inherit;
}
.ssr-toast .toast-x:hover { background: rgba(255, 255, 255, .3); }
@media (max-width: 900px) {
  .ssr-toast {
    top: auto; bottom: calc(72px + env(safe-area-inset-bottom));
    width: calc(100vw - 28px); max-width: calc(100vw - 28px); justify-content: center;
    text-align: left;
  }
}
body.mp-body .ssr-toast { top: 16px; bottom: auto; width: calc(100vw - 28px); }

/* 桌面表格 / 手机卡片：由媒体查询决定显示哪一个（服务端渲染不知道屏幕宽度） */
.ssr-mobile { display: none; }
@media (max-width: 900px) {
  .ssr-desktop { display: none; }
  .ssr-mobile { display: block; }
  .customer-side .card.side-meta { display: none; }
}

/* TMS 同步队列操作按钮保持自然宽度 */
.tms-outbox-head .btn { flex: none; }

/* 同步队列表单里的按钮（CSV 队列 / 标记已受理） */
.ssr-accept { display: inline-flex; }
.ssr-accept button { flex: none; }

/* 语言下拉：<details> 实现，外观仿原生下拉框，无需任何脚本 */
.lang-drop { position: relative; }
.lang-drop > summary {
  list-style: none; cursor: pointer; color: #16283f;
  display: inline-flex; align-items: center; justify-content: space-between; gap: 8px;
  min-width: 118px; padding: 6px 10px; border-radius: 9px;
  background: #fff; border: 1px solid #cfe0f5;
  font-size: 12.5px; font-weight: 600; user-select: none;
  transition: border-color .16s, box-shadow .16s;
}
.lang-drop > summary::-webkit-details-marker { display: none; }
.lang-drop > summary:hover { border-color: #bcd4f5; }
.lang-drop[open] > summary { border-color: #9cc2f7; box-shadow: 0 0 0 3px rgba(77, 148, 255, .14); }
.lang-caret { width: 14px; height: 14px; fill: #8aa3c4; flex: none; transition: transform .16s; }
.lang-drop[open] .lang-caret { transform: rotate(180deg); }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 70;
  width: 100%; min-width: 118px; padding: 6px; border-radius: 12px;
  display: flex; flex-direction: column; gap: 2px;
  background: #fff; border: 1px solid #e2eaf6;
  box-shadow: 0 14px 34px rgba(17, 45, 85, .16);
  animation: langIn .14s ease;
}
@keyframes langIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.lang-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px; border-radius: 8px; white-space: nowrap;
  font-size: 12.5px; font-weight: 600; color: #2a3f5c;
}
.lang-opt:hover { background: #f2f7ff; color: #14509e; }
.lang-opt.active { background: #eef4ff; color: #14509e; }
.lang-tick { width: 13px; height: 13px; fill: #1a68d4; flex: none; }

/* 客户微信会话按倒序渲染 + column-reverse：打开就停在最新一条消息（含「查询」结果） */
.chat.chat-rev { flex-direction: column-reverse; }

/* 发货单 / 运单消息卡片（微信气泡里的入口） */
.doc-bubble { display: flex; flex-direction: column; gap: 8px; }
.doc-tip { font-size: 12px; color: #4c6079; line-height: 1.55; }
.doc-cta {
  display: block; text-align: center; padding: 8px 10px; border-radius: 8px;
  background: #1a6fe0; color: #fff; font-size: 12.5px; font-weight: 700; text-decoration: none;
}
.doc-cta:hover { background: #155ec0; }

/* ---------- 客户手机上打开的独立页面：发货单 / 运单 ---------- */
.mp-body { background: #eef1f7; }
.mp-wrap { max-width: 560px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.mp-top {
  display: flex; align-items: center; gap: 6px; padding: 12px 14px;
  background: #fff; border-bottom: 1px solid #e5ebf4; position: sticky; top: 0; z-index: 5;
}
.mp-back {
  width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px;
  color: #16283f; text-decoration: none; font-size: 20px; line-height: 1; flex: none;
}
.mp-back:hover { background: #f0f5fd; }
.mp-title { font-size: 15px; font-weight: 700; }
.mp-sub { font-size: 11.5px; color: #8296ae; margin-top: 2px; }
.mp-main { padding: 12px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.mp-tip {
  font-size: 12px; color: #6d7f96; background: #eaf2ff; border: 1px solid #d9e6fb;
  border-radius: 10px; padding: 9px 12px; line-height: 1.6;
}
.mp-alert {
  font-size: 12.5px; color: #b4470f; background: #fff3e9; border: 1px solid #f7d9bf;
  border-radius: 10px; padding: 9px 12px; line-height: 1.6;
}
.mp-note { font-size: 12.5px; color: #4c6079; line-height: 1.65; }
.mp-note.ok { color: #0d8a5f; font-weight: 600; }
.mp-card { background: #fff; border: 1px solid #e6ecf5; border-radius: 14px; overflow: hidden; }
.mp-card-head { padding: 12px 14px 0; }
.mp-card-title { font-size: 14px; font-weight: 700; }
.mp-card-sub { font-size: 11.5px; color: #8296ae; margin-top: 3px; }
.mp-card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.mp-card-body .btn { align-self: stretch; }
.mp-foot { position: sticky; bottom: 0; padding: 10px 0 6px; background: linear-gradient(180deg, rgba(238,241,247,0), #eef1f7 42%); }
.mp-foot .btn { width: 100%; }
.form-opt { font-size: 11px; color: #a8b6c8; margin-left: 4px; font-weight: 500; }

/* 运单明细表 */
.mp-wb { gap: 0; }
.wb-row {
  display: flex; align-items: flex-start; justify-content: flex-start; gap: 10px;
  padding: 8px 0; border-bottom: 1px dashed #edf1f7; font-size: 13px;
}
.wb-row:last-child { border-bottom: none; }
.wb-k { color: #7b8ca4; flex: 0 0 auto; min-width: 92px; max-width: 46%; }
.wb-v { font-weight: 600; color: #16283f; text-align: left; flex: 1 1 auto; word-break: break-word; }
.wb-row.total { justify-content: space-between; }
.wb-row.total .wb-v { color: #1a6fe0; font-size: 15px; flex: 0 0 auto; text-align: right; }
.wb-row.total { border-bottom: none; padding-top: 10px; }

/* 客户记忆条（制单员对话顶部） */
.mem-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0 14px 8px; padding: 8px 12px; border-radius: 10px;
  background: #f4f8ff; border: 1px solid #dfeaf9; color: #3d5a7c; font-size: 12px;
}
.mem-bar b { color: #1a68d4; font-weight: 700; flex: none; }
.mem-bar span { flex: 1 1 auto; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.mem-bar .mem-when { margin-left: auto; color: #8b9bb0; flex: 0 0 auto; white-space: nowrap; }

/* 超级管理员「以某角色浏览」提示条 */
.ssr-as {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 0 16px; padding: 9px 14px; border-radius: 10px;
  background: #fff7e8; border: 1px solid #ffe0b0; color: #8a5a10; font-size: 12.5px;
}
.ssr-as form { margin-left: auto; }
.ssr-as .btn { background: #fff; }
@media (max-width: 900px) {
  .ssr-as { margin: 0 10px 8px; }
}

/* 顶栏账号按钮 + 菜单（头像 / 我的账户 / 切换角色 / 退出） */
.acct-drop { position: relative; }
.acct-btn {
  display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none;
  padding: 4px 10px 4px 4px; border-radius: 22px; border: 1px solid #e2e9f4;
  background: #fbfcfe; font-size: 13px; color: #16283f; font-weight: 600;
}
.acct-btn::-webkit-details-marker { display: none; }
.acct-btn:hover { background: #f2f8ff; border-color: #b7ceec; }
.acct-drop[open] .acct-btn { background: #eaf3ff; border-color: #cfe1fb; }
.acct-img, .acct-btn .ava-fallback { object-fit: cover; display: inline-flex;
  align-items: center; justify-content: center; flex: none; }
.acct-btn .ava-fallback { background: linear-gradient(135deg, #1a6fe0, #12c48a);
  color: #fff; font-weight: 700; }
.acct-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; width: 268px;
  background: #fff; border: 1px solid #e6ecf5; border-radius: 14px; padding: 8px;
  box-shadow: 0 18px 44px rgba(15, 40, 75, .16);
}
.acct-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 10px;
  border-bottom: 1px dashed #eef2f8; margin-bottom: 6px; }
.acct-head .acct-who { flex: 1 1 auto; }
.acct-head b { font-size: 13.5px; color: #10243d; }
.acct-head .acct-sub { font-size: 11.5px; color: #8b9bb0; margin-top: 2px; }
.acct-x { margin-left: auto; flex: none; width: 28px; height: 28px; border-radius: 50%;
  border: none; background: none; color: #6d7f96; font-size: 15px; line-height: 1;
  cursor: pointer; display: grid; place-items: center; font-family: inherit; }
.acct-x:hover { color: #1a68d4; background: #f7fbff; }
.acct-item {
  display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: 9px;
  font-size: 13px; color: #2a3f5c; background: none; border: none; cursor: pointer;
  font-family: inherit;
}
.acct-item:hover { background: #f2f8ff; color: #1a68d4; }
.acct-form { margin: 0; }
.acct-switch { padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.acct-switch select {
  width: 100%; padding: 7px 9px; font-size: 12.5px; border: 1px solid #e2e9f4;
  border-radius: 8px; background: #fbfcfe; color: #2a3f5c;
}
.acct-label { font-size: 11.5px; color: #8b9bb0; }
@media (max-width: 900px) {
  .acct-name { display: none; }
  .acct-btn { padding: 3px; border-radius: 50%; }
  .acct-menu { width: 250px; right: -4px; }
}

/* ---------- 价格管理 ---------- */
.price-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.price-tabs .price-tab { flex: none; display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 10px; background: #fff; border: 1px solid #e6ecf5;
  color: #33465f; font-size: 13px; text-decoration: none; line-height: 1.2;
  box-shadow: 0 1px 2px rgba(15, 40, 75, .04); }
.price-tabs .price-tab:hover { border-color: #bcd6f7; color: #1a68d4; }
.price-tabs .price-tab.active { background: #0e3a6b; border-color: #0e3a6b; color: #fff; }
.price-tabs .price-tab .tab-badge { position: static; border: none; background: #eef4fc;
  color: #5b7091; font-style: normal; font-size: 10.5px; padding: 2px 7px; border-radius: 8px;
  min-width: 0; height: auto; }
.price-tabs .price-tab.active .tab-badge { background: rgba(255, 255, 255, .18); color: #dbe9ff; }
.price-head { margin-bottom: 12px; }
.price-head-top { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.price-head-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.price-head-actions .inline-form { margin: 0; }
.price-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.price-card { padding: 12px 14px; }
.price-card-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.price-card-head .card-sub { font-size: 11.5px; }
.price-card-action { margin-left: auto; flex: none; }
.price-tbl { width: 100%; }
.price-tbl td, .price-tbl th { padding: 5px 8px; font-size: 12.5px; }
.price-tbl tr.price-vol td { background: #f7fbff; }
.price-tbl tr.price-vol .td-main { color: #1a68d4; }
.price-tbl .td-mono { font-variant-numeric: tabular-nums; font-weight: 600; color: #10243d; }
.price-notes { margin: 6px 0 0 16px; padding: 0; font-size: 12.5px; color: #55677f; line-height: 1.8; }
.calc-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 10px; }
.calc-form .form-label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: #63758c; }
.calc-form .form-input { min-width: 130px; }
.calc-result { margin-top: 12px; border: 1px solid #dbe8fb; background: #f7fbff; border-radius: 12px; padding: 12px 14px; }
.calc-total { font-size: 26px; font-weight: 700; color: #1a68d4; font-variant-numeric: tabular-nums; }
.calc-sub { font-size: 12px; color: #63758c; margin-bottom: 8px; }
.calc-result .kv-grid { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px 14px; }
.calc-result .kv { border-bottom: none; padding-bottom: 0; }
.adjust-form { display: flex; flex-direction: column; gap: 10px; }
.adjust-form .form-label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: #4b5d75; }
.adjust-form .form-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.adjust-form .form-foot .btn { min-width: 110px; }
.chg-new { color: #12a06a; font-weight: 700; }
@media (max-width: 900px) {
  .price-grid { grid-template-columns: 1fr; }
  .price-head-actions { margin-left: 0; width: 100%; }
  .calc-form .form-input { min-width: 0; width: 100%; }
  .calc-form .form-label { width: 100%; }
}

/* 服务端页面多了「价格管理」一项，手机底栏改为可左右滑动，避免菜单过多被截断 */
@media (max-width: 900px) {
  .tabbar { display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabbar::-webkit-scrollbar { display: none; }
  .tab { font-size: 10px; flex: 0 0 auto; min-width: 70px; padding: 0 10px; }
  .tab svg { width: 20px; height: 20px; }
}

/* ---------- 面板里的「返回」键：账号面板 / 语言菜单 / 抽屉，卡住时都能原路退回 ---------- */
.acct-back {
  display: flex; align-items: center; gap: 6px; color: #6d7f96; font-weight: 700;
  border-bottom: 1px dashed #eef2f8; border-radius: 0; margin-bottom: 4px;
  padding: 7px 10px 9px;
}
.acct-back::before { content: "\2039"; font-size: 15px; line-height: 1; }
.acct-back:hover { color: #1a68d4; background: #f7fbff; }
.lang-back {
  display: block; text-align: center; padding: 7px 10px; border-radius: 8px;
  font-size: 12.5px; font-weight: 700; color: #6d7f96;
  border-top: 1px solid #eef2f8; margin-top: 2px; text-decoration: none;
}
.lang-back:hover { background: #f2f7ff; color: #14509e; }
.drawer-back { text-decoration: none; white-space: nowrap; }
.drawer-mask { display: block; cursor: pointer; }
.drawer-foot-back { display: flex; justify-content: flex-end; margin-top: 6px; }
