/* 佛缘阁进销存 —— 响应式样式（移动端优先） */
:root {
  --primary: #8d3b2f;        /* 佛系赭红 */
  --primary-dark: #6f2d23;
  --gold: #c8a24b;
  --bg: #f6f4ef;
  --card: #ffffff;
  --text: #2c2620;
  --muted: #8a8078;
  --border: #e8e2d8;
  --green: #3d8b5f;
  --red: #c0392b;
  --orange: #d68910;
  --blue: #3a6ea5;
  --radius: 12px;
  --sidebar-w: 220px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
.hidden { display: none !important; }
.only-mobile { display: inline-flex; }
.only-desktop { display: none !important; }

/* ---------- 登录 ---------- */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #7a3226, #a05a3c 55%, #c8a24b);
  padding: 16px;
}
.login-card {
  background: var(--card); border-radius: 16px; padding: 36px 28px; width: 100%; max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3); text-align: center;
}
.login-logo { font-size: 48px; }
.login-card h1 { font-size: 22px; margin: 8px 0 4px; color: var(--primary); }
.login-sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.form-item { text-align: left; margin-bottom: 14px; }
.form-item label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }

/* ---------- 布局 ---------- */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w);
  background: linear-gradient(180deg, #6f2d23, #8d3b2f); color: #fff;
  display: flex; flex-direction: column; z-index: 50; transform: translateX(-100%);
  transition: transform .25s;
}
.sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.35); }
.brand { font-size: 17px; font-weight: 700; padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,.12); }
#side-nav { flex: 1; overflow-y: auto; padding: 10px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 8px;
  color: rgba(255,255,255,.85); cursor: pointer; margin-bottom: 2px; font-size: 14px;
}
.nav-item:hover { background: rgba(255,255,255,.1); }
.nav-item.active { background: rgba(255,255,255,.18); color: #fff; font-weight: 600; }
.nav-item .badge { margin-left: auto; background: var(--gold); color: #5a3a00; font-size: 11px; border-radius: 8px; padding: 1px 6px; }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.12); display: flex; justify-content: space-between; align-items: center; font-size: 13px; }

.main { margin-left: 0; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.page-title { font-size: 16px; font-weight: 700; flex: 1; }
.topbar-right { font-size: 13px; color: var(--muted); }
.content { padding: 14px; flex: 1; padding-bottom: calc(70px + env(safe-area-inset-bottom)); }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 45;
  background: #fff; border-top: 1px solid var(--border);
  display: flex; padding-bottom: env(safe-area-inset-bottom);
}
.tab-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 0 5px; color: var(--muted); font-size: 11px; cursor: pointer; position: relative;
}
.tab-item .ico { font-size: 20px; }
.tab-item.active { color: var(--primary); font-weight: 600; }
.tab-item .badge { position: absolute; top: 2px; right: calc(50% - 20px); background: var(--red); color: #fff; border-radius: 8px; font-size: 10px; padding: 0 5px; }

/* ---------- 组件 ---------- */
.btn {
  border: none; border-radius: 8px; padding: 9px 16px; font-size: 14px; cursor: pointer;
  background: #efe9df; color: var(--text); display: inline-flex; align-items: center; gap: 6px; justify-content: center;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:disabled { background: #c9a9a2; }
.btn.success { background: var(--green); color: #fff; }
.btn.danger { background: var(--red); color: #fff; }
.btn.warning { background: var(--orange); color: #fff; }
.btn.ghost { background: transparent; border: 1px solid var(--border); }
.btn.ghost.on-dark { border-color: rgba(255,255,255,.3); color: #fff; }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn.block { width: 100%; }
.icon-btn { border: none; background: transparent; font-size: 20px; cursor: pointer; padding: 4px 8px; }

.card { background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(60,40,20,.06); }
.card h3 { font-size: 15px; margin-bottom: 12px; color: var(--primary-dark); }
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
.toolbar .spacer { flex: 1; }

/* ---------- 查询条件栏 ----------
   所有带筛选的表单页统一走这套结构：条件在左、动作靠右；
   日期成对包在一个胶囊里且宽度固定 —— 原生 date 控件在 width:100% 下会拉得极长。 */
.query-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
/* 搜索框的弹性基准要够小，否则它先把整行占满，把右侧的动作按钮挤到第二行。
   150px 起步能在 1024 宽的一屏里把「搜索 + 3 个筛选 + 日期 + 按钮」放进同一行。 */
/* flex-basis 取 0：搜索框只吃「剩下的空间」，不会因为基准太大把按钮挤到第二行，
   窄屏下再靠 min-width 保住可读宽度。 */
.query-bar .q-search { flex: 1 1 0; min-width: 90px; width: auto; }
/* 选筛最多 168，最小 100：销售页有 3 个筛选 + 日期 + 3 个按钮，
   再宽就整行放不下，「查询」会被挤到第二行显得零散。 */
.query-bar .q-sel { flex: 0 0 auto; width: auto; min-width: 100px; max-width: 168px; }
.query-bar .q-date { flex: 0 0 auto; width: 148px; }
.query-bar .q-check { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.query-bar .q-check input { width: auto; }
.query-dates {
  display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; padding: 0 8px;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
.query-dates input[type="date"] {
  border: none; background: transparent; width: 132px; padding: 9px 2px; flex: 0 0 auto;
}
.query-dates .q-sep { color: var(--muted); font-size: 12px; flex-shrink: 0; }
.query-bar .q-actions { display: flex; gap: 8px; margin-left: auto; flex: 0 0 auto; }

/* ---------- 可搜索下拉（增强原生 select） ---------- */
.ssel { position: relative; width: 100%; min-width: 0; }
.ssel-native { display: none; }
.ssel-btn {
  width: 100%; display: flex; align-items: center; gap: 6px; text-align: left;
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px; line-height: 1.2;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--text); cursor: pointer;
}
.ssel-btn:hover { border-color: #d8cfc0; }
.ssel.open > .ssel-btn { border-color: var(--primary); }
.ssel-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ssel-label.ph { color: var(--muted); }
.ssel-caret { flex-shrink: 0; color: var(--muted); font-size: 10px; transition: transform .15s; }
.ssel.open .ssel-caret { transform: rotate(180deg); }
.ssel-pop {
  position: fixed; z-index: 320; background: #fff; border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 14px 36px rgba(60,40,20,.2); padding: 8px;
}
.ssel-pop.hidden { display: none; }
.ssel-input { width: 100%; padding: 7px 9px; font-size: 13px; margin-bottom: 6px; border-radius: 7px; }
.ssel-list { max-height: 264px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.ssel-opt {
  padding: 8px 9px; border-radius: 6px; font-size: 13px; cursor: pointer;
  white-space: normal; overflow-wrap: anywhere; line-height: 1.45;   /* 长名称+规格换行展示，不截断 */
}
.ssel-opt:hover, .ssel-opt.active { background: #f6f1e8; }
.ssel-opt.sel { color: var(--primary); font-weight: 600; background: #faf4ec; }
.ssel-empty { padding: 12px 8px; text-align: center; color: var(--muted); font-size: 12px; }
.ssel-empty.hidden { display: none; }
/* 远程分页 footer：只在挂了 _remote 的商品下拉里出现 */
.ssel-foot { display: flex; gap: 8px; align-items: center; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border); }
.ssel-foot.hidden { display: none; }
.ssel-foot .sf-info { flex: 1; text-align: center; font-size: 12px; color: var(--muted); }
.ssel-foot .sf-btn { width: auto; padding: 4px 10px; font-size: 12px; border: 1px solid var(--border); border-radius: 6px; background: #fff; cursor: pointer; }
.ssel-foot .sf-btn:disabled { opacity: .45; cursor: default; }
/* 明细行里的下拉要塞进窄列，内边距和字号收一档 */
.item-row .ssel { width: 100%; min-width: 0; }
.item-row .ssel-btn { padding: 7px 8px; font-size: 13px; }
.item-row .ssel .ssel-label { font-size: 13px; }

input, select, textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px;
  font-size: 14px; background: #fff; color: var(--text); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
input.inline, select.inline { width: auto; }
/* 原生日期控件不需要整行宽度：拉满一屏既不好看也不好点 */
input[type="date"] { max-width: 200px; }
.form-item input[type="date"], .grid2 input[type="date"], .grid3 input[type="date"] { max-width: 100%; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.stat {
  background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: 0 1px 3px rgba(60,40,20,.06);
}
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 20px; font-weight: 700; margin-top: 4px; }
.stat .value.gold { color: var(--gold); }
.stat .value.red { color: var(--red); }
.stat .value.green { color: var(--green); }
.stat .sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 8px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; background: #faf8f4; }
tr.low-row td { background: #fdf3e7; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; }
.tag.gray { background: #eee8de; color: #6b6259; }
.tag.green { background: #e3f2e9; color: var(--green); }
.tag.red { background: #fae3e0; color: var(--red); }
.tag.blue { background: #e3ecf7; color: var(--blue); }
.tag.orange { background: #fbf0dc; color: var(--orange); }
.tag.gold { background: #f5ecd7; color: #8a6d1f; }

.empty { text-align: center; color: var(--muted); padding: 36px 0; }
.empty .ico { font-size: 40px; margin-bottom: 8px; }

/* 列表条数提示：让"到底有没有查到数据"一眼可见，不再靠猜 */
.list-tip {
  font-size: 12px; color: var(--muted);
  padding: 2px 2px 10px; display: flex; align-items: center; flex-wrap: wrap;
}
.list-tip b { color: var(--primary-dark); font-weight: 700; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(30,20,10,.5); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: #fff; width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto;
  border-radius: 16px 16px 0 0; padding: 16px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; cursor: move; user-select: none; }
.modal-head h3 { font-size: 16px; color: var(--primary-dark); }
.modal-close { border: none; background: transparent; font-size: 22px; cursor: pointer; color: var(--muted); }
.modal-foot { display: flex; gap: 10px; margin-top: 16px; position: sticky; bottom: -16px; background: #fff; padding: 10px 0 2px; border-top: 1px solid var(--border); }
.modal-foot .btn { flex: 1; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* 单据明细行 */
.item-row {
  display: grid; grid-template-columns: 1fr 78px 88px 84px 32px; gap: 6px; align-items: center;
  padding: 8px 0; border-bottom: 1px dashed var(--border);
}
/* 采购行：商品/数量/裸价/成本(自动)/货款；销售行：商品/档位/折扣/数量/单价/金额 */
.item-row.pu { grid-template-columns: 1fr 58px 84px 96px 88px 28px; }
.item-head { display: grid; gap: 6px; align-items: center; padding: 2px 0 6px; font-size: 12px; color: var(--text-3); }
.item-head span:nth-child(4), .item-head span:nth-child(5) { text-align: right; }
.item-head.pu { grid-template-columns: 1fr 58px 84px 96px 88px 28px; }
.item-row.sale { grid-template-columns: 1fr 72px 72px 58px 80px 84px 28px; }
.item-head.sale { grid-template-columns: 1fr 72px 72px 58px 80px 84px 28px; }
/* 销售行 6 列 + 头部 6 列（商品/档位/折扣/数量/单价/金额），第 5、6 列右对齐 */
.item-head.sale span:nth-child(5), .item-head.sale span:nth-child(6) { text-align: right; }
.item-row select.it-type, .item-row select.it-disc {
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 3px;
  font-size: 13px; background: #fff; color: var(--text); width: 100%;
}
.item-row .cost { color: var(--gold-ink); font-weight: 600; font-size: 12px; text-align: right; }
@media (max-width: 640px) {
  .item-row { grid-template-columns: 1fr 1fr 1fr 40px; }
  .item-row > *:first-child { grid-column: 1 / -1; }
  .item-row .amt { text-align: left; }
}
.item-row .amt { text-align: right; font-weight: 600; font-size: 13px; }
.item-row .del { border: none; background: transparent; color: var(--red); font-size: 18px; cursor: pointer; }
.items-total { display: flex; justify-content: space-between; padding: 10px 0; font-weight: 700; color: var(--primary-dark); }

/* toast */
.toast {
  position: fixed; top: 60px; left: 50%; transform: translateX(-50%);
  background: rgba(40,30,20,.92); color: #fff; padding: 10px 20px; border-radius: 20px;
  font-size: 14px; z-index: 200; max-width: 86vw; text-align: center;
}
.toast.err { background: rgba(160,40,30,.95); }

/* 图表 */
.chart { width: 100%; }
.chart .bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; }
.chart .bar-label { width: 44px; color: var(--muted); flex-shrink: 0; }
.chart .bar-track { flex: 1; background: #f1ece3; border-radius: 4px; height: 14px; overflow: hidden; }
.chart .bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--gold)); border-radius: 4px; }
.chart .bar-value { width: 76px; text-align: right; flex-shrink: 0; }

.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.tab-btn {
  border: 1px solid var(--border); background: #fff; border-radius: 18px; padding: 7px 14px;
  font-size: 13px; cursor: pointer; white-space: nowrap; color: var(--muted);
}
.tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 报表合计行 */
tr.total-row td { font-weight: 700; background: #faf3ea; border-top: 2px solid var(--gold); }

/* ---------- 智能助手（AI 管理端） ---------- */
.muted { color: var(--muted); }
.ai-h { font-size: 13px; color: var(--primary-dark); margin: 0 0 10px; }
.ai-split { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .ai-split { grid-template-columns: 1fr; } }

.ai-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; font-size: 12px; }
.ai-bar-k { flex: 0 0 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-bar-t { flex: 1; height: 6px; background: #f0ebe2; border-radius: 4px; overflow: hidden; }
.ai-bar-t i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--primary)); border-radius: 4px; }
.ai-bar-v { flex: 0 0 32px; text-align: right; color: var(--muted); }

.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ai-chip { font-size: 12px; padding: 3px 10px; border-radius: 12px; border: 1px solid var(--border); }
.ai-chip.on { background: #e3f2e9; border-color: #cbe6d7; color: var(--green); }
.ai-chip.off { background: #f2efe9; color: #a89f94; text-decoration: line-through; }

.ai-note { font-size: 12px; color: var(--muted); line-height: 1.75; }
.ai-note.warn { background: #fbf0dc; color: #8a6520; border-radius: 8px; padding: 9px 11px; }

/* 调试台 / 连通性测试的结果卡片 */
.ai-out { margin-top: 12px; border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: #fdfcf9; }
.ai-out-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 12px; margin-bottom: 8px; }
.ai-tool { font-size: 12px; color: var(--blue); margin-bottom: 4px; }
.ai-answer { white-space: pre-wrap; line-height: 1.85; font-size: 14px; margin: 8px 0 0; }
.ai-notice { font-size: 12px; color: var(--orange); margin-top: 8px; }
.ai-src { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.7; }
.ai-src b { color: var(--primary-dark); }

/* 分块预览 */
.ai-chunk { border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; margin-bottom: 8px; background: #fff; }
.ai-chunk-h { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.ai-chunk-h b { color: var(--primary-dark); }
.ai-chunk-c { white-space: pre-wrap; font-size: 13px; line-height: 1.75; }

/* 检索测试台命中项 */
.ai-hit { border-left: 3px solid var(--gold); padding: 2px 0 2px 11px; margin-bottom: 12px; }
.ai-hit-h { font-size: 12px; color: var(--muted); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.ai-hit-h b { color: var(--primary-dark); }
.ai-score { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--green); }

/* 模型配置表单 */
.ai-form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 14px; }
@media (max-width: 760px) { .ai-form { grid-template-columns: 1fr; } }
.ai-doc-content { min-height: 260px; font-family: inherit; line-height: 1.85; }

/* ---------- 单据识别（拍照导入） ---------- */
.import-top { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; align-items: stretch; }
.import-upload {
  border: 2px dashed #ddcdb6; border-radius: 10px; background: #fdfbf6;
  padding: 18px; text-align: center; transition: border-color .15s, background .15s;
}
.import-upload.drag { border-color: var(--gold); background: #fbf4e3; }
.import-upload .imp-ico { font-size: 32px; line-height: 1.2; }
.import-upload b { display: block; margin: 6px 0 4px; color: var(--primary-dark); font-size: 15px; }
.import-upload .btn { margin-top: 10px; }
.imp-hint { font-size: 12px; color: var(--muted); line-height: 1.7; }
.import-engine {
  border-radius: 10px; padding: 14px 16px; font-size: 12px; line-height: 1.8;
  border: 1px solid var(--border); background: #faf8f4;
}
.import-engine b { display: block; font-size: 14px; margin-bottom: 2px; }
.import-engine.ok { border-color: #cfe6d8; background: #f4faf6; }
.import-engine.ok b { color: var(--green); }
.import-engine.bad { border-color: #f0d5d1; background: #fdf6f5; }
.import-engine.bad b { color: var(--red); }

/* 真实进度拿不到，用滚动示意条，避免长等待时页面看起来像卡死 */
.imp-bar { height: 4px; background: #eee7da; border-radius: 3px; overflow: hidden; margin: 12px 0 6px; }
.imp-bar i { display: block; width: 35%; height: 100%; background: var(--gold); border-radius: 3px; animation: impslide 1.1s ease-in-out infinite; }
@keyframes impslide { 0% { transform: translateX(-100%); } 100% { transform: translateX(330%); } }

.imp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.imp-notice {
  margin-top: 10px; padding: 9px 12px; border-radius: 8px; font-size: 13px; line-height: 1.75;
  background: #fdf6e8; border-left: 3px solid var(--orange); color: #7a5a12;
}
.imp-checks { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 12px 0; }
.imp-check { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.imp-check .ic {
  width: 15px; height: 15px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-size: 10px; color: #fff; background: var(--green);
}
.imp-check.warn { color: var(--orange); }
.imp-check.warn .ic { background: var(--orange); }
.imp-check.error { color: var(--red); font-weight: 600; }
.imp-check.error .ic { background: var(--red); }
.imp-check.info .ic { background: var(--blue); }

.imp-split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0; }
.imp-orig-h { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.imp-orig-box {
  border: 1px solid var(--border); border-radius: 10px; background: #faf8f4;
  padding: 8px; max-height: 420px; overflow: auto;
}
.imp-orig-box img { display: block; width: 100%; height: auto; border-radius: 6px; }
.imp-orig-box .imp-hint { margin-top: 6px; text-align: center; }
.imp-fields { display: flex; flex-direction: column; gap: 10px; }
.imp-sumline { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 12px; color: var(--muted); }
.imp-sumline b { color: var(--primary-dark); font-size: 14px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.imp-risk {
  font-size: 12px; line-height: 1.8; color: #7a5a12; background: #fdf6e8;
  border-left: 3px solid var(--gold); border-radius: 6px; padding: 8px 12px;
}

.imp-items-head { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--primary-dark); font-weight: 600; margin: 6px 0 8px; }
.imp-items-head .card-bar { width: 3px; height: 14px; background: var(--gold); border-radius: 2px; }
.imp-items { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.imp-row {
  display: grid; grid-template-columns: 38px minmax(150px, 1.7fr) 118px minmax(150px, 1.5fr) 74px 88px 92px;
  gap: 8px; align-items: center; padding: 8px 10px; border-bottom: 1px solid #f0ebe2; font-size: 13px;
}
.imp-row:last-child { border-bottom: none; }
.imp-row-head { background: #f7f3ec; font-size: 12px; color: var(--muted); font-weight: 600; padding: 7px 10px; }
.imp-row.has-err { background: #fdf6f5; box-shadow: inset 3px 0 0 var(--red); }
.imp-row.has-warn { background: #fdfaf1; box-shadow: inset 3px 0 0 var(--orange); }
.imp-seq { color: var(--muted); font-size: 12px; text-align: center; }
.imp-raw { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.imp-raw b { font-weight: 600; word-break: break-all; }
.imp-raw i { font-style: normal; font-size: 11px; color: var(--muted); word-break: break-all; }
.imp-raw em { font-style: normal; font-size: 11px; line-height: 1.6; margin-top: 2px; }
.imp-raw em.err { color: var(--red); }
.imp-raw em.warn { color: var(--orange); }
.imp-prodcell { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.imp-prodcell select, .imp-prodcell input { width: 100%; min-width: 0; }
.imp-row input, .imp-row select {
  padding: 5px 7px; font-size: 12px; border: 1px solid var(--border); border-radius: 6px;
  background: #fff; width: 100%;
}
.imp-row input:disabled, .imp-row select:disabled { background: #f5f2ec; color: var(--muted); }
.imp-amt { text-align: right; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--primary-dark); padding-right: 4px; }
.imp-total {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin-top: 12px; padding: 10px 14px; border-radius: 8px; background: #f7f3ec; font-size: 13px; color: var(--muted);
}
.imp-total b { font-size: 18px; color: var(--primary); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

@media (max-width: 760px) {
  .import-top { grid-template-columns: 1fr; }
  .imp-split { grid-template-columns: 1fr; }
  .imp-orig-box { max-height: 300px; }
  /* 小屏把每行拆成卡片：名称占满首行，其余字段两列排 */
  .imp-row-head { display: none; }
  .imp-row { grid-template-columns: 1fr 1fr; gap: 6px 8px; padding: 10px; }
  .imp-seq { grid-column: 1 / -1; text-align: left; }
  .imp-seq::before { content: '第 '; }
  .imp-seq::after { content: ' 行'; }
  .imp-raw, .imp-prodcell { grid-column: 1 / -1; }
  .imp-row > span:nth-child(3)::before { content: '处理：'; font-size: 11px; color: var(--muted); }
  .imp-row > span:nth-child(5)::before { content: '数量：'; font-size: 11px; color: var(--muted); }
  .imp-row > span:nth-child(6)::before { content: '单价：'; font-size: 11px; color: var(--muted); }
  .imp-row > span:nth-child(7)::before { content: '金额：'; font-size: 11px; color: var(--muted); }
  .imp-amt { text-align: left; }
  .imp-total { flex-wrap: wrap; }
}

/* ---------- 桌面端 ---------- */
@media (min-width: 820px) {
  .only-mobile { display: none !important; }
  .only-desktop { display: flex !important; }
  .sidebar { transform: translateX(0); }
  .main { margin-left: var(--sidebar-w); }
  .tabbar { display: none; }
  .content { padding: 20px 24px 40px; padding-bottom: 40px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .modal-mask { align-items: center; }
  .modal { border-radius: 16px; }
  .modal-foot { bottom: -16px; }
  th, td { padding: 10px 12px; }
  .grid2 { gap: 14px; }
}
