/* ============================================================
   易单通 DocKit - 全局样式
   主题：classic（经典蓝白商务）/ minimal（简约中性）
   ============================================================ */
:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
body.theme-classic {
  --primary: #1a56db; --primary-dark: #1646b0; --primary-soft: #e8f0fe;
  --bg: #f3f5f9; --panel: #ffffff; --border: #e2e8f0; --text: #1f2937; --muted: #6b7280;
  --danger: #dc2626; --success: #16a34a; --warning: #d97706;
  --sidebar-bg: #0f1e3d; --sidebar-text: #cbd5e1; --sidebar-active: #1a56db;
}
body.theme-minimal {
  --primary: #333333; --primary-dark: #1a1a1a; --primary-soft: #eeeeee;
  --bg: #fafafa; --panel: #ffffff; --border: #e5e5e5; --text: #262626; --muted: #737373;
  --danger: #dc2626; --success: #16a34a; --warning: #d97706;
  --sidebar-bg: #1c1c1c; --sidebar-text: #a3a3a3; --sidebar-active: #404040;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
button { font-family: var(--font); cursor: pointer; }
input, select, textarea { font-family: var(--font); font-size: 14px; color: var(--text); }

/* ---------------- 登录页 ---------------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #16294d 0%, #1a56db 60%, #4f8df9 100%); padding: 20px; }
.login-card { width: 400px; background: #fff; border-radius: 12px; padding: 36px 32px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-head { text-align: center; margin-bottom: 24px; }
.login-head h1 { font-size: 20px; margin: 12px 0 4px; }
.login-head p { color: var(--muted); font-size: 13px; }
.brand-logo { width: 40px; height: 40px; border-radius: 10px; background: var(--primary);
  color: #fff; font-weight: 700; font-size: 20px; display: flex; align-items: center; justify-content: center; flex: none; }
.brand-logo.img { background: #ffffff; object-fit: contain; padding: 2px; box-sizing: border-box; }
.brand-logo.lg { width: 56px; height: 56px; font-size: 26px; margin: 0 auto; }

/* ---------------- 滚动条（全局 5px） ---------------- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.22); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.42); }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.28); }
#sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.5); }
html { scrollbar-width: thin; }
.login-err { color: var(--danger); font-size: 13px; min-height: 20px; margin-top: 10px; text-align: center; }
.login-reg { text-align: center; font-size: 13px; margin-top: 12px; }
.login-reg a { color: var(--primary); text-decoration: none; }
.login-reg a:hover { text-decoration: underline; }
.login-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 12px; }

/* ---------------- 应用布局 ---------------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 224px; width: calc(224px / var(--zoom, 1)); background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; }
.brand-name { color: #fff; font-size: 15px; font-weight: 600; }
.brand-sub { font-size: 11px; color: var(--sidebar-text); opacity: .7; }
.nav { flex: 1; padding: 4px 8px; }
.nav-group { margin: 10px 0 4px; padding: 0 12px; font-size: 11px; color: var(--sidebar-text); opacity: .55; }
.nav-group-toggle { display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none; opacity: .8; transition: opacity .15s; }
.nav-group-toggle:hover { opacity: 1; color: #fff; }
.nav-group-toggle .nav-arrow { font-size: 10px; opacity: .8; }
.nav-sub { margin-bottom: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  color: var(--sidebar-text); font-size: 14px; margin-bottom: 2px; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.active { background: var(--sidebar-active); color: #fff; }
.nav-icon { flex: none; width: 24px; text-align: center; }
.nav .nav-badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 11px;
  border-radius: 10px; padding: 1px 7px; }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-foot .foot-link { color: var(--sidebar-text); font-size: 13px; opacity: .8; }
.sidebar-foot .foot-link:hover { opacity: 1; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 56px; background: var(--panel); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 20px; position: sticky; top: 0; z-index: 50; }
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 12px; background: var(--primary-soft); border-radius: 20px; }
.chip-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); background: #fff; flex: none; }
.m-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; border: 1px solid rgba(255,255,255,.35); background: #fff; flex: none; }
.user-name { font-weight: 600; }
.user-role { font-size: 12px; color: var(--muted); }
.view { padding: 20px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* ---------------- 通用组件 ---------------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 18px; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
/* 首页使用指引：单据/业务合并为一张卡片（左上角标签切换 + 右上角折叠/展开） */
.guide-card { margin-bottom: 16px; }
.guide-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.guide-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.guide-tab { border: 1px solid var(--border); background: var(--panel); color: var(--muted); padding: 4px 14px; border-radius: 999px; font-size: 13px; cursor: pointer; transition: all .15s; }
.guide-tab:hover { border-color: var(--primary); color: var(--primary); }
.guide-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.guide-toggle { border: none; background: transparent; color: var(--muted); font-size: 13px; cursor: pointer; padding: 4px 8px; border-radius: 6px; flex: none; }
.guide-toggle:hover { color: var(--primary); background: var(--primary-soft); }
.guide-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.guide-list li { font-size: 13px; line-height: 1.6; color: var(--text); }
.card > textarea { width: 100%; resize: vertical; min-height: 120px; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--panel); outline: none; }
.card > textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-head h2 { font-size: 18px; font-weight: 600; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel);
  color: var(--text); font-size: 14px; transition: all .15s; white-space: nowrap; }
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--primary); border-color: transparent; }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 6px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* 横竖版分段按钮：左横右竖，选中侧蓝底白字，另一侧浅灰 */
.orient-seg { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.orient-part { display: inline-flex; align-items: center; padding: 8px 14px; cursor: pointer; font-size: 14px;
  background: #f3f4f6; color: var(--muted); user-select: none; transition: background .15s; white-space: nowrap; }
.orient-part + .orient-part { border-left: 1px solid var(--border); }
.orient-part:hover { color: var(--primary); }
.orient-part.active { background: var(--primary); border-color: var(--primary); color: #ffffff; font-weight: 600; }
.orient-part.active:hover { color: #ffffff; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
/* 一行多标签横向滚动时隐藏滚动条并禁止竖向微滚动（保留滑动功能），避免右侧出现小滚动条 */
.tabs, .doc-tabs, .m-chips { overflow-y: hidden; scrollbar-width: none; -ms-overflow-style: none; }
.tabs::-webkit-scrollbar, .doc-tabs::-webkit-scrollbar, .m-chips::-webkit-scrollbar { display: none; height: 0; }
.tab { padding: 9px 16px; border: none; background: none; color: var(--muted); font-size: 14px;
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab .cnt { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 9px;
  background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 600; line-height: 18px; }
.tab.active .cnt { background: var(--primary); color: #fff; }
/* 单据页类型页签：顶部圆角矩形，横向可滑动 */
.doc-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px;
  overflow-x: auto; -webkit-overflow-scrolling: touch; }
.doc-tabs .tab { padding: 8px 14px; border: 1px solid var(--border); border-bottom: none;
  border-radius: 10px 10px 0 0; background: var(--panel); color: var(--muted);
  white-space: nowrap; flex: none; margin-bottom: -1px; }
.doc-tabs .tab:hover { color: var(--text); background: var(--bg); }
.doc-tabs .tab.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.doc-tabs .tab.active .cnt { background: rgba(255,255,255,.9); color: var(--primary); }
.q-wrap { position: relative; }
.q-wrap input { width: 280px; padding: 8px 70px 8px 12px; border: 1px solid var(--border); border-radius: 8px; }
.q-clear { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); border: none; background: none;
  color: var(--muted); font-size: 13px; cursor: pointer; padding: 4px 8px; line-height: 1; border-radius: 4px; white-space: nowrap; }
.q-clear:hover { color: var(--text); background: var(--bg); }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600;
  padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--bg); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
.table tr:hover td { background: var(--primary-soft); }
.table .ops { display: flex; gap: 6px; justify-content: flex-end; }
.table a.rowlink { color: var(--text); font-weight: 500; }
.table a.rowlink:hover { color: var(--primary); }

.badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; }
/* 列表状态徽标下拉切换 */
.st-picker { position: relative; display: inline-flex; align-items: center; gap: 3px; cursor: pointer; user-select: none; }
.st-picker .st-arrow { font-size: 9px; color: var(--muted); }
.st-drop { position: absolute; top: 100%; left: 0; z-index: 70; margin-top: 4px; min-width: 110px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.st-list { list-style: none; margin: 0; padding: 4px; max-height: 260px; overflow-y: auto; }
.st-item { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 5px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.st-item:hover { background: var(--primary-soft); }
.st-item[data-dis="1"] { opacity: .45; cursor: not-allowed; }
.st-item[data-cur="1"] { background: var(--primary-soft); }
.st-cur { color: var(--primary); font-size: 11px; }
.badge-blue { background: var(--primary-soft); color: var(--primary); }
.badge-green { background: #ecfdf5; color: var(--success); }
.badge-red { background: #fef2f2; color: var(--danger); }
.badge-yellow { background: #fffbeb; color: var(--warning); }
.badge-gray { background: #f3f4f6; color: var(--muted); }

/* 新增客户弹窗：重复客户实时提醒 */
.dup-warn { margin-top: 8px; padding: 8px 10px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; font-size: 12px; color: #92400e; }
.dup-ok { margin-top: 8px; padding: 6px 10px; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; font-size: 12px; color: #166534; }

/* 客户查重：搜索框（按钮内嵌右侧） */
.dup-search { display: flex; gap: 8px; margin-bottom: 10px; }
.dup-search input { flex: 1; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.dup-search input:focus { outline: none; border-color: var(--primary); }
.dup-search .btn { flex: none; padding: 8px 22px; border-radius: 8px; }

/* 客户查重：疑似撞客卡片（居中，宽度为搜索框 1/3） */
.dup-suspect-card {
  width: 33.33%;
  max-width: 33.33%;
  min-width: 240px;
  margin: 10px auto 0;
  border: 1px solid #fde68a;
  background: #fffbeb;
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .04);
}
.dup-card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dup-suspect-card .dup-card-body {
  flex-direction: column;
  gap: 5px;
  margin-top: 8px;
  font-size: 13px;
  color: #92400e;
}
@media (max-width: 768px) {
  .dup-suspect-card { width: 90%; max-width: 90%; min-width: 0; }
}

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field .req { color: var(--danger); }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); outline: none; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field textarea { resize: vertical; min-height: 70px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.row { display: flex; gap: 14px; }
.row > * { flex: 1; }
.row.gap { gap: 10px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.check input { width: auto; }

.pagination { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.pagination .p-info { color: var(--muted); font-size: 13px; }
.pagination .p-btns { display: flex; gap: 6px; }

.empty { text-align: center; color: var(--muted); padding: 60px 20px; }
.empty .big { font-size: 40px; margin-bottom: 10px; opacity: .4; }

/* ---------------- 弹窗 ---------------- */
.overlay { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal { background: var(--panel); border-radius: 12px; width: 560px; max-width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 20px; max-height: 70vh; overflow-y: auto; }
/* 底部操作面板（单据卡片 ⋯ 按钮弹出） */
.ov-sheet { align-items: flex-end; padding: 0; }
.sheet { background: var(--panel); border-radius: 14px 14px 0 0; width: 100%; max-width: 560px;
  margin: 0 auto; box-shadow: 0 -8px 32px rgba(0,0,0,.25);
  padding-bottom: env(safe-area-inset-bottom); }
.sheet-head { padding: 14px 18px 10px; border-bottom: 1px solid var(--border); }
.sheet-head h3 { font-size: 15px; text-align: center; }
.sheet-body { padding: 8px 12px; }
.sheet-item { display: block; width: 100%; padding: 13px 12px; border: none; background: none;
  font-size: 15px; color: var(--text); border-bottom: 1px dashed var(--border); cursor: pointer; border-radius: 8px; }
.sheet-item:last-child { border-bottom: none; }
.sheet-item:hover { background: var(--bg); }
.sheet-item.danger { color: var(--danger); }
.sheet-foot { padding: 10px 12px 14px; border-top: 1px solid var(--border); }
.sheet-cancel { display: block; width: 100%; padding: 12px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--bg); color: var(--muted); font-size: 15px; cursor: pointer; }
.sheet-cancel:hover { background: var(--border); }
/* 单据卡片列表（类型在左，信息自动换行，⋮ 操作在右下角） */
.doc-card { display: flex; gap: 12px; padding: 14px; margin-bottom: 10px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--panel); min-width: 0; }
.doc-card:hover { border-color: var(--primary); }
.dc-type { flex: none; width: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 8px; background: var(--primary-soft); color: var(--primary); }
.dc-t-en { font-size: 14px; font-weight: 700; }
.dc-t-cn { font-size: 11px; opacity: .75; margin-top: 2px; }
.dc-main { flex: 1; min-width: 0; overflow-wrap: break-word; }
.dc-no { font-weight: 600; font-size: 15px; line-height: 1.4; }
.dc-title { font-size: 12px; color: var(--muted); margin-top: 2px; overflow-wrap: break-word; }
.dc-info { margin-top: 8px; }
.dc-row { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 13px; line-height: 1.9; }
.dc-row .l { flex: none; width: 34px; color: var(--muted); font-size: 12px; opacity: .85; }
.dc-row .v { flex: 1; min-width: 0; color: var(--muted); overflow-wrap: break-word; }
.dc-ops { flex: none; align-self: center; display: flex; flex-direction: column; gap: 6px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); }
.modal-x { border: none; background: none; font-size: 20px; color: var(--muted); line-height: 1; }

/* ---------------- 提示 ---------------- */
.toast-box { position: fixed; top: 68px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--text); color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); animation: slidein .2s ease; max-width: 360px; }
.toast.ok { background: var(--success); }
.toast.err { background: var(--danger); }
.toast.warn { background: var(--warning); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------------- 首页 ---------------- */
/* 外贸看板 KPI 卡片 */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px; cursor: pointer; transition: all .15s; text-align: center; }
.kpi-card:hover { border-color: var(--primary); box-shadow: 0 4px 14px rgba(26,86,219,.1); }
.kpi-card .num { font-size: 28px; font-weight: 700; color: var(--primary); }
.kpi-card .lbl { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* 日历代办清单 */
.todo-group { margin-bottom: 10px; }
.todo-group-title { font-size: 13px; font-weight: 600; color: var(--muted); margin: 8px 2px 6px; }
.todo-group-title::before { content: '▪ '; color: var(--primary); }
.todo-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; background: var(--panel); text-decoration: none; color: var(--text); transition: all .15s; }
.todo-item:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(26,86,219,.08); }
.todo-ico { width: 30px; height: 30px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 14px; flex: none; }
.todo-main { flex: 1; min-width: 0; }
.todo-main b { font-size: 13px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-main .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* 左右两栏：日程代办 + 中国日历（等高布局，左侧列表内部滚动） */
.schedule-layout { display: flex; gap: 14px; align-items: stretch; margin-bottom: 16px; }
.schedule-left { flex: 0 0 56%; min-width: 0; display: flex; }
.schedule-left .card { width: 100%; display: flex; flex-direction: column; }
.schedule-left #schedList { flex: 1; overflow-y: auto; max-height: 440px; }
.schedule-right { flex: 1; min-width: 0; display: flex; }
.schedule-right .card { width: 100%; }

/* 我的日程项 */
.sched-item { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; background: var(--panel); }
.sched-item.done { opacity: .6; }
.sched-item.done b { text-decoration: line-through; }
.sched-main { flex: 1; min-width: 0; }
.sched-main b { font-size: 13px; }
.sched-main .hint { font-size: 12px; color: var(--muted); margin-top: 2px; word-break: break-all; }
.sched-att { display: inline-block; font-size: 12px; color: var(--primary); text-decoration: none; margin-top: 4px; word-break: break-all; }
.sched-att:hover { text-decoration: underline; }

/* 中国日历 */
.calendar { user-select: none; }
.calendar-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.calendar-head b { flex: 1; text-align: center; font-size: 14px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.calendar-week { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; font-weight: 600; }
.calendar-day { position: relative; min-height: 56px; border: 1px solid var(--border); border-radius: 8px; padding: 5px 6px; cursor: pointer; background: var(--panel); transition: all .15s; }
.calendar-day:hover { border-color: var(--primary); }
.calendar-day.other { opacity: .38; background: transparent; }
.calendar-day.today { border-color: var(--primary); background: var(--primary-soft); }
.calendar-day.selected { box-shadow: 0 0 0 2px var(--primary); }
.calendar-day .d { font-size: 15px; font-weight: 600; line-height: 1.2; }
.calendar-day .l { font-size: 10px; color: var(--muted); margin-top: 3px; white-space: nowrap; }
.calendar-day .dots { position: absolute; bottom: 4px; left: 0; right: 0; text-align: center; }
.calendar-day .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px rgba(220,38,38,.18); margin: 0 2px; }

@media (max-width: 768px) {
  .schedule-layout { flex-direction: column; }
  .schedule-left, .schedule-right { flex: none; width: 100%; display: block; }
  .schedule-left .card { width: 100%; }
  .schedule-left #schedList { max-height: none; }
  .calendar-day { min-height: 44px; }
}

/* 知识库（知识空间 → 分类 → 文件夹 → 文件） */
.kb-layout { display: flex; gap: 14px; align-items: flex-start; }
.kb-side { flex: 0 0 210px; min-width: 0; }
.kb-main { flex: 1; min-width: 0; }
.kb-nav { display: flex; flex-direction: column; gap: 2px; }
.kb-nav-item { padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--text); display: flex; align-items: center; justify-content: space-between; }
.kb-nav-item:hover { background: var(--bg); }
.kb-nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.kb-nav-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-count { font-size: 11px; color: var(--muted); flex: none; }
.kb-cat-title { font-size: 12px; color: var(--muted); margin: 14px 4px 6px; font-weight: 600; }
.kb-company-filter { margin-left: auto; margin-right: 6px; padding: 2px 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); font-size: 12px; color: var(--text); cursor: pointer; max-width: 110px; }
.kb-company-filter:focus { outline: none; border-color: var(--primary); }
.kb-company-tag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 6px; background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 500; vertical-align: 1px; }
.kb-cat-card .kb-company-tag { margin-left: 4px; }

/* 顶部格式标签切换 + 搜索 */
.kb-fmt-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0 12px; }
.kb-fmt-tabs { flex: 1; min-width: 220px; margin-bottom: 0; }
.kb-fmt-right { display: flex; gap: 8px; align-items: center; margin-left: auto; }

/* 公用库 / 个人库 标签切换栏 */
.kb-lib-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.kb-lib-tabs { flex: 1; min-width: 220px; margin-bottom: 0; }
.kb-lib-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* 左侧树形导航：展开箭头 + 缩进子项 */
.kb-space-row { gap: 4px; }
.kb-expand { flex: none; width: 20px; height: 20px; line-height: 18px; border: 1px solid var(--border); border-radius: 4px; background: var(--panel); font-size: 10px; cursor: pointer; color: var(--muted); padding: 0; }
.kb-expand:hover { border-color: var(--primary); color: var(--primary); }
.kb-nav-sub { overflow: hidden; }
.kb-nav-sub.open { margin-top: 2px; }
.kb-nav-loading { padding: 6px 12px; font-size: 12px; color: var(--muted); }
.kb-nav-child { padding-left: 20px; }
.kb-nav-child2 { padding-left: 34px; }
.kb-nav-child .kb-expand, .kb-nav-child2 .kb-expand { width: 18px; height: 18px; line-height: 16px; }
.kb-nav-child2 { font-size: 12px; }

/* 面包屑 */
.kb-crumbs { font-size: 13px; margin-bottom: 8px; }
.kb-crumb { color: var(--primary); text-decoration: none; cursor: pointer; }
.kb-crumb:hover { text-decoration: underline; }
.kb-crumb.cur { color: var(--text); font-weight: 600; cursor: default; text-decoration: none; }

/* 操作按钮 */
.kb-actions { display: flex; gap: 8px; margin-bottom: 10px; }

/* 分类卡片 */
.kb-cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.kb-cat-card { border: 1px solid var(--border); border-radius: 10px; padding: 14px 14px 36px; cursor: pointer; background: var(--panel); transition: all .15s; position: relative; }
.kb-cat-card:hover { border-color: var(--primary); box-shadow: 0 2px 10px rgba(26,86,219,.1); }
.kb-cat-name { font-size: 14px; font-weight: 600; }

/* 文件夹卡片 */
.kb-folder-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px 12px 36px; background: var(--panel); position: relative; }

/* 三点操作菜单（空间/分类/文件夹/文件共用；卡片右下角，无矩形外框） */
.kb-card-ops { position: absolute; right: 8px; bottom: 8px; }
.kb-file-ops { position: relative; }
.kb-menu-btn { width: 24px; height: 24px; border: none; background: transparent; color: var(--muted);
  font-size: 18px; line-height: 1; letter-spacing: 1px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; border-radius: 6px; }
.kb-menu-btn:hover { color: var(--primary); background: var(--primary-soft); }
.kb-menu { display: none; position: absolute; right: 0; z-index: 40; background: var(--panel);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); min-width: 132px; padding: 4px; }
.kb-card-ops .kb-menu { top: calc(100% + 4px); bottom: auto; }  /* 卡片右下角按钮：菜单向下展开 */
.kb-file-ops .kb-menu { top: calc(100% + 4px); }                  /* 文件右侧按钮：菜单向下展开 */
.kb-menu.open { display: block; }
.kb-menu-item { display: block; width: 100%; text-align: left; padding: 8px 12px; border: none; background: none; font-size: 13px;
  color: var(--text); border-radius: 6px; cursor: pointer; white-space: nowrap; text-decoration: none; box-sizing: border-box; }
.kb-menu-item:hover { background: var(--primary-soft); color: var(--primary); }
.kb-menu-item.faved { color: var(--warning); }
.kb-menu-item.danger { color: var(--danger); }
.kb-menu-item.danger:hover { background: #fef2f2; color: var(--danger); }

/* 文件列表 */
.kb-file-list { display: flex; flex-direction: column; gap: 6px; }
.kb-file { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); }
.kb-file:hover { border-color: var(--primary); }
.kb-file-ico { width: 36px; height: 36px; border-radius: 8px; background: var(--primary-soft); display: flex; align-items: center; justify-content: center; font-size: 18px; flex: none; }
.kb-file-thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border); flex: none; background: var(--bg); }
.kb-file-view { cursor: pointer; }
.kb-file-view:hover b { color: var(--primary); }
.kb-file-info { flex: 1; min-width: 0; }
.kb-file-info b { font-size: 13px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-file-ops { display: flex; gap: 6px; flex: none; }

/* 文件在线预览弹窗 */
.kb-preview-meta { font-size: 12px; color: var(--muted); margin-bottom: 10px; word-break: break-all; }
.kb-preview-img { text-align: center; background: var(--bg); border-radius: 8px; padding: 8px; }
.kb-preview-img img { max-width: 100%; max-height: 65vh; border-radius: 6px; }
.kb-preview-frame { width: 100%; height: 65vh; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.kb-preview-nosupport { text-align: center; color: var(--muted); padding: 48px 16px; font-size: 13px; line-height: 1.9; }

@media (max-width: 768px) {
  .kb-layout { flex-direction: column; gap: 10px; }
  .kb-side, .kb-main { flex: none; width: 100%; max-width: 100%; min-width: 0; }
  /* 公用库/个人库 标签切换栏纵向排列 */
  .kb-lib-bar { flex-direction: column; align-items: stretch; }
  .kb-lib-tabs { width: 100%; flex: none; }
  .kb-lib-right { width: 100%; margin-left: 0; }
  /* 格式标签切换 + 搜索纵向排列，宽度匹配卡片 */
  .kb-fmt-bar { flex-direction: column; align-items: stretch; }
  .kb-fmt-tabs { width: 100%; flex: none; }
  .kb-fmt-right { width: 100%; margin-left: 0; }
  .kb-fmt-right input { flex: 1; width: auto; min-width: 0; }
  /* 分类/文件夹卡片两列，宽度匹配 */
  .kb-cat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  /* 文件卡片允许换行，操作菜单不溢出 */
  .kb-file { flex-wrap: wrap; }
  .kb-file-info { flex: 1 1 calc(100% - 46px); min-width: 0; }
  .kb-file-ops { width: 100%; justify-content: flex-end; }
  .kb-crumbs { word-break: break-all; line-height: 1.7; }
  .kb-nav-child { padding-left: 16px; }
  .kb-nav-child2 { padding-left: 28px; }
}
/* 站内通知：右下角提醒 + 铃铛角标 + 通知中心 */
.notify-toasts { position: fixed; right: 18px; bottom: 18px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; max-width: 340px; }
.notify-toast { background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 10px; padding: 10px 14px; box-shadow: 0 8px 30px rgba(0,0,0,.18); cursor: pointer; opacity: 0; transform: translateY(12px); transition: all .3s; }
.notify-toast.show { opacity: 1; transform: translateY(0); }
.notify-toast .nt-title { font-weight: 600; font-size: 13px; }
.notify-toast .nt-content { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.5; }

/* 铃铛按钮：相对定位 + 未读高亮 + 晃动 */
#notifyBell, #notifyBellM { position: relative; }
#notifyBell.has-unread, #notifyBellM.has-unread {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
}
#notifyBell.ring, #notifyBellM.ring { animation: bellShake .6s ease; }
@keyframes bellShake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-18deg); }
  40% { transform: rotate(18deg); }
  60% { transform: rotate(-12deg); }
  80% { transform: rotate(12deg); }
}

/* 未读角标：更大、白描边、脉冲呼吸 */
.notify-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 19px;
  height: 19px;
  line-height: 19px;
  border-radius: 10px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 0 5px;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
  animation: notifyPulse 1.6s infinite;
}
@keyframes notifyPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}
.m-notify { position: relative; flex: none; border: none; background: transparent; font-size: 16px; cursor: pointer; padding: 4px; }

/* 通知中心：未读项强化（蓝点 + 加粗 + 左侧粗边），已读项淡化 */
.notify-list { max-height: 55vh; overflow-y: auto; }
.notify-row { position: relative; padding: 10px 34px 10px 14px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; cursor: pointer; background: var(--panel); }
.notify-row.unread { border-left: 4px solid var(--primary); background: #fff; }
.notify-row.unread .nt-title { font-weight: 700; }
.notify-row.unread::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 12px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.notify-row:not(.unread) { opacity: .72; }
.notify-row:not(.unread) .nt-title { font-weight: 500; }
.notify-row .nt-title { font-size: 13px; }
.notify-row .nt-content { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.notify-row .nt-time { font-size: 11px; color: var(--muted); margin-top: 4px; opacity: .8; }
.tip-list { list-style: none; padding-left: 0; }
.tip-list li { padding: 8px 0; border-bottom: 1px dashed var(--border); color: var(--muted); font-size: 13px; }
.tip-list li:last-child { border-bottom: none; }
.guide-body { font-size: 13px; line-height: 1.8; color: var(--text); min-width: 0;
  overflow-wrap: break-word; word-break: break-word; }
.guide-body p { margin: 0 0 10px; }
.guide-body p:last-child { margin-bottom: 0; }

/* ---------------- 单据编辑 ---------------- */
.doc-form-grid { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
.tpl-swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.tpl-swatch { width: 52px; height: 52px; border: 2px solid var(--border); border-radius: 10px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; position: relative; }
.tpl-swatch.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.tpl-swatch .tpl-custom-txt { font-size: 12px; font-weight: 600; pointer-events: none; }
.tpl-swatch input[type="color"] { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; border: none; padding: 0; margin: 0; }
.col-toggles { display: flex; flex-wrap: wrap; gap: 6px; }
.col-toggles .check { background: var(--bg); border: 1px solid var(--border); padding: 5px 10px; border-radius: 6px; font-size: 13px; }

.items-table { width: 100%; border-collapse: collapse; }
.items-table th { font-size: 12px; color: var(--muted); padding: 6px 6px; border: 1px solid var(--border); background: var(--bg); white-space: nowrap; }
.items-table td { padding: 4px; border: 1px solid var(--border); vertical-align: top; }
.items-table input, .items-table select, .items-table textarea { width: 100%; border: 1px solid transparent; background: transparent;
  padding: 6px; border-radius: 4px; font-size: 13px; }
.items-table input:focus, .items-table textarea:focus { border-color: var(--primary); background: var(--panel); }
.items-table .thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; display: block; margin: 2px auto; }
.items-table .del-cell { text-align: center; width: 34px; }
.items-table .del { border: none; background: none; color: var(--danger); font-size: 16px; }

.picker-list { max-height: 340px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.picker-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.picker-item:hover { background: var(--primary-soft); }
.picker-item img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }
.picker-item .p-name { font-weight: 500; }
.picker-item .p-sub { font-size: 12px; color: var(--muted); }
.picker-item .p-price { margin-left: auto; font-weight: 600; color: var(--primary); white-space: nowrap; }

/* ---------------- 单据预览 ---------------- */
.tot-line { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14px; color: var(--muted); }
.tot-line b { color: var(--text); }
.tot-line.grand { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 10px; font-size: 16px; font-weight: 600; }
.tot-line.grand b { color: var(--primary); }
.preview-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.preview-bar .spacer { flex: 1; }
.pdrop { position: relative; }
.pmenu { display: none; position: absolute; right: 0; top: calc(100% + 6px); min-width: 170px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 6px; z-index: 95; }
.pmenu.open { display: block; }
.pitem { padding: 9px 14px; border-radius: 6px; font-size: 14px; cursor: pointer; white-space: nowrap; }
.pitem:hover { background: var(--bg); }
.pitem-danger { color: var(--danger); }
.pitem-danger:hover { background: #fef2f2; }
.preview-frame { width: 100%; height: calc(100vh - 220px); min-height: 500px; border: 1px solid var(--border); border-radius: 10px; background: #e5e7eb; }

/* ---------------- 物流轨迹 ---------------- */
.timeline { list-style: none; padding-left: 4px; }
.timeline li { position: relative; padding: 0 0 22px 26px; border-left: 2px solid var(--border); margin-left: 8px; }
.timeline li:last-child { border-left-color: transparent; }
.timeline .dot { position: absolute; left: -7px; top: 2px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--primary); border: 2px solid var(--panel); }
.timeline .t-title { font-weight: 600; }
.timeline .t-time { font-size: 12px; color: var(--muted); margin: 2px 0; }
.timeline .t-content { font-size: 13px; color: var(--muted); }
.timeline .t-loc { font-size: 12px; color: var(--primary); }

/* ---------------- 权限矩阵 ---------------- */
.perm-grid { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.perm-row { display: flex; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--border); }
.perm-row:last-child { border-bottom: none; }
.perm-row:hover { background: var(--bg); }
.perm-row .m-name { width: 160px; font-weight: 500; }
.perm-row .m-actions { display: flex; gap: 12px; flex: 1; flex-wrap: wrap; }
.perm-row .m-scope { width: 140px; }

/* ---------------- 公章上传 ---------------- */
.stamp-box { display: flex; gap: 16px; align-items: flex-start; }
.stamp-preview { width: 120px; height: 120px; border: 1px dashed var(--border); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; overflow: hidden; background:
    repeating-conic-gradient(#f3f4f6 0 25%, #fff 0 50%) 0 0/20px 20px; }
.stamp-preview img { max-width: 110px; max-height: 110px; }

/* ---------------- 代码选择（点击预选） ---------------- */
.code-select { position: relative; width: 100%; }
.cs-box { display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); cursor: pointer; }
.cs-box:hover { border-color: var(--primary); }
.cs-input { flex: 1; border: none !important; background: transparent !important; box-shadow: none !important;
  padding: 9px 12px; font-size: 14px; cursor: pointer; border-radius: 8px 0 0 8px; }
.cs-clear { border: none; background: none; color: var(--muted); font-size: 16px; padding: 0 8px; }
.cs-clear:hover { color: var(--danger); }
.cs-arrow { border: none; background: none; color: var(--muted); font-size: 12px; padding: 0 10px; border-radius: 0 8px 8px 0; }
.cs-drop { position: absolute; top: 100%; left: 0; right: 0; z-index: 60; margin-top: 4px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); overflow: hidden; }
.cs-search { padding: 8px; border-bottom: 1px solid var(--border); }
.cs-search input { width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; outline: none; font-size: 13px; }
.cs-search input:focus { border-color: var(--primary); }
.cs-list { list-style: none; max-height: 240px; overflow-y: auto; }
.cs-list li { display: flex; gap: 10px; padding: 7px 12px; font-size: 13px; cursor: pointer; }
.cs-list li:hover, .cs-list li.hl { background: var(--primary-soft); }
.cs-list li b { min-width: 56px; color: var(--primary); font-weight: 600; }
.cs-list li i { display: block; font-style: normal; font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.cs-list li .cs-empty, .cs-list .cs-empty { color: var(--muted); padding: 14px 12px; text-align: center; }

/* ---------------- 报关单录入 ---------------- */
.cd-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 14px; }
.cd-grid .field { margin-bottom: 12px; }
.ex-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.ex-grid .field { margin-bottom: 12px; }
.cd-item { border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin-bottom: 14px; background: var(--bg); }
.cd-item-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cd-item-head b { flex: 1; color: var(--primary); }
.cd-item-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 14px; }
.cd-item-grid .field { margin-bottom: 12px; }
.cd-el-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0 14px;
  border-top: 1px dashed var(--border); padding-top: 12px; }
.cd-el-grid .field { margin-bottom: 0; }
.cd-el-grid .field > span { font-size: 12px; }
.cd-el-grid input, .cd-el-grid select { padding: 7px 10px; font-size: 13px; }
.field-err > span { color: var(--danger) !important; }
.field-err input, .field-err .cs-box, .field-err textarea, .field-err select { border-color: var(--danger) !important; }
.field-err .hint { color: var(--danger) !important; }

/* ---------------- 申报前检查 ---------------- */
.ckl-sec { display: flex; flex-direction: column; gap: 6px; }
.ckl-banner { padding: 10px 14px; border-radius: 8px; font-weight: 600; margin-bottom: 6px; }
.ckl-banner.ok { background: #ecfdf5; color: var(--success); }
.ckl-banner.bad { background: #fef2f2; color: var(--danger); }
.ckl-t { font-size: 13px; font-weight: 600; color: var(--muted); margin-top: 8px; }
.ckl-row { font-size: 13px; padding: 6px 10px; border-radius: 6px; background: var(--bg); }
.ckl-row.ckl-err { background: #fef2f2; color: var(--danger); }
.ckl-row.ckl-warn { background: #fffbeb; color: var(--warning); }
.ckl-row.ckl-info { color: var(--muted); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 900px) {
  .sidebar { width: 64px; width: calc(64px / var(--zoom, 1)); }
  .brand { padding: 14px 0; justify-content: center; }
  .brand-text, .nav a span:not(.nav-icon), .nav-group, .sidebar-foot { display: none; }
  .nav a { justify-content: center; padding: 10px 0; }
  .nav-icon { width: auto; }
  .doc-form-grid { grid-template-columns: 1fr; }
  .doc-form-grid > * { min-width: 0; }
  .row { flex-wrap: wrap; }
  .cd-grid, .cd-item-grid { grid-template-columns: repeat(2, 1fr); }
  .cd-el-grid { grid-template-columns: repeat(3, 1fr); }
  .ex-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------------- 平台管理后台（独立页面 admin.php） ---------------- */
/* 平台管理后台：左侧分组导航 + 右侧内容 */
.admin-app { }
.admin-sidebar { width: 216px; flex: none; background: var(--sidebar-bg); color: var(--sidebar-text); display: flex; flex-direction: column; padding: 14px 10px; overflow-y: auto; }
.admin-sidebar-title { font-weight: 700; font-size: 14px; padding: 8px 12px 14px; border-bottom: 1px solid rgba(255,255,255,.12); margin-bottom: 8px; white-space: nowrap; }
.admin-nav-groups { flex: 1; }
.admin-nav-group { margin-bottom: 10px; }
.admin-nav-sep { font-size: 11px; color: rgba(255,255,255,.55); padding: 10px 12px 4px; letter-spacing: .05em; }
.admin-sidebar a { display: block; padding: 8px 12px; color: rgba(255,255,255,.82); text-decoration: none; font-size: 13px; border-radius: 8px; margin-bottom: 2px; transition: background .15s; }
.admin-sidebar a:hover { background: rgba(255,255,255,.08); color: #fff; }
.admin-sidebar a.active { background: var(--primary); color: #fff; font-weight: 600; }
.admin-menu-btn { display: inline-flex; align-items: center; justify-content: center; font-size: 16px; padding: 4px 10px; border: 1px solid var(--border); background: var(--primary-soft); color: var(--primary); border-radius: 6px; cursor: pointer; flex: none; }
.admin-menu-btn:hover { background: var(--primary); color: #fff; }
/* 桌面端：点击 ☰ 折叠/展开左侧导航栏 */
.admin-app.menu-open .admin-sidebar { display: none; }
.admin-mask { display: none; }
.admin-view { max-width: 1040px; width: 100%; padding: 16px 20px; }
/* 统一后台各页面卡片宽度，避免每个子菜单卡片宽窄不一 */
.admin-view .card { max-width: 960px !important; }
.admin-view .page-head,
.admin-view .toolbar { max-width: 960px; }
.admin-view .card .card-title { margin-bottom: 12px; }
/* 表单控件在统一卡片内保持舒适宽度 */
.admin-view .field input:not([type="checkbox"]):not([type="radio"]),
.admin-view .field textarea,
.admin-view .field select { max-width: 640px; }
.admin-defaults-tip { border-left: 4px solid var(--primary); background: var(--primary-soft); margin-bottom: 16px; }
.admin-defaults-tip b { font-size: 14px; }
.admin-defaults-tip div { margin-top: 6px; font-size: 13px; color: var(--muted); line-height: 1.7; }

@media (max-width: 768px) {
  .admin-menu-btn { font-size: 18px; padding: 4px 10px; }
  .admin-app { position: relative; overflow-x: hidden; overflow-x: clip; }
  /* 后台顶栏在手机端保持显示（覆盖通用移动端规则 .sidebar, .topbar { display:none }） */
  .admin-app .topbar { display: flex; position: sticky; top: 0; z-index: 200; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
  /* 侧边栏：移动端变为左侧滑出抽屉 */
  .admin-sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 248px; max-width: 82vw; z-index: 300;
    transform: translateX(-105%); transition: transform .25s ease; box-shadow: 0 0 30px rgba(0,0,0,.3); }
  .admin-app.menu-open .admin-sidebar { display: flex; transform: translateX(0); }
  .admin-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 290; }
  .admin-app.menu-open .admin-mask { display: block; }
  .admin-view { padding: 10px 8px; }
  .topbar .admin-menu-btn { margin-right: 2px; }
  /* 移动端顶栏精简：隐藏次要按钮，只保留菜单+标题+退出 */
  .topbar-actions .admin-enter-btn,
  .topbar-actions .user-chip { display: none; }
  .topbar-title { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* ---- 移动端卡片适配：防止宽表格/内容把页面撑出左右滑动 ---- */
  .admin-view .card { overflow-x: auto; }                      /* 卡片内宽内容自行滚动 */
  .admin-view .table { min-width: 0 !important; }             /* 覆盖内联 min-width，宽度贴合卡片 */
  .admin-view .page-head { flex-wrap: wrap; gap: 8px; }          /* 标题栏按钮自动换行 */
  .admin-view .toolbar input,
  .admin-view .toolbar select { max-width: 100%; }
}

/* ---------------- 手机端（≤768px 底部导航布局） ---------------- */
.m-topbar, .m-tabbar, .m-biz-sheet { display: none; }
.tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.m-swipe-hint { display: none; }
.m-home-create { display: flex; gap: 14px; align-items: center;
  background: linear-gradient(135deg, var(--primary), #4f8df9); color: #fff; border-radius: 14px;
  padding: 18px 16px; margin-bottom: 16px; cursor: pointer; box-shadow: 0 6px 18px rgba(26,86,219,.25); }
.m-home-create .q-ico { width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.22);
  display: flex; align-items: center; justify-content: center; font-size: 26px; flex: none; }
.m-home-create .q-title { font-size: 16px; font-weight: 700; }
.m-home-create .q-sub { font-size: 12px; opacity: .85; margin-top: 2px; line-height: 1.5; }
.m-sec-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 2px 10px; font-size: 15px; }
.m-sec-head a { color: var(--primary); font-size: 13px; text-decoration: none; }
.m-menu-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 2px;
  border-bottom: 1px dashed var(--border); color: var(--text); text-decoration: none; font-size: 14px; }
.m-menu-item:last-child { border-bottom: none; }
.m-menu-item span { color: var(--muted); }
.acct-row { display: flex; justify-content: space-between; padding: 9px 0; font-size: 14px;
  border-bottom: 1px dashed var(--border); color: var(--muted); }
.acct-row:last-of-type { border-bottom: none; }
.acct-row b { color: var(--text); }

@media (max-width: 768px) {
  .app { display: block; }
  .sidebar, .topbar { display: none; }
  .m-topbar { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 80;
    height: 48px; padding: 0 14px; background: var(--sidebar-bg); color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
  .m-topbar .m-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
  .m-topbar .brand-logo { width: 28px; height: 28px; border-radius: 7px; font-size: 15px; }
  .m-topbar .m-user { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #cbd5e1; text-decoration: none; flex: none; }
  .m-topbar .m-user-role { font-size: 11px; padding: 1px 8px; border: 1px solid rgba(255,255,255,.35); border-radius: 10px; }
  .m-tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 80; background: var(--panel);
    border-top: 1px solid var(--border); box-shadow: 0 -2px 10px rgba(0,0,0,.06); padding-bottom: env(safe-area-inset-bottom); }
  .m-tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px;
    padding: 7px 0 6px; color: var(--muted); font-size: 11px; text-decoration: none; }
  .m-tabbar a .m-ico { font-size: 20px; line-height: 1.2; }
  .m-tabbar a.active { color: var(--primary); font-weight: 600; }
  /* 手机端底部"业务"弹出菜单：在底部导航栏上方滑出（不遮挡原底部菜单），菜单项一行一个虚线分隔 */
  .m-biz-sheet { display: block; position: fixed; inset: 0; z-index: 90; visibility: hidden; pointer-events: none; }
  .m-biz-sheet.open { visibility: visible; }
  .m-biz-mask { position: absolute; top: 0; left: 0; right: 0; bottom: calc(58px + env(safe-area-inset-bottom));
    background: rgba(0,0,0,.45); opacity: 0; transition: opacity .25s ease; border-radius: 0; pointer-events: auto; }
  .m-biz-sheet.open .m-biz-mask { opacity: 1; }
  .m-biz-panel { position: absolute; left: 0; right: 0; bottom: calc(58px + env(safe-area-inset-bottom));
    background: var(--panel); border-radius: 14px 14px 0 0; padding: 10px 16px 12px;
    transform: translateY(100%); transition: transform .28s ease;
    box-shadow: 0 -6px 24px rgba(0,0,0,.12); pointer-events: auto; }
  .m-biz-sheet.open .m-biz-panel { transform: translateY(0); }
  .m-biz-grid { display: flex; flex-direction: column; }
  .m-biz-grid a { display: flex; align-items: center; justify-content: center; gap: 10px;
    padding: 14px 4px; color: var(--text); font-size: 14px; text-decoration: none;
    border-bottom: 1px dashed var(--border); }
  .m-biz-grid a:last-child { border-bottom: none; }
  .m-biz-grid a .m-ico { font-size: 20px; width: 24px; text-align: center; flex: none; }
  .m-biz-grid a:active { background: var(--primary-soft); }
  .m-tabbar a#mBizBtn { color: var(--primary); }
  .m-tabbar a#mBizBtn .m-ico { font-size: 22px; }
  .main { display: block; }
  .view { padding: 12px 12px 20px; }
  .page-head { flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
  .page-head h2 { font-size: 16px; }
  .toolbar { gap: 8px; margin-bottom: 10px; }
  .card { padding: 14px; }
  .row { flex-direction: column; }
  .row > * { flex: none; width: 100%; }
  .row.gap { flex-direction: row; }
  .row.gap > * { flex: 1; width: auto; min-width: 0; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 12px; }
  .tab { white-space: nowrap; flex: none; }
  .table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table th, .table td { white-space: nowrap; }
  .tbl-scroll { max-width: 100%; }
  .tbl-scroll table { min-width: 880px; }
  /* 编辑页产品明细表（询盘/样品/订单）移动端横向滚动 */
  #itemsBox { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #itemsBox .items-table { display: table; min-width: 720px; }
  .m-swipe-hint { display: block; font-size: 12px; color: var(--muted); margin: 2px 0 8px; }
  .modal { width: 100%; }
  .overlay { padding: 16px 10px; }
  .modal-body { max-height: 62vh; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 12px; }
  .stat .num { font-size: 22px; }
  .doc-form-grid { grid-template-columns: 1fr; }
  .doc-form-grid > *, .cd-grid > *, .cd-item-grid > *, .cd-el-grid > *, .ex-grid > * { min-width: 0; }
  .card { min-width: 0; }
  .cd-grid, .cd-item-grid { grid-template-columns: repeat(2, 1fr); }
  .cd-el-grid { grid-template-columns: repeat(2, 1fr); }
  .ex-grid { grid-template-columns: 1fr; }
  .preview-frame { height: calc(100vh - 300px) !important; min-height: 380px; }
  .perm-row { flex-wrap: wrap; row-gap: 8px; }
  .perm-row .m-name { width: 100%; }
  .perm-row .m-scope { width: 100%; }
  .stamp-box { flex-direction: column; }
  .toast-box { top: auto; bottom: 84px; left: 14px; right: 14px; }
  .toast { max-width: none; }
  .preview-bar .spacer { display: none; }
  input, select, textarea { font-size: 16px !important; }
  .m-chips { display: flex; gap: 2px; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 14px;
    border-bottom: 1px solid var(--border); }
  .m-chip { flex: none; padding: 8px 14px; border-radius: 10px 10px 0 0; border: 1px solid var(--border);
    border-bottom: none; background: var(--panel); color: var(--muted); font-size: 13px; white-space: nowrap; margin-bottom: -1px; }
  .m-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
  .m-chip .cnt { display: inline-block; margin-left: 5px; padding: 0 6px; border-radius: 9px;
    background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 600; line-height: 16px; }
  .m-chip.active .cnt { background: rgba(255,255,255,.9); color: var(--primary); }
  .m-list-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
  .ops { gap: 2px; }
  .pagination { flex-wrap: wrap; gap: 10px; justify-content: center; }
  .pagination .p-btns { flex-wrap: wrap; justify-content: center; }
  .pagination .p-btns .btn { min-width: 36px; }
}
