/* ============================================================
   圣强采购单 · layui 主题补充
   基础 UI 全部使用 layui（按钮/表单/表格/弹窗/分页/标签页），
   这里放项目自定义组件样式与少量工具类
   ============================================================ */
:root {
  --sq-paper: #f5f6f8;
  --sq-ink: #1a1a1a;
  --sq-primary: #1673ff;   /* 项目主色（覆盖 layui 默认绿） */
  --sq-danger: #ff5722;
  --nav-h: 64px;      /* 顶部导航高度 */
  --side-w: 190px;    /* 左侧功能栏宽度 */
}

body { background: var(--sq-paper); font-size: 14px; }
.serif { font-family: "Source Han Serif SC", "Noto Serif SC", "SimSun", serif; }

/* ---------- layui 主色对齐项目蓝 ---------- */
.layui-btn { background-color: var(--sq-primary); border-radius: .4rem; }
.layui-btn:hover { background-color: #0f5fe0; opacity: 1; }
.layui-btn-primary { background: #fff; color: #37393d; border: 1px solid #d9dbe0; }
.layui-btn-primary:hover { border-color: var(--sq-primary); color: var(--sq-primary); background: #fff; }
.layui-btn-primary[disabled] { border-color: #eee; color: #bbb; }
.layui-btn-danger, .btn-danger-solid { background-color: var(--sq-danger) !important; }
.btn-danger-solid:hover { background-color: #e64a19 !important; }
/* 深色按钮（安装/升级页） */
.layui-btn-dark { background-color: var(--sq-ink) !important; }
.layui-btn-dark:hover { background-color: #333 !important; }
/* 红色描边按钮（删除类操作） */
.btn-del {
  background: #fff !important; color: var(--sq-danger) !important;
  border: 1px solid #ffb59d !important;
}
.btn-del:hover { background: var(--sq-danger) !important; color: #fff !important; border-color: var(--sq-danger) !important; }

/* layui 输入框紧凑化 */
.layui-input, .layui-select, .layui-textarea { border-radius: .4rem; }
.layui-input-sm { height: 30px; font-size: 13px; }
.layui-input-sm, .layui-select-sm { font-size: 13px; }
.layui-input[disabled] { background: #f6f7f9; color: #9aa0a6; cursor: not-allowed; }
.layui-select { height: 38px; }
.sq-label { display: block; font-size: 12px; color: #6b7280; margin-bottom: .25rem; }
.hint { font-size: 12px; color: #9aa0a6; margin-top: .25rem; line-height: 1.6; }
.sq-check { accent-color: var(--sq-primary); width: 15px; height: 15px; cursor: pointer; vertical-align: -2px; }

/* 轻提示条（原 bootstrap alert） */
.sq-alert { padding: .45rem .7rem; border-radius: .4rem; font-size: 13px; line-height: 1.6; }
.sq-alert-danger { background: #fdecea; color: #c0392b; border: 1px solid #f5c6c0; }
.sq-alert-warn { background: #fff8e6; color: #9a6b00; border: 1px solid #f5e0a8; }
.sq-alert-info { background: #eef4ff; color: #2b5fb8; border: 1px solid #cdddfb; }

/* ---------- 面板（原 bootstrap card） ---------- */
.panel {
  background: #fff; border: 1px solid #e9eaee; border-radius: .6rem;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.panel-head { padding: .6rem .85rem; border-bottom: 1px solid #f0f1f4; }
.panel-body { padding: .85rem; }
.panel-foot { padding: .55rem .85rem; border-top: 1px solid #f0f1f4; background: #fbfbfc; border-radius: 0 0 .6rem .6rem; }
#summaryBar.panel-foot { background: #f7f8fa; border-top: 0; }

/* 卡片小标题：左侧色条 */
.section-title { position: relative; padding-left: .6rem; font-weight: 600; font-size: 15px; margin: 0; }
.section-title::before {
  content: ''; position: absolute; left: 0; top: .18em; bottom: .18em;
  width: 3px; border-radius: 2px; background: var(--sq-primary);
}
.section-title-inline { font-size: 15px; font-weight: 600; }

/* ---------- 表格（基于 layui-table 微调） ---------- */
.sq-table { margin: 0; }
.sq-table th, .sq-table td { padding: .45rem .6rem !important; white-space: normal; }
.sq-table thead th {
  background: #f7f8fa !important; color: #6b7280;
  font-weight: 600; font-size: 12.5px; letter-spacing: .3px; white-space: nowrap;
}
.sq-table td { vertical-align: middle; }
.sq-table tbody tr:hover, .layui-table-hover { background: #f6f9ff !important; }
.sq-table tbody tr > td:first-child, .sq-table thead tr > th:first-child { padding-left: .85rem !important; }
.sq-table tbody tr > td:last-child, .sq-table thead tr > th:last-child { padding-right: .85rem !important; }
.sq-table-plain th, .sq-table-plain td { padding: .3rem 0 !important; border: 0 !important; }
.sq-table-plain th { color: #6b7280; font-weight: 400; width: 40%; }
.table-wrap { overflow-x: auto; }
/* AI 识别结果核对弹窗：表头加粗 */
#aiResultWrap thead th { font-weight: 700; font-size: 13px; color: #4b5563; }
/* 进货单据列表：表头与内容水平居中 */
#billTable thead th, #billTable tbody td { text-align: center !important; }
#billTable tbody td .layui-btn-xs { margin: 0 1px; }
#billTable tbody td:last-child, #billTable thead th:last-child { white-space: nowrap; }
/* 列表页可点击修改的供应商/业务员，及明细页可点击修改的公司成本 */
.qs-edit, .cost-edit { color: #37393d; text-decoration: none; border-bottom: 1px dashed #c9cdd4; cursor: pointer; }
.qs-edit:hover, .cost-edit:hover { color: var(--sq-primary); border-bottom-color: var(--sq-primary); }
.link-primary { color: var(--sq-primary); }
.link-secondary { color: #6b7280; }
.link-primary:hover, .link-secondary:hover { opacity: .8; }

/* ---------- 顶部导航（仅品牌 + 用户区，导航入口在左侧栏） ---------- */
.main-nav {
  background: linear-gradient(135deg, #1554c0 0%, #1673ff 100%); color: #fff;
  box-shadow: 0 2px 8px rgba(21, 84, 192, .25);
  position: sticky; top: 0; z-index: 100;
}
.nav-inner { display: flex; align-items: center; height: var(--nav-h); padding: 0 .8rem; }
.nav-brand {
  color: #fff; text-decoration: none; white-space: nowrap; margin-right: 2rem;
  font-size: 16px; font-weight: 600; letter-spacing: 1px;
  transition: opacity .15s;
}
.nav-brand:hover { opacity: .85; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: .8rem; }
.nav-user { font-size: 13px; color: rgba(255,255,255,.7); }
.nav-logout {
  background: transparent; border: 1px solid rgba(255,255,255,.35); color: #fff;
  font-size: 12px; padding: .25rem .7rem; border-radius: .4rem; cursor: pointer;
}
.nav-logout:hover { border-color: #fff; }

/* ---------- 左侧功能栏 + 右侧内容区 ---------- */
.app-shell { display: flex; min-height: calc(100vh - var(--nav-h)); }
.app-sidebar {
  position: sticky; top: var(--nav-h); align-self: flex-start;
  display: flex; flex-direction: column;
  width: var(--side-w); flex: 0 0 var(--side-w);
  height: calc(100vh - var(--nav-h));
  background: #fff; border-right: 1px solid #e9eaee; overflow: hidden;
}
.app-main { flex: 1 1 auto; min-width: 0; }
.app-pad { padding: 1rem 1rem 2rem; }
.app-sidebar .sidebar-label {
  padding: .85rem .9rem .4rem; font-size: 12px; font-weight: 600;
  color: #9aa0a6; letter-spacing: 1px; white-space: nowrap;
}
/* layui 原生 layui-nav-tree 垂直导航：覆盖默认深色为主题白底样式
   （layui 的 .layui-nav.layui-nav-tree 固定 200px 宽，需同级特异性覆盖，否则折叠后图标被裁掉） */
.sq-side-nav.layui-nav-tree {
  width: calc(100% - 1rem); margin: 0 .5rem .2rem; padding: .2rem .1rem;
  background: none; border-radius: .45rem;
}
.sq-side-nav .layui-nav-item { margin-bottom: 2px; }
/* layui 默认给 .layui-this 的 li 加青色背景，这里去掉，选中态只在 a 上体现 */
.sq-side-nav .layui-this { background: none; color: inherit; }
.sq-side-nav .layui-nav-item > a {
  position: relative; display: flex; align-items: center;
  padding: .6rem .7rem .6rem 1.1rem; border-radius: .45rem;
  color: #4b5563; font-size: 15px; white-space: nowrap; background: none;
}
.sq-side-nav .layui-nav-item > a:hover { background: #f4f5f7; color: #1a1a1a; }
.sq-side-nav .layui-this > a,
.sq-side-nav .layui-this > a:hover { background: rgba(22, 115, 255, .1); color: var(--sq-primary); font-weight: 600; }
.sq-side-nav .layui-this > a::before {
  content: ''; position: absolute; left: .35rem; top: 50%; transform: translateY(-50%);
  width: 3px; height: 16px; border-radius: 2px; background: var(--sq-primary);
}
.sidebar-foot { margin-top: auto; padding: .8rem .9rem; font-size: 12px; color: #b0b4ba; border-top: 1px solid #f0f1f4; }

/* 功能栏折叠/展开（layui 图标） */
.app-sidebar { transition: width .18s ease, flex-basis .18s ease; }
.sidebar-foot { position: relative; display: flex; align-items: center; justify-content: center; padding: .55rem .85rem; font-size: 13px; color: #6b7280; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; }
.sidebar-foot:hover { background: #f4f5f7; color: var(--sq-primary); }
.sidebar-foot .layui-icon { font-size: 15px; margin-right: .55rem; }
.sidebar-foot .ico-spread { display: none; }
/* 「折叠菜单」文字始终占位，仅透明度过渡：展开动画结束后延迟淡入，收起时立即淡出，避免挤压跳动 */
.sidebar-foot .side-txt { white-space: nowrap; opacity: 1; transition: opacity .1s ease .18s; }
.side-ico { width: 20px; text-align: center; flex: none; margin-right: .55rem; font-size: 16px; color: #8b9099; }
.side-txt { flex: none; }   /* 动画中文字不被压缩换行，仅被裁切 */
.sq-side-nav .layui-nav-item > a:hover .side-ico { color: #1a1a1a; }
.sq-side-nav .layui-this .side-ico { color: var(--sq-primary); }
.app-sidebar.collapsed { width: 60px; flex: 0 0 60px; overflow: hidden; }
.app-sidebar.collapsed .sidebar-label { visibility: hidden; }   /* 保留占位，避免菜单上下跳动 */
.app-sidebar.collapsed .side-txt { display: none; }
.app-sidebar.collapsed .sidebar-foot { padding-left: 0; padding-right: 0; }
.app-sidebar.collapsed .sidebar-foot .side-txt { position: absolute; opacity: 0; transition: opacity .06s ease; }
.app-sidebar.collapsed .sidebar-foot .layui-icon { margin-right: 0; }
.app-sidebar.collapsed .sidebar-foot .ico-shrink { display: none; }
.app-sidebar.collapsed .sidebar-foot .ico-spread { display: inline; }
.app-sidebar.collapsed .sq-side-nav .layui-nav-item > a { padding-left: 0; padding-right: 0; justify-content: center; }
.app-sidebar.collapsed .sq-side-nav .layui-this > a::before { display: none; }
.app-sidebar.collapsed .side-ico { margin-right: 0; }

/* ---------- 配置页标签页 ---------- */
.cfg-tab { max-width: 900px; }
.cfg-tab .layui-tab-title { border-bottom-color: #e9eaee; }
.cfg-tab .layui-tab-title .layui-this { color: var(--sq-primary); font-weight: 600; }
.cfg-tab .layui-tab-title .layui-this:after {
  border-bottom-color: var(--sq-primary);
}

/* ---------- 关键词联想下拉（供应商/业务员） ---------- */
.ac-drop {
  position: absolute; z-index: 19892000;
  background: #fff; border: 1px solid #e0e2e8; border-radius: .4rem;
  box-shadow: 0 6px 20px rgba(16,24,40,.12);
  max-height: 240px; overflow-y: auto;
}
.ac-item { padding: .4rem .7rem; font-size: 13px; cursor: pointer; color: #37393d; }
.ac-item:hover { background: #f2f6ff; color: var(--sq-primary); }
.ac-item.ac-add { color: var(--sq-primary); border-bottom: 1px dashed #e6e8ec; }
.ac-empty { padding: .5rem .7rem; font-size: 12.5px; color: #9aa0a6; cursor: default; }

/* ---------- 登录页 ---------- */
.login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse 900px 500px at 15% -10%, rgba(22,115,255,.05), transparent),
    radial-gradient(ellipse 700px 400px at 95% 110%, rgba(22,115,255,.04), transparent),
    var(--sq-paper);
  padding: 24px;
}
.login-card {
  width: 400px; max-width: 100%; background: #fff;
  border: 1px solid #e9eaee; border-radius: .6rem;
  border-top: 3px solid var(--sq-primary);
  box-shadow: 0 8px 30px rgba(16, 24, 40, .08);
}
.login-card-body { padding: 2.2rem; }
.brand-logo {
  font-size: 20px; letter-spacing: 1px; color: var(--sq-ink); font-weight: 600;
  white-space: nowrap;
}


/* ---------- 弹窗（layui layer 页面层） ---------- */
.sq-layer { border-radius: .6rem; overflow: hidden; }
.sq-layer .layui-layer-title { background: #fff; border-bottom: 1px solid #f0f1f4; font-size: 14px; font-weight: 600; color: #1a1a1a; }
.sq-layer .layui-layer-btn { text-align: right; }
.modal-pad { padding: 1.1rem 1.1rem .4rem; }
.modal-pad-small { padding: .9rem 1.1rem .2rem; max-height: calc(88vh - 120px); overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; align-items: center; gap: .5rem;
  padding: .65rem 1.1rem; border-top: 1px solid #f0f1f4; background: #fbfbfc;
}

/* 上传虚线框 */
.upload-zone {
  border: 2px dashed #d5d8de; border-radius: .6rem; padding: 22px 16px;
  text-align: center; color: #8b8f96; transition: all .18s; cursor: pointer; background: #fcfcfd;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--sq-primary); background: #f2f6ff; color: var(--sq-primary); }
.upload-zone .upload-icon {
  width: 44px; height: 44px; margin: 0 auto 8px; border-radius: 50%;
  background: rgba(22,115,255,.08); color: var(--sq-primary);
  font-size: 26px; line-height: 1; display: flex; align-items: center; justify-content: center;
}

/* 图片墙：图片本体 + 下方状态条 + 下方按钮行 */
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(152px, 1fr)); gap: 12px; }
.img-cell {
  position: relative; border: 1px solid #e6e8ec; border-radius: .55rem;
  background: #fff; overflow: visible; z-index: 1;
}
.img-cell.failed { border-color: #e05a3f; }
.img-cell.picked { border-color: var(--sq-primary); box-shadow: 0 0 0 2px rgba(22,115,255,.12); }
.img-thumb {
  position: relative; aspect-ratio: 1/1; overflow: hidden;
  background: #eef0f3; border-radius: calc(.55rem - 1px) calc(.55rem - 1px) 0 0;
}
.img-thumb img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.img-cell .pick {
  position: absolute; top: 8px; left: 8px; z-index: 2; margin: 0;
  width: 18px; height: 18px; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  border: 2px solid rgba(255,255,255,.95); border-radius: 50%;
  background: rgba(17,24,39,.28); backdrop-filter: blur(2px);
  transition: background .15s, border-color .15s;
}
.img-cell .pick:hover { background: rgba(17,24,39,.5); }
.img-cell .pick:checked { background-color: var(--sq-primary); border-color: #fff; }
.img-cell .pick:checked::after {
  content: ''; position: absolute; left: 4px; top: 1px;
  width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
/* 图片卡片右上角菜单 */
.img-menu-wrap { position: absolute; top: 7px; right: 7px; z-index: 3; }
.img-menu-btn {
  width: 24px; height: 24px; border: none; border-radius: 50%;
  background: rgba(17,24,39,.55); color: #fff;
  cursor: pointer; padding: 0; backdrop-filter: blur(2px); transition: background .15s;
  position: relative;
}
.img-menu-btn::before {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 3px; height: 3px; border-radius: 50%; background: #fff;
  transform: translate(-50%, -50%);
  box-shadow: -5px 0 0 #fff, 5px 0 0 #fff;
}
.img-menu-btn:hover { background: rgba(17,24,39,.85); }
.img-cell.menu-open { z-index: 20; }
.img-cell.menu-open .img-menu { display: block; }
.img-menu {
  display: none; position: absolute; right: 0; top: 28px; min-width: 116px;
  background: #fff; border: 1px solid #e6e8ec; border-radius: .45rem;
  box-shadow: 0 6px 20px rgba(17,24,39,.14); overflow: hidden; padding: 4px 0;
}
.img-menu a { display: block; padding: 7px 12px; font-size: 12.5px; color: #374151; text-decoration: none; white-space: nowrap; }
.img-menu a:hover { background: #f3f4f6; }
.img-menu a.del-img { color: #c0392b; }
.img-meta {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 12px; color: #6b7280; padding: 6px 8px 0;
}
.img-meta .dot { width: 7px; height: 7px; border-radius: 50%; background: #c9ccd2; flex: none; }
.img-meta .dot.ok { background: var(--sq-primary); }
.img-meta .dot.err { background: #e05a3f; }
.img-meta .cnt { margin-left: auto; font-variant-numeric: tabular-nums; }
.img-btns { display: flex; flex-wrap: nowrap; gap: 4px; padding: 6px 8px 8px; }
.img-btns .layui-btn { font-size: 12px; padding: 0 .3rem; height: 24px; line-height: 24px; border-radius: .35rem; flex: 1 1 0; min-width: 0; white-space: nowrap; text-align: center; }

/* 图片信息弹窗缩略图 */
.info-thumb { width: 108px; height: 108px; object-fit: cover; border-radius: .4rem; border: 1px solid #e6e8ec; cursor: zoom-in; }

/* 二维码 */
.qr-box #qrcode img { display: inline-block; }
.qr-frame { border: 1px solid #e6e8ec; border-radius: .4rem; background: #fff; }

/* 汇总条 */
#summaryBar .stat b {
  font-size: 15px; color: #1a1a1a; font-variant-numeric: tabular-nums; margin-left: 4px;
}
#summaryBar .stat b.red { color: #e05a3f; }
#summaryBar .stat + .stat { border-left: 1px solid #e9ecef; padding-left: 16px; }

/* AI 核对表输入框紧凑化 */
#aiResultWrap .layui-input { height: 28px; font-size: 13px; padding: 2px 8px; }
#aiResultWrap table td { min-width: 0; }
/* laypage 分页右对齐微调 */
#billPager .layui-laypage { margin: 0; }

/* 手机端 m.php */
.m-body { background: var(--sq-paper); min-height: 100vh; padding: 20px 16px 40px; }
.m-head { text-align: center; padding: 12px 0 10px; }
.m-head .m-logo { font-family: "Source Han Serif SC", serif; font-size: 22px; color: var(--sq-ink); letter-spacing: 4px; font-weight: 600; }
.m-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px; font-size: 17px;
  background: var(--sq-ink); color: #fff; border: 0; border-radius: .55rem; cursor: pointer;
}
.m-btn[disabled] { opacity: .5; cursor: not-allowed; }
.m-panel {
  background: #fff; border: 1px solid #e9eaee; border-radius: .6rem;
  box-shadow: 0 1px 2px rgba(16,24,40,.04); padding: 2.4rem 1.4rem;
  text-align: center; color: #6b7280;
}
.m-panel .m-warn { font-size: 2.4rem; margin-bottom: .4rem; }
.m-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.m-cell { position: relative; aspect-ratio: 1; border-radius: .5rem; overflow: hidden; border: 1px solid #e6e5e1; }
.m-cell img { width: 100%; height: 100%; object-fit: cover; }
.m-cell .prog { position: absolute; bottom: 0; left: 0; height: 3px; background: var(--sq-primary); width: 0; transition: width .2s; }
.m-cell .ok-badge {
  position: absolute; top: 4px; right: 4px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--sq-primary); color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center;
}

/* ---------- 少量工具类（供动态渲染的结构使用） ---------- */
.d-flex { display: flex; }
.d-inline-block { display: inline-block; }
.flex-grow-1 { flex-grow: 1; }
.flex-wrap { flex-wrap: wrap; }
.align-items-center { align-items: center; }
.align-items-end { align-items: flex-end; }
.justify-content-between { justify-content: space-between; }
.justify-content-end { justify-content: flex-end; }
.gap-1 { gap: .25rem; } .gap-2 { gap: .5rem; } .gap-3 { gap: 1rem; } .gap-4 { gap: 1.5rem; }
.text-center { text-align: center; }
.text-end { text-align: right; }
.text-nowrap { white-space: nowrap; }
.text-break { word-break: break-all; }
.text-secondary { color: #6b7280; }
.small { font-size: 12.5px; }
.fw-semibold { font-weight: 600; }
.text-decoration-none { text-decoration: none; }
.mb-0 { margin-bottom: 0 !important; }
.mt-1 { margin-top: .25rem; } .mt-2 { margin-top: .5rem; } .mt-3 { margin-top: 1rem; } .mt-4 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .25rem; } .mb-2 { margin-bottom: .5rem; } .mb-3 { margin-bottom: 1rem; } .mb-4 { margin-bottom: 1.5rem; }
.ms-1 { margin-left: .25rem; } .ms-2 { margin-left: .5rem; }
.ps-4 { padding-left: 1.4rem; }
.p-2 { padding: .5rem; }
.w-100 { width: 100%; }
.py-2 { padding-top: .5rem; padding-bottom: .5rem; }
.py-4 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
