/* ============================================
   JomCari Admin — 设计系统
   从原型的内联 <style> 提取，配色与圆角保持一致
   ============================================ */

:root {
  --primary: #E2738C;
  /* 单号 / 金额这类要逐位核对的内容用等宽字体。
     Windows 上原来的栈会落到又窄又扁的 Courier New —— 先点名系统自带的
     Consolas 和 Cascadia Mono，再退回各平台的等宽字体 */
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", SFMono-Regular, Menlo, "DejaVu Sans Mono", monospace;
  --primary-dark: #9e3d56;
  --bg: #f8f5f5;
  --sidebar-bg: #1a1215;
  --sidebar-hover: #2d2025;
  --sidebar-active: #3d2a32;
  --card-bg: #ffffff;
  --text: #22191b;
  --text-light: #887275;
  --border: #e7d6d7;
  --success: #4CAF50;
  --warning: #FF9500;
  --error: #E02020;
  --info: #1565C0;
  --tb-orange: #FF9500;
  --pdd-red: #E02020;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(34, 25, 27, 0.06);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
               'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

body.app-ready { display: flex; }

/* ============================================
   侧边栏
   ============================================ */
.sidebar { width: 260px; background: var(--sidebar-bg); color: #fff; position: fixed; top: 0; left: 0; bottom: 0; overflow-y: auto; z-index: 100; }
.sidebar-brand { padding: 24px 20px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-brand h1 { font-size: 24px; color: var(--primary); }
.sidebar-brand span { font-size: 11px; color: rgba(255,255,255,0.4); display: block; margin-top: 2px; }

.sidebar-nav { padding: 16px 0 40px; }
.nav-section { padding: 12px 20px 6px; font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; color: rgba(255,255,255,0.3); }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; color: rgba(255,255,255,0.6); cursor: pointer; transition: all 0.2s; font-size: 14px; border-left: 3px solid transparent; }
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: var(--primary); border-left-color: var(--primary); }
.nav-item .icon { width: 20px; text-align: center; font-size: 16px; }
.nav-item .badge { margin-left: auto; background: var(--primary); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.nav-item .badge:empty, .nav-item .badge[data-count="0"] { display: none; }

/* ============================================
   主区域
   ============================================ */
.main { margin-left: 260px; flex: 1; min-height: 100vh; }
.topbar { background: var(--card-bg); padding: 16px 32px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.topbar h2 { font-size: 20px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-right .admin-name { font-size: 14px; color: var(--text-light); }
.btn-logout { padding: 8px 16px; background: none; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--text-light); }
.btn-logout:hover { border-color: var(--primary); color: var(--primary); }

.content { padding: 32px; }

/* ============================================
   语言切换器

   三个按钮锁死等宽等高。原来只给 padding，宽度就随文字长短浮动 ——
   「中文」是两个全角字，比「EN」宽一截；选中态再加粗一次，宽度又变，
   整排看起来参差不齐还会跳动。
   ============================================ */
.lang-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.lang-switch button {
  min-width: 54px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: none;
  border-right: 1px solid var(--border);
  background: #fff;
  color: var(--text-light);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.lang-switch button:last-child { border-right: none; }
.lang-switch button:hover:not(.active) { background: #fdf6f7; color: var(--primary); }
.lang-switch button.active { background: var(--primary); color: #fff; font-weight: 600; }

/* ============================================
   统计卡片
   ============================================ */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 32px; }
.stat-card { background: var(--card-bg); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.stat-card .stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; margin-bottom: 16px; }
.stat-icon.blue { background: #E3F2FD; }
.stat-icon.green { background: #E8F5E9; }
.stat-icon.orange { background: #FFF3E0; }
.stat-icon.pink { background: #FCE4EC; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; }
.stat-card .stat-label { font-size: 13px; color: var(--text-light); margin-top: 4px; }

/* ============================================
   表格
   ============================================ */
.table-card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 24px; }
.table-header { padding: 20px 24px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 12px; }
.table-header h3 { font-size: 16px; font-weight: 600; line-height: 34px; }
.table-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* 工具栏里的输入框、下拉框、按钮统一 34px 高。
   各自的 padding 不同（输入框 8px、btn-sm 6px、select 还受浏览器默认样式影响），
   不锁死高度的话一排控件底部会参差不齐。 */
.table-actions .search-input,
.table-actions .filter-select,
.table-actions .btn,
.table-actions input[type="date"] {
  height: 34px;
  padding-top: 0;
  padding-bottom: 0;
  line-height: normal;
  box-sizing: border-box;
}
.table-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
/* 复选框那种带文字的标签也要跟着对齐 */
.table-actions label { display: inline-flex; align-items: center; height: 34px; }
.table-scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 12px 24px; font-size: 12px; font-weight: 600; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; background: #faf7f7; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 14px 24px; font-size: 14px; border-bottom: 1px solid #f5f0f0; vertical-align: middle; }
tr:hover td { background: #fdf9f9; }
td.nowrap { white-space: nowrap; }

.empty-row { text-align: center; padding: 48px 24px; color: var(--text-light); font-size: 14px; }

/* 配置键、商品 ID 这类需要逐字符看清的标识符。
   原来是裸 <code>，浏览器默认落到又细又小的等宽字体，
   warehouse_storage_days 这种长下划线名几乎看不清断在哪。
   给足字号和字重，再套一个浅色底把它和普通文字区分开。 */
.code-key {
  display: inline-block;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--primary-dark);
  background: #fdf2f4;
  border: 1px solid #f3e0e4;
  border-radius: 6px;
  padding: 3px 8px;
  /* 下划线命名靠字间距断开，比挤在一起好认 */
  letter-spacing: 0.2px;
  white-space: nowrap;
}

/* ============================================
   标签
   ============================================ */
.tag { display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.tag-tb { background: var(--tb-orange); color: #fff; }
.tag-pdd { background: var(--pdd-red); color: #fff; }

.tag-status { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.st-grey   { background: #F0EBEB; color: #6B5B5E; }
.st-green  { background: #E8F5E9; color: #2E7D32; }
.st-orange { background: #FFF3E0; color: #E65100; }
.st-blue   { background: #E3F2FD; color: #1565C0; }
.st-red    { background: #FFEBEE; color: #C62828; }
.st-purple { background: #F3E5F5; color: #6A1B9A; }

/* ============================================
   按钮
   ============================================ */
/* text-decoration:none 是给 <a class="btn"> 用的：按钮样式套在链接上时，
   浏览器的默认下划线没人取消，按钮底下就拖着一条线，而且那条线会传播给
   里面所有子元素（图标旁边的标签也跟着划）。写在 .btn 上一次管住全站。 */
.btn { padding: 8px 16px; border-radius: 8px; font-size: 13px; cursor: pointer; border: none; font-weight: 500; transition: all 0.2s; text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-outline { background: none; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--error); color: #fff; }
.btn-link { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 13px; text-decoration: underline; padding: 0; }

.action-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================
   标签栏（任务列表 / 采购账号 这类页内切换）

   不要用 .table-card 包 —— 卡片有自己的内边距和阴影，塞两个按钮进去
   上下留白必然不对称，而且视觉上像个空壳。直接平铺在页面底色上，
   看起来才是一组切换控件。
   ============================================ */
.tab-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.tab {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 22px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
  color: var(--text-light);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.tab:hover { border-color: var(--primary); color: var(--primary); }
.tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

/* ============================================
   状态筛选条
   表头下方独立一行，自带分隔线；每个胶囊高度一致，
   数字和文字分开配重，扫一眼就能看出哪一档积压了
   ============================================ */
.filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: #fcfafa;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text-light);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip .n { font-weight: 700; color: var(--text); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip.active .n { color: #fff; }
/* 计数为 0 的档淡化 —— 有货积压的那几档才需要抓眼球 */
.chip.zero { opacity: 0.45; }
.chip.zero:hover { opacity: 1; }

/* ============================================
   表单
   ============================================ */
.search-input { padding: 8px 16px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; width: 240px; outline: none; }
.search-input:focus { border-color: var(--primary); }
.filter-select { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; outline: none; background: #fff; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; outline: none; font-family: inherit; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--primary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: 12px; color: var(--text-light); margin-top: 4px; }
/* 长表单里的分节小标题。表单一长就分不清哪几项是一组的 ——
   货代编辑框里「账号」和「收货仓地址」是两回事，混在一起容易改错 */
.form-sub-title { font-size: 13px; font-weight: 700; margin: 22px 0 10px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ============================================
   弹窗
   ============================================ */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: #fff; border-radius: var(--radius); padding: 32px; width: 560px; max-width: 100%; max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
.modal h3 { font-size: 18px; margin-bottom: 24px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }

/* ============================================
   其它
   ============================================ */
.pagination { display: flex; justify-content: center; gap: 8px; padding: 20px; }
.pagination button { min-width: 36px; height: 36px; border: 1px solid var(--border); background: #fff; border-radius: 8px; cursor: pointer; font-size: 13px; padding: 0 8px; }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

.quick-panel { background: var(--card-bg); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 24px; }
.quick-panel h3 { font-size: 16px; margin-bottom: 16px; }
.quick-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.loading-row { text-align: center; padding: 48px; color: var(--text-light); }

/* 顶部提示条 */
.toast { position: fixed; top: 20px; right: 20px; z-index: 300; background: var(--text); color: #fff; padding: 14px 20px; border-radius: 8px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,0.2); max-width: 360px; }
.toast.ok { background: var(--success); }
.toast.err { background: var(--error); }


@media (max-width: 1200px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 860px) {
  .sidebar { width: 200px; }
  .main { margin-left: 200px; }
  .content { padding: 20px; }
  .form-row { grid-template-columns: 1fr; }
}

/* ============================================
   详情视图（弹窗内）

   弹窗里塞十几个字段时，光靠 form-row 会糊成一片。
   分区 + 键值对网格，眼睛能顺着标题跳到要找的那一块。
   ============================================ */
.detail-sec { margin-bottom: 22px; }
.detail-sec:last-child { margin-bottom: 0; }
.detail-sec > h4 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 20px; }
.detail-grid.one { grid-template-columns: 1fr; }
.detail-item .k { font-size: 12px; color: var(--text-light); margin-bottom: 3px; }
.detail-item .v { font-size: 14px; word-break: break-all; }
.detail-item .v.mono { font-family: var(--mono); font-size: 13px; }

/* 收件人这类需要整块突出的信息 */
.detail-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.8;
}

/* 金额区：三档并排，毛利单独配色 */
.money-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.money-cell {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  text-align: center;
}
.money-cell .k { font-size: 12px; color: var(--text-light); margin-bottom: 4px; }
.money-cell .v { font-size: 18px; font-weight: 700; }
.money-cell .sub { font-size: 11px; color: var(--text-light); margin-top: 2px; }
.money-cell.gain .v { color: var(--success); }
.money-cell.loss .v { color: var(--error); }

/* 装箱明细表格：弹窗里的表要更紧凑 */
.detail-sec table th, .detail-sec table td { padding: 9px 12px; }
.detail-sec table th { font-size: 11px; }

@media (max-width: 620px) {
  .detail-grid, .money-row { grid-template-columns: 1fr; }
}

/* 详情类弹窗要更宽 —— 里面有表格和多列金额，560px 会把内容挤成两行 */
.modal.wide { width: 760px; }

/* 更宽的一档：给列多、内容长的表格用（货代操作日志的长单号 + 前后值对照）。
   跟 90vw 取较小值，窄屏上不会溢出；.modal 本身有 max-width:100% 兜底 */
.modal.xwide { width: min(1080px, 90vw); }

/* 弹窗头部：标题 + 单号 + 状态徽章，一眼知道在看哪一单 */
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.modal-head .t { font-size: 18px; font-weight: 600; }
.modal-head .sub {
  font-family: var(--mono);
  font-size: 13px; color: var(--text-light); margin-top: 4px;
}

/* 商品缩略图 —— 纯文字列表很难快速认出是哪件货 */
.detail-thumb {
  width: 46px; height: 46px; border-radius: 8px; object-fit: cover;
  background: var(--bg); border: 1px solid var(--border); flex-shrink: 0;
}
.detail-prod { display: flex; gap: 12px; align-items: flex-start; }
.detail-prod .meta { min-width: 0; }
.detail-prod .name { font-size: 13px; line-height: 1.5; }
.detail-prod .spec { font-size: 12px; color: var(--text-light); margin-top: 2px; }

@media (max-width: 820px) { .modal.wide { width: 100%; } }

/* ============================================
   登录页

   左右分栏：左边品牌区（渐变底 + logo），右边表单。
   窄屏时品牌区收成顶部一条，不占掉输入框的位置。
   ============================================ */
.login-wrap {
  display: flex;
  min-height: 100vh;
  width: 100%;
  background: var(--bg);
}

.login-shell {
  display: flex;
  margin: auto;
  width: 900px;
  max-width: calc(100% - 40px);
  min-height: 540px;
  background: var(--card-bg);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(34, 25, 27, 0.10);
}

/* ---- 左：品牌区 ---- */
.login-brand {
  width: 46%;
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: linear-gradient(155deg, #F3A0B4 0%, var(--primary) 42%, var(--primary-dark) 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
}
/* 两个虚化圆斑，让纯渐变不至于太平 */
.login-brand::before,
.login-brand::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.10);
}
.login-brand::before { width: 260px; height: 260px; top: -90px; right: -80px; }
.login-brand::after  { width: 180px; height: 180px; bottom: -70px; left: -50px; }

.login-brand .inner { position: relative; z-index: 1; }
.login-logo { width: 132px; height: auto; margin-bottom: 20px; }
.login-brand h1 { font-size: 34px; letter-spacing: -0.5px; margin-bottom: 6px; }
.login-brand .tagline {
  font-size: 11px; letter-spacing: 0.32em; text-transform: uppercase;
  opacity: 0.85; margin-bottom: 28px;
}
.login-brand .role {
  font-size: 15px; font-weight: 600; margin-bottom: 18px;
  padding-bottom: 14px; border-bottom: 1px solid rgba(255,255,255,0.25);
}
.login-brand ul { list-style: none; }
.login-brand li {
  font-size: 13px; opacity: 0.9; padding: 5px 0 5px 20px; position: relative;
}
.login-brand li::before {
  content: '';
  position: absolute; left: 0; top: 12px;
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
}

/* ---- 右：表单区 ---- */
.login-form {
  flex: 1;
  padding: 48px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-form .title { font-size: 22px; font-weight: 600; margin-bottom: 4px; }
.login-form .hint { font-size: 13px; color: var(--text-light); margin-bottom: 26px; }
.login-form .lang-switch { margin-bottom: 26px; align-self: flex-start; }
.login-form .form-group { margin-bottom: 18px; }
.login-form input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.login-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(226, 115, 140, 0.15);
}
.login-submit {
  width: 100%;
  height: 46px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
  transition: background 0.15s;
}
.login-submit:hover:not(:disabled) { background: var(--primary-dark); }
.login-submit:disabled { opacity: 0.6; cursor: not-allowed; }

@media (max-width: 780px) {
  .login-shell { flex-direction: column; min-height: 0; }
  .login-brand { width: 100%; padding: 32px 28px; }
  .login-brand ul { display: none; }   /* 窄屏别让卖点挤掉输入框 */
  .login-brand h1 { font-size: 28px; }
  .login-logo { width: 96px; margin-bottom: 14px; }
  .login-form { padding: 32px 28px; }
}

/* 复制按钮：跟在可复制的值后面，小到不抢戏 */
.btn-copy {
  flex-shrink: 0;
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 6px;
  background: #fff; color: var(--text-light);
  font-size: 13px; line-height: 1; cursor: pointer;
  transition: all 0.15s;
}
.btn-copy:hover { border-color: var(--primary); color: var(--primary); }
.mono { font-family: var(--mono); font-size: 13px; }

/* ============================================
   滚动条
   ============================================
   系统默认的滚动条两端带方块箭头，和圆角细条的两侧观感对不上。
   统一成无箭头的圆角细条：Chromium 走 ::-webkit-scrollbar，
   Firefox 走 scrollbar-width/color。
   ::-webkit-scrollbar-button 必须显式 display:none，
   否则 Windows 上箭头照样会画出来。 */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong, #d8d0d2) transparent;
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong, #d8d0d2);
  border-radius: 999px;
  /* 用透明边框把滑块收窄，看起来更细，又保留足够的可点区域 */
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-light, #887275);
  background-clip: content-box;
}
::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}
::-webkit-scrollbar-corner {
  background: transparent;
}

/* ── 经营报表的日柱状图 ──
   没用图表库：只有一个图，为它引一个库不值得，而且库要跟着主题换配色。
   纯 flex + 百分比高度，深浅色都跟着 CSS 变量走。 */
.rp-chart {
  display: flex; align-items: flex-end; gap: 3px;
  height: 160px; padding: 8px 4px 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.rp-bar-wrap { flex: 1 0 14px; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
/* min-height 让「有单但金额很小」的那天也看得见 —— 高度算出来不足 1px
   的话，图上会显示成「那天没有生意」，那是假的 */
.rp-bar { width: 100%; min-height: 2px; border-radius: 3px 3px 0 0; background: var(--primary, #E2738C); }
.rp-bar-day { font-size: 10px; color: var(--text-light); text-align: center; margin-top: 4px; }

/* 订单详情里的包裹块。一张订单可以有好几个包裹，用底色和边框把它们
   彼此分开 —— 平铺成一串「标签: 值」的话，第二个包裹的单号看起来
   像是第一个的。 */
.parcel-box { margin-bottom: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.parcel-box:last-child { margin-bottom: 0; }
.parcel-hd { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.parcel-hd strong { font-size: 14px; }
.parcel-st { margin-left: auto; font-size: 12px; color: var(--text-light); }

/* 次要文字：表头旁边的「· 12 件」、操作列里那句「已在运单中」。
   比 .form-hint 轻一档，用在行内而不是块级说明。 */
.muted { color: var(--text-light); font-size: 12px; font-weight: 400; }

/* 运单里那个「+3」：一张运单可以跨好几张订单，单号平铺会把表格撑爆。
   点一下展开剩下的，再点收起。做成小药丸让人一眼看出是能点的。 */
.more-toggle {
  display: inline-block; margin-left: 4px; padding: 0 6px;
  border: 1px solid var(--border); border-radius: 999px;
  font-size: 11px; line-height: 16px; color: var(--text-light);
  cursor: pointer; user-select: none;
}
.more-toggle:hover { border-color: var(--primary); color: var(--primary); }
.more-list { margin-top: 2px; }

/* 【快递单号清单】一段可以有好几个号，行内一个删除，末尾一个「加一个」。
   输入框沿用 .form-group input 的样式 —— 和弹窗里别的字段长得一样，
   不自己另起一套。原来用的是 .search-input 加一堆行内样式，摆在表单里
   高度和圆角都对不上，看着像补丁。 */
.trk-block .trk-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.trk-block .trk-row input { flex: 1; min-width: 0; }
.trk-block .trk-del {
  flex: none; width: 34px; height: 34px; line-height: 1;
  border: 1px solid var(--border); border-radius: 8px;
  background: transparent; color: var(--text-light);
  font-size: 18px; cursor: pointer;
}
.trk-block .trk-del:hover { border-color: var(--error); color: var(--error); }
/* 「加一个」做成弱按钮 —— 它是可选动作，不该和「保存」抢注意力 */
.trk-block .trk-add {
  margin-top: 2px; padding: 4px 0;
  border: 0; background: transparent; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--primary);
}
.trk-block .trk-add:hover { text-decoration: underline; }

/* ============================================
   人工客服（js/pages/cs.js）

   三栏：会话列表 / 聊天窗口 / 顾客资料。整块固定一屏高，
   三栏各自滚动 —— 聊天窗口的输入框永远钉在底部，不会随消息被推走。
   高度扣掉的是顶栏（约 65px）和内容区上下 padding（32px × 2）。
   ============================================ */
.cs-wrap { display: grid; grid-template-columns: 300px minmax(0, 1fr) 300px; gap: 16px; height: calc(100vh - 130px); min-height: 520px; }
.cs-list, .cs-chat, .cs-info { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); min-height: 0; }
.cs-list { display: flex; flex-direction: column; overflow: hidden; }
.cs-list-head { padding: 14px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.cs-search { width: 100% !important; }
.cs-hours { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--text-light); line-height: 1.5; }
.cs-hours .dot { width: 8px; height: 8px; border-radius: 50%; background: #bbb; flex: none; }
.cs-hours.on .dot { background: var(--success); }
.cs-hours.on b { color: var(--success); }
.cs-tabs { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.cs-tabs button { flex: 1; padding: 7px 4px; border: 0; border-right: 1px solid var(--border); background: #fff; color: var(--text-light); font-size: 12px; cursor: pointer; }
.cs-tabs button:last-child { border-right: 0; }
.cs-tabs button.active { background: var(--primary); color: #fff; font-weight: 600; }
.cs-convs { flex: 1; overflow-y: auto; }
.cs-conv { display: flex; gap: 10px; padding: 12px 14px; cursor: pointer; border-bottom: 1px solid #f3e9ea; border-left: 3px solid transparent; }
.cs-conv:hover { background: #fdf6f7; }
.cs-conv.active { background: #fcecef; border-left-color: var(--primary); }
.cs-conv-main { flex: 1; min-width: 0; }
.cs-conv-top, .cs-conv-bot { display: flex; align-items: center; gap: 6px; }
.cs-conv-bot { margin-top: 3px; }
.cs-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-time { font-size: 11px; color: var(--text-light); flex: none; }
.cs-preview { flex: 1; min-width: 0; font-size: 12px; color: var(--text-light); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-conv.unread .cs-preview { color: var(--text); font-weight: 500; }
.cs-unread { flex: none; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; }
.cs-done { flex: none; font-size: 10px; padding: 1px 6px; border-radius: 8px; background: #eee; color: #777; }
.cs-avatar { position: relative; width: 38px; height: 38px; border-radius: 50%; background: #f0dee0; color: var(--primary-dark); flex: none; overflow: hidden; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.cs-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cs-empty { padding: 40px 20px; text-align: center; color: var(--text-light); font-size: 13px; }
.cs-list #cs-pager .pagination { padding: 10px; justify-content: center; }

.cs-chat { display: flex; flex-direction: column; overflow: hidden; }
.cs-chat > .cs-empty { margin: auto; }
.cs-chat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.cs-chat-who { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; min-width: 0; }
.cs-chat-who b { font-size: 15px; }
.cs-chat-who span { font-size: 12px; color: var(--text-light); }
.cs-msgs { flex: 1; overflow-y: auto; padding: 16px; background: #faf6f6; }
.cs-older { text-align: center; margin-bottom: 12px; }
.cs-day { text-align: center; margin: 14px 0 10px; }
.cs-day span { font-size: 11px; color: var(--text-light); background: #efe6e7; padding: 2px 10px; border-radius: 10px; }
.cs-row { display: flex; flex-direction: column; margin-bottom: 12px; }
.cs-row.theirs { align-items: flex-start; }
.cs-row.mine { align-items: flex-end; }
.cs-bubble { max-width: 70%; border-radius: 14px; padding: 9px 13px; font-size: 14px; line-height: 1.55; }
.cs-row.theirs .cs-bubble { background: #fff; border: 1px solid var(--border); border-top-left-radius: 4px; }
.cs-row.mine .cs-bubble { background: var(--primary); color: #fff; border-top-right-radius: 4px; }
.cs-bubble.t-image, .cs-bubble.t-order { padding: 4px; background: #fff !important; border: 1px solid var(--border); color: var(--text) !important; }
.cs-text { white-space: pre-wrap; word-break: break-word; }
.cs-img { display: block; max-width: 240px; max-height: 280px; border-radius: 10px; }
.cs-meta { font-size: 11px; color: var(--text-light); margin-top: 3px; padding: 0 4px; }
.cs-sys { margin: 4px auto 12px; max-width: 80%; text-align: center; font-size: 12px; color: var(--text-light); line-height: 1.6; }
.cs-sys span { display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: 6px; background: #efe6e7; font-size: 11px; }
.cs-order { display: flex; gap: 10px; align-items: center; width: 300px; max-width: 100%; padding: 6px; border-radius: 10px; cursor: pointer; text-align: left; }
.cs-order:hover { background: #fdf6f7; }
.cs-order img, .cs-order .ph { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: #f0dee0; flex: none; }
.cs-order-main { flex: 1; min-width: 0; }
.cs-order-title { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-order-no { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.cs-order-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 4px; font-size: 12px; }
.cs-order-foot .tag-status { padding: 2px 8px; font-size: 11px; }
.cs-order.missing { cursor: default; color: var(--text-light); font-size: 12px; padding: 10px; }
.cs-input { display: flex; align-items: flex-end; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border); }
.cs-input textarea { flex: 1; resize: none; min-height: 44px; max-height: 140px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; font: inherit; font-size: 14px; outline: none; }
.cs-input textarea:focus { border-color: var(--primary); }
.cs-input .btn { height: 44px; padding: 0 20px; }
.cs-tool { width: 44px; height: 44px; flex: none; border: 1px solid var(--border); border-radius: 10px; background: #fff; font-size: 18px; cursor: pointer; }
.cs-tool:hover { border-color: var(--primary); }
.cs-live { padding: 0 16px 8px; font-size: 11px; color: var(--text-light); }
.cs-live.on { color: var(--success); }
.cs-live.off { color: var(--warning); }

.cs-info { overflow-y: auto; padding: 16px; }
.cs-user { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.cs-user .cs-avatar { width: 48px; height: 48px; font-size: 18px; }
.cs-user b { font-size: 15px; }
.cs-sub { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.cs-kv { gap: 10px; }
.cs-h4 { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; color: var(--text-light); margin: 20px 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.cs-info-order { border: 1px solid var(--border); border-radius: 10px; padding: 4px; margin-bottom: 10px; }
.cs-info-order .cs-order { width: 100%; }
.cs-info-order .btn { width: 100%; margin-top: 4px; }

.cs-wrap { position: relative; }
.cs-head-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.cs-tools { display: flex; flex-wrap: wrap; gap: 6px; }

/* 提示音开关（客服页 + 采购任务页，见 cs.js 的 Sound）。
   关着的时候灰掉、带删除线，一眼看得出「现在不会响」 */
.snd-toggle { white-space: nowrap; }
.snd-toggle.off { color: var(--text-light); text-decoration: line-through; background: var(--bg); }
/* 「顾客资料」按钮和抽屉的 × 只在窄窗口里出现（下面 @media） */
.cs-info-btn, .cs-info-close { display: none; }
.cs-info { position: relative; }
.cs-info-close { position: absolute; top: 8px; right: 10px; width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--text-light); font-size: 22px; line-height: 1; cursor: pointer; }
.cs-info-close:hover { background: var(--bg); color: var(--text); }

/* 窄屏：顾客资料那一栏收掉，聊天窗口优先。
   收起来不等于没有 —— 聊天顶上多一个「顾客资料」按钮，点了从右边滑出抽屉，
   照样能「把这张订单发给顾客」。客服小窗口默认 1000 宽，走的就是这一档 */
@media (max-width: 1280px) {
  .cs-wrap { grid-template-columns: 260px minmax(0, 1fr); }
  .cs-info { display: none; }
  .cs-info-btn { display: inline-block; }
  .cs-wrap.info-open .cs-info { display: block; position: absolute; top: 0; right: 0; bottom: 0; width: 320px; max-width: 90%; z-index: 20; box-shadow: -8px 0 28px rgba(34, 25, 27, 0.18); }
  .cs-wrap.info-open .cs-info-close { display: block; }
}

/* ============================================
   人工客服小窗口（index.html?popup=cs，见 app.js renderCsWindow）

   没有侧边栏和页面标题栏，只有一条 52px 的细顶栏；收件箱吃满剩下的高度。
   ============================================ */
body.cs-window { display: block; }
.csw-top { display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 16px; background: var(--card-bg); border-bottom: 1px solid var(--border); }
.csw-top b { font-size: 15px; white-space: nowrap; }
.csw-top .csw-sub { font-size: 12px; color: var(--text-light); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.csw-top .topbar-right { margin-left: auto; flex: none; }
.csw-content { padding: 12px; }
.cs-window .cs-wrap { height: calc(100vh - 52px - 24px); min-height: 420px; gap: 12px; }

/* 【小窗口的三栏跟着窗口宽度自动伸缩，顾客资料一直在】
   上面「1280 以下收成抽屉」是按主窗口定的：主窗口左边还有 260 宽的侧边栏，
   三栏挤不下。小窗口没有侧边栏，不该照搬那条线。

   原来这里是几档固定宽度（220 / 260，860 以下收起）—— 窗口拉到分界线附近，
   右边那栏说没就没，看起来像坏了。现在左右两栏按窗口宽度的比例算
   （列表 24%、资料 26%），各自有上下限，中间聊天区拿剩下的：
     1440 宽 → 300 / 约 770 / 320
     1000 宽 → 240 / 约 470 / 260
      790 宽 → 190 / 约 340 / 210
   窗口怎么拉三栏都一起变，不会突然跳。
   只有窄到 720 以下（聊天区剩不到 300，消息都看不清）才收成「顾客资料」按钮。

   这几条写在 @media 外面也压得过上面主窗口那几条 —— 多了 .cs-window 一层，优先级更高 */
.cs-window .cs-wrap { grid-template-columns: clamp(170px, 24vw, 300px) minmax(0, 1fr) clamp(210px, 26vw, 320px); }
.cs-window .cs-info { display: block; }
.cs-window .cs-info-btn, .cs-window .cs-info-close { display: none; }
/* 窄的时候开过抽屉又把窗口拉宽：回到普通一栏，不要浮在上面 */
.cs-window .cs-wrap.info-open .cs-info { position: relative; width: auto; max-width: none; box-shadow: var(--shadow); }
@media (max-width: 1100px) {
  .cs-window .cs-info { padding: 12px; }
}
@media (max-width: 720px) {
  .cs-window .cs-wrap { grid-template-columns: clamp(170px, 24vw, 300px) minmax(0, 1fr); }
  .cs-window .cs-info { display: none; }
  .cs-window .cs-info-btn { display: inline-block; }
  .cs-window .cs-wrap.info-open .cs-info { display: block; position: absolute; top: 0; right: 0; bottom: 0; width: 300px; max-width: 90%; z-index: 20; box-shadow: -8px 0 28px rgba(34, 25, 27, 0.18); }
  .cs-window .cs-wrap.info-open .cs-info-close { display: block; }
}

/* ============ 全站维修模式（pages/maintenance.js） ============ */
.mt-body { padding: 20px 24px; }
.mt-status { display: inline-block; padding: 6px 14px; border-radius: 999px; font-weight: 600; font-size: 14px; }
.mt-plan { margin-top: 10px; font-size: 13px; }
.mt-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; font-weight: 600; margin-top: 18px; }
.mt-switch:first-child { margin-top: 0; }
.mt-switch input { width: 18px; height: 18px; margin: 0; cursor: pointer; accent-color: var(--primary); }
.mt-times { margin-top: 18px; }
.mt-time { display: flex; gap: 8px; align-items: center; }
.mt-time input { flex: 1; min-width: 0; }
.mt-time .btn { flex: none; white-space: nowrap; }
.mt-images { margin-top: 22px; }
.mt-img-preview { margin-top: 8px; border: 1px dashed var(--border); border-radius: 8px; background: #FAF7F7; display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--text-light); font-size: 13px; }
.mt-img-preview.mobile { height: 320px; }
.mt-img-preview.desktop { height: 200px; }
.mt-img-preview img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.mt-img-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.mt-upload { display: inline-block; }
.mt-preview-hint { margin-top: 12px; }
@media (max-width: 860px) {
  .mt-times, .mt-images { grid-template-columns: 1fr; }
}
