/* ============================================================
   内部采购历史数据库 · 设计令牌
   逐项对齐 Ardot 设计稿实测值
   ============================================================ */

:root {
  /* —— 色彩 —— */
  --c-brand: #0052d9;            /* Logo 蓝 rgb(0,82,217) */
  --c-brand-hover: #366ef4;
  --c-brand-light: #f0f8ff;
  --c-bg: #eeeeee;               /* 画布底 rgb(238,238,238) */
  --c-surface: #ffffff;
  --c-border: #e8e8e8;           /* rgb(232,232,232) */
  --c-divider: #f0f0f0;

  --c-text-1: #1a1a1a;           /* 主文本 rgb(26,26,26) */
  --c-text-2: #666666;           /* 次级 rgb(102,102,102) */
  --c-text-3: #999999;           /* 弱化 rgb(153,153,153) */
  --c-text-4: #bfbfbf;

  --c-success: #2ba471;          /* 最低价绿 rgb(43,164,113) */
  --c-danger: #d54941;           /* 涨/预警红 */
  --c-warn: #ed7b2f;

  --c-warn-bg: #fff3e8;          /* 待归类提示条底 rgb(255,243,232) */
  --c-info-bg: #f2f2ff;          /* 录入提示条底 rgb(242,242,255) */
  --c-tag-bg: #f5f5f5;
  --c-hover: #fafafa;

  /* —— 尺寸 —— */
  --sidebar-w: 220px;
  --topbar-h: 64px;
  --radius-card: 6px;
  --radius-sm: 4px;
  --radius-pill: 999px;

  /* —— 字号 —— */
  --fs-12: 12px;
  --fs-13: 13px;
  --fs-14: 14px;
  --fs-16: 16px;
  --fs-20: 20px;
  --fs-26: 26px;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-pop: 0 6px 16px rgba(0, 0, 0, 0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI",
               "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: var(--fs-13);
  color: var(--c-text-1);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }
svg { display: block; }
table { border-collapse: collapse; width: 100%; }

/* ============================ 骨架 ============================ */

.app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }

/* ---------------------------- 侧边导航 ---------------------------- */

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  height: 100%;
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 60;
}

.sidebar-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .34);
  z-index: 55;
}
.sidebar-mask.show { display: block; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
}

.brand-logo {
  width: 34px; height: 34px;
  border-radius: 8px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 34px;
  background: #fff;
}
/* LOGO 图片：铺满容器，等比不裁切 */
.brand-logo img, .login-logo img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}

.brand-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.brand-name {
  font-size: var(--fs-13); font-weight: 500; color: var(--c-text-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.brand-sub {
  font-size: var(--fs-12); color: var(--c-text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.nav { flex: 1; overflow-y: auto; padding: 0 8px 8px; }
.nav-group { margin-top: 12px; }
.nav-group:first-child { margin-top: 4px; }

.nav-group-title {
  padding: 6px 8px;
  font-size: var(--fs-12);
  color: var(--c-text-3);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-13);
  color: var(--c-text-2);
  transition: background .15s, color .15s;
}

.nav-item:hover { background: var(--c-hover); color: var(--c-text-1); }

.nav-item.active {
  background: var(--c-brand-light);
  color: var(--c-brand);
  font-weight: 500;
}

.nav-item svg { flex: 0 0 18px; }

.user-area {
  border-top: 1px solid var(--c-border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--c-brand-light);
  color: var(--c-brand);
  font-size: var(--fs-13);
  font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 32px;
}

.user-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.user-name { font-size: var(--fs-13); color: var(--c-text-1); }
.user-role { font-size: var(--fs-12); color: var(--c-text-3); }

/* ---------------------------- 主区 ---------------------------- */

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: var(--topbar-h);
  flex: 0 0 var(--topbar-h);
  background: var(--c-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 16px;
}

.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-title {
  font-size: var(--fs-16); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar-uname { font-size: var(--fs-13); color: var(--c-text-2); }

.tag-inner {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  background: var(--c-brand-light);
  color: var(--c-brand);
  font-size: var(--fs-12);
  white-space: nowrap;
}

.topbar-right { display: flex; align-items: center; gap: 12px; }

.icon-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--c-text-2);
  transition: background .15s;
}
.icon-btn:hover { background: var(--c-hover); }

.menu-btn { display: none; }

.content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.page-stack { display: flex; flex-direction: column; gap: 12px; }

/* ============================ 通用组件 ============================ */

.card {
  background: var(--c-surface);
  border-radius: var(--radius-card);
  padding: 16px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.card-title { font-size: var(--fs-14); font-weight: 500; color: var(--c-text-1); }
.card-desc { font-size: var(--fs-12); color: var(--c-text-3); margin-top: 2px; }
.card-head-group { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-13);
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text-1);
  white-space: nowrap;
  transition: all .15s;
}
.btn:hover { border-color: var(--c-brand); color: var(--c-brand); }

.btn-primary {
  background: var(--c-brand);
  border-color: var(--c-brand);
  color: #fff;
}
.btn-primary:hover { background: var(--c-brand-hover); border-color: var(--c-brand-hover); color: #fff; }

.btn-sm { height: 28px; padding: 0 10px; font-size: var(--fs-12); }
.btn-xs { height: 24px; padding: 0 8px; font-size: var(--fs-12); border-radius: 3px; color: var(--c-text-2); }
.btn-xs:hover { border-color: var(--c-brand); color: var(--c-brand); background: none; }
.btn-xs.btn-danger { color: var(--c-danger); border-color: #f0d5d3; }
.btn-xs.btn-danger:hover { background: #fdecea; border-color: var(--c-danger); color: var(--c-danger); }
.btn-text { border: none; background: none; padding: 0 4px; color: var(--c-text-2); }
.btn-text:hover { color: var(--c-brand); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-block { width: 100%; height: 40px; }
.btn-danger { color: var(--c-danger); border-color: #f5c6c3; }
.btn-danger:hover { background: #fdecea; border-color: var(--c-danger); color: var(--c-danger); }

/* 输入 */
.input, .select {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  font-size: var(--fs-13);
  color: var(--c-text-1);
  background: var(--c-surface);
  outline: none;
  transition: border-color .15s;
  width: 100%;
  min-width: 0;
}
.input:focus, .select:focus { border-color: var(--c-brand); }
.input::placeholder { color: var(--c-text-4); }
.input:disabled { background: var(--c-hover); color: var(--c-text-3); }

.select {
  appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%23999' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  cursor: pointer;
}

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: var(--fs-12); color: var(--c-text-2); }
.hint { font-size: var(--fs-12); color: var(--c-text-3); }

/* 标签 */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  background: var(--c-tag-bg);
  color: var(--c-text-2);
  font-size: var(--fs-12);
  white-space: nowrap;
}
.tag-brand { background: var(--c-brand-light); color: var(--c-brand); }
.tag-soft { background: #f3f6fc; color: #4a6fa5; }
.tag-success { background: #e8f5ee; color: var(--c-success); }
.tag-danger { background: #fdecea; color: var(--c-danger); }
.tag-warn { background: var(--c-warn-bg); color: var(--c-warn); }

/* 提示条 */
.notice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-radius: 3px;
  font-size: var(--fs-13);
  line-height: 1.5;
}
.notice-info { background: var(--c-info-bg); color: var(--c-brand); }
.notice-warn { background: var(--c-warn-bg); color: var(--c-text-1); }
.notice svg { flex: 0 0 auto; }

/* 指标卡 */
.metric-row { display: flex; gap: 16px; flex-wrap: wrap; }
.metric-card {
  flex: 1 1 200px;
  min-width: 0;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-card);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.metric-name { font-size: var(--fs-13); color: var(--c-text-2); }
.metric-value-row { display: flex; align-items: baseline; gap: 4px; }
.metric-value { font-size: var(--fs-26); font-weight: 600; color: var(--c-text-1); line-height: 1.2; }
.metric-unit { font-size: var(--fs-13); color: var(--c-text-2); }
.metric-desc { font-size: var(--fs-12); color: var(--c-text-3); }

/* 表格 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { min-width: 720px; }
.table th {
  height: 44px;
  padding: 0 8px;
  text-align: left;
  font-size: var(--fs-12);
  font-weight: 400;
  color: var(--c-text-3);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}
.table td {
  height: 48px;
  padding: 8px;
  font-size: var(--fs-13);
  color: var(--c-text-1);
  border-bottom: 1px solid var(--c-divider);
  vertical-align: middle;
}
.table tbody tr:hover { background: var(--c-hover); }
.table .cell-stack { display: flex; flex-direction: column; gap: 2px; }
.table .cell-sub { font-size: var(--fs-12); color: var(--c-text-3); }
.table .cell-sub-inline { font-size: var(--fs-12); color: var(--c-text-3); margin-left: 3px; }
.table .cell-proj { font-size: var(--fs-12); color: var(--c-text-2); }
.table .num { font-variant-numeric: tabular-nums; }
.table .muted { color: var(--c-text-3); }
.ta-r { text-align: right !important; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: var(--fs-12); }

.empty {
  padding: 48px 0;
  text-align: center;
  color: var(--c-text-3);
  font-size: var(--fs-13);
}

/* 分页 */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  font-size: var(--fs-12);
  color: var(--c-text-3);
  flex-wrap: wrap;
}
.pager-size { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
/* 分页栏里的每页条数下拉：跟着 28px 高的页码按钮走，别把整行撑高 */
.select-sm {
  height: 26px;
  padding: 0 22px 0 8px;
  font-size: var(--fs-12);
  border-radius: var(--radius-sm);
}
.pager { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pager button {
  min-width: 28px; height: 28px;
  padding: 0 6px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-12);
  color: var(--c-text-2);
  border: 1px solid transparent;
}
.pager button:hover:not(:disabled) { background: var(--c-hover); }
.pager button.active {
  background: var(--c-brand-light);
  color: var(--c-brand);
  border-color: var(--c-brand);
}
.pager button:disabled { color: var(--c-text-4); cursor: not-allowed; }

/* 两栏结果区 */
.result-grid { display: flex; gap: 16px; align-items: flex-start; }
.result-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.result-side { flex: 0 0 320px; width: 320px; display: flex; flex-direction: column; }
.card-table { flex: 1; display: flex; flex-direction: column; }
.card-dist { flex: 1; }

/* 分布条 */
.dist { display: flex; flex-direction: column; gap: 12px; }
.dist-item { display: flex; flex-direction: column; gap: 6px; }
.dist-head { display: flex; align-items: center; justify-content: space-between; font-size: var(--fs-13); gap: 8px; }
.dist-head > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dist-amount { color: var(--c-text-2); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.dist-bar { height: 6px; border-radius: 3px; background: var(--c-divider); overflow: hidden; }
.dist-bar > i { display: block; height: 100%; border-radius: 3px; background: var(--c-brand); transition: width .4s; }
.dist-bar-other > i { background: var(--c-text-3); opacity: .45; }
.dist-title { font-size: var(--fs-13); color: var(--c-text-1); font-weight: 500; margin-bottom: 14px; }
.divider { height: 1px; background: var(--c-border); margin: 16px 0; }

/* 搜索行 */
.search-row { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.search-input-wrap { flex: 1; min-width: 0; position: relative; }
.search-input-wrap .input { height: 42px; padding-left: 38px; }
.search-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--c-text-3); }
.btn-search { height: 42px; padding: 0 28px; }

.filter-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.date-range {
  display: flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 10px;
  border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  background: var(--c-surface);
}
.date-range .input { border: none; padding: 0; height: 34px; font-size: var(--fs-12); width: 118px; }
.price-range {
  display: flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 10px;
  border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  background: var(--c-surface);
}
.price-range .input { border: none; padding: 0; height: 34px; font-size: var(--fs-12); width: 66px; }
.muted { color: var(--c-text-2); font-size: var(--fs-12); }
.muted-ico { color: var(--c-text-3); display: flex; }
.filter-row .select { width: auto; min-width: 130px; }

.col-opt { display: flex; align-items: center; gap: 8px; font-size: var(--fs-13); }

/* 图表 */
.chart-wrap { position: relative; width: 100%; height: 220px; }
.chart-y {
  position: absolute; left: 0; top: 0; bottom: 24px;
  display: flex; flex-direction: column; justify-content: space-between;
  font-size: var(--fs-12); color: var(--c-text-3);
  width: 52px; text-align: right; padding-right: 8px;
  font-variant-numeric: tabular-nums;
}
.chart-x {
  position: absolute; left: 52px; right: 0; bottom: 0;
  display: flex; justify-content: space-between;
  font-size: var(--fs-12); color: var(--c-text-3);
  font-variant-numeric: tabular-nums;
}
.chart-svg { position: absolute; left: 52px; right: 0; top: 0; bottom: 24px; }

/* 分段控件 */
.segmented { display: inline-flex; background: var(--c-tag-bg); border-radius: var(--radius-sm); padding: 2px; }
.segmented button {
  height: 26px; padding: 0 12px; border-radius: 3px;
  font-size: var(--fs-12); color: var(--c-text-2);
  transition: all .15s;
}
.segmented button.active { background: var(--c-surface); color: var(--c-brand); font-weight: 500; }

/* 预警列表 */
.alert-list { display: flex; flex-direction: column; }
.alert-item {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 10px 0;
  font-size: var(--fs-13);
  color: var(--c-text-1);
  border-bottom: 1px solid var(--c-divider);
  line-height: 1.5;
}
.alert-item:last-child { border-bottom: none; }
.alert-item svg { flex: 0 0 14px; margin-top: 2px; }
.alert-warn svg { color: var(--c-warn); }
.alert-info svg { color: var(--c-brand); }

/* 分类树 */
.cat-tree { display: flex; flex-direction: column; gap: 2px; }
.cat-node {
  display: flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-13); color: var(--c-text-1);
  cursor: pointer;
  transition: background .15s;
}
.cat-node:hover { background: var(--c-hover); }
.cat-node.active { background: var(--c-brand-light); color: var(--c-brand); }
.cat-node .cat-caret { width: 14px; display: flex; justify-content: center; color: var(--c-text-3); }
.cat-node .cat-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-node .cat-count { font-size: var(--fs-12); color: var(--c-text-3); font-variant-numeric: tabular-nums; }
.cat-node.child { padding-left: 28px; }

.cat-card { width: 320px; flex: 0 0 320px; }
.cat-rules { flex: 1; min-width: 0; }

/* 标签组 */
.tag-group { display: flex; flex-wrap: wrap; gap: 8px; }

/* 表单栅格 */
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.form-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.form-actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }

/* ============================ 图片上传 ============================ */

.preview-main {
  height: 420px;
  border-radius: var(--radius-sm);
  background: linear-gradient(160deg, #f7f8fa 0%, #eceff4 100%);
  border: 1px solid var(--c-border);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px;
  color: var(--c-text-3); font-size: var(--fs-13);
  overflow: hidden;
  text-align: center;
}
.preview-img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.preview-empty { gap: 10px; }

.preview-thumbs { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; padding-bottom: 2px; }
.preview-thumb {
  width: 72px; height: 72px; flex: 0 0 72px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--c-border);
  background: linear-gradient(160deg, #f7f8fa 0%, #eceff4 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-12); color: var(--c-text-3);
  cursor: pointer;
  overflow: hidden;
  padding: 2px;
  text-align: center;
  line-height: 1.2;
}
.preview-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 3px; }
.preview-thumb.active { border-color: var(--c-brand); box-shadow: 0 0 0 1px var(--c-brand) inset; }

/* 上传区（紧凑型，放图片卡下方） */
.upload-zone {
  margin-top: 12px;
  border: 1px dashed var(--c-border);
  border-radius: var(--radius-card);
  background: var(--c-hover);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all .15s;
  text-align: center;
  padding: 20px 16px;
}
.upload-zone:hover, .upload-zone.dragging {
  border-color: var(--c-brand);
  background: var(--c-brand-light);
}
.upload-ico { color: var(--c-brand); }
.upload-txt { font-size: var(--fs-13); color: var(--c-text-1); }
.upload-txt b { color: var(--c-brand); font-weight: 500; }
.upload-hint { font-size: var(--fs-12); color: var(--c-text-3); }
.upload-actions { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; justify-content: center; }

/* 大尺寸上传区（批量导入页用） */
.upload-zone.lg { height: 240px; }

.file-bar {
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px; padding: 10px 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  font-size: var(--fs-13);
}
.file-bar .file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 两列主体 */
.split { display: flex; gap: 16px; align-items: flex-start; }
.split-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.split-side { flex: 0 0 400px; width: 400px; display: flex; flex-direction: column; gap: 12px; }
.split-side.wide-520 { flex: 0 0 520px; width: 520px; }

.action-bar { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

/* 加载 / 骨架 */
.loading { padding: 40px; text-align: center; color: var(--c-text-3); font-size: var(--fs-13); }

/* 模态 */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, .35);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal {
  width: 100%; max-width: 460px;
  background: var(--c-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-pop);
  padding: 20px;
  max-height: 86vh;
  overflow-y: auto;
}
.modal-title { font-size: var(--fs-16); font-weight: 500; margin-bottom: 16px; }
.modal-body { display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* 轻提示 */
.toast-host {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px;
  align-items: center; pointer-events: none;
  max-width: 90vw;
}
.toast {
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, .82);
  color: #fff;
  font-size: var(--fs-13);
  box-shadow: var(--shadow-pop);
  animation: toast-in .2s ease;
  text-align: center;
}
.toast.ok { background: var(--c-success); }
.toast.err { background: var(--c-danger); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================ 登录 ============================ */

.login-wrap {
  min-height: 60vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--c-surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-card);
  padding: 28px 24px;
  display: flex; flex-direction: column; gap: 14px;
}
.login-logo {
  width: 52px; height: 52px; border-radius: 12px;
  background: #fff;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 2px;
}
.login-title { font-size: var(--fs-20); font-weight: 600; text-align: center; }
.login-desc { font-size: var(--fs-12); color: var(--c-text-3); text-align: center; margin-bottom: 6px; line-height: 1.5; }
.login-err { font-size: var(--fs-12); color: var(--c-danger); min-height: 16px; }
.login-hint { font-size: var(--fs-12); color: var(--c-text-3); text-align: center; margin-top: 4px; }

/* ============================ 后台管理 ============================ */

.admin-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  flex: 0 0 auto;
}
.admin-title { font-size: var(--fs-20); font-weight: 600; }
.admin-sub { font-size: var(--fs-12); color: var(--c-text-3); margin-top: 4px; }
#admin-body { display: flex; flex-direction: column; gap: 16px; }

.tabs {
  display: flex; gap: 4px;
  background: var(--c-surface);
  border-radius: var(--radius-card);
  padding: 6px;
  overflow-x: auto;
  flex: 0 0 auto;
  min-height: 46px;
  align-items: center;
}
.tab {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 16px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-13);
  color: var(--c-text-2);
  white-space: nowrap;
  transition: all .15s;
}
.tab:hover { background: var(--c-hover); color: var(--c-text-1); }
.tab.active { background: var(--c-brand-light); color: var(--c-brand); font-weight: 500; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-card);
  padding: 16px;
  border-left: 3px solid var(--c-brand);
  display: flex; flex-direction: column; gap: 6px;
}
.stat-card.tone-brand { border-left-color: #4a6fa5; }
.stat-card.tone-green { border-left-color: var(--c-success); }
.stat-card.tone-orange { border-left-color: var(--c-warn); }
.stat-card.tone-purple { border-left-color: #8a63d2; }
.stat-label { font-size: var(--fs-12); color: var(--c-text-3); }
.stat-value { font-size: var(--fs-26); font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-desc { font-size: var(--fs-12); color: var(--c-text-3); }

.admin-row { display: flex; gap: 16px; align-items: flex-start; }
.admin-row > .card { flex: 1; min-width: 0; }

/* 横条图 */
.barlist { display: flex; flex-direction: column; gap: 12px; }
.barrow { display: grid; grid-template-columns: 110px 1fr 96px; align-items: center; gap: 10px; }
.barlabel { font-size: var(--fs-12); color: var(--c-text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bartrack { height: 12px; border-radius: 6px; background: var(--c-divider); overflow: hidden; }
.bartrack > i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #4a8cf7, #0052d9); transition: width .4s; }
.bartrack > i.alt { background: linear-gradient(90deg, #56c08d, #2ba471); }
.barval { font-size: var(--fs-12); color: var(--c-text-2); text-align: right; font-variant-numeric: tabular-nums; }

/* 柱状图 */
.spark { overflow-x: auto; }
.spark-inner { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 8px; min-width: 100%; }
.spark-col { flex: 1 0 26px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.spark-bar { width: 100%; max-width: 24px; border-radius: 3px 3px 0 0; background: linear-gradient(180deg, #4a8cf7, #0052d9); }
.spark-x { font-size: 10px; color: var(--c-text-3); white-space: nowrap; }

/* 状态点 */
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.dot.on { background: var(--c-success); }
.dot.off { background: var(--c-text-4); }

.chip {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 8px;
  border-radius: var(--radius-pill);
  background: var(--c-brand-light);
  color: var(--c-brand);
  font-size: var(--fs-12);
  white-space: nowrap;
}

/* 预览框 */
.preview-box {
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 16px;
  background: var(--c-hover);
  display: flex; flex-direction: column; gap: 10px;
}
.pv-brand { display: flex; align-items: center; gap: 10px; }
.pv-logo { width: 30px; height: 30px; border-radius: 8px; background: url('../img/logo.jpg') center/contain no-repeat #fff; flex: 0 0 30px; }
.pv-name { font-size: var(--fs-14); font-weight: 500; }
.pv-sub { font-size: var(--fs-12); color: var(--c-text-3); }
.pv-tip { font-size: var(--fs-12); color: var(--c-text-3); }

/* 表格内按钮 */
.table td .btn-xs + .btn-xs { margin-left: 6px; }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d9d9d9; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #c0c0c0; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   新增组件样式（v2 · 权限改造 + 后台重设计）
   登录页 / 弹窗 / 数据统计 / 员工管理
   ============================================================ */

/* ============================ 登录页（全屏） ============================ */

.login-wrap {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
  padding: 32px 20px;
  background: linear-gradient(150deg, #eef3fb 0%, #f7f9fc 46%, #eaf0f9 100%);
  overflow: hidden;
}

/* 背景装饰：双层柔光 */
.login-bg-deco {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(620px 420px at 12% 8%, rgba(0, 82, 217, .12), transparent 62%),
    radial-gradient(560px 480px at 88% 92%, rgba(43, 164, 113, .10), transparent 60%),
    radial-gradient(420px 320px at 78% 6%, rgba(127, 91, 239, .08), transparent 62%);
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  background: var(--c-surface);
  border-radius: 10px;
  border: 1px solid rgba(0, 82, 217, .08);
  box-shadow: 0 12px 36px rgba(20, 40, 80, .10), 0 2px 6px rgba(20, 40, 80, .04);
  padding: 32px 30px 26px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.login-logo {
  width: 44px; height: 44px; flex: 0 0 44px;
  border-radius: 11px;
  background: #fff;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 82, 217, .18);
}
.login-brand-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.login-title { font-size: 18px; font-weight: 600; color: var(--c-text-1); line-height: 1.25; }
.login-sub { font-size: var(--fs-12); color: var(--c-text-3); }

.login-form { display: flex; flex-direction: column; gap: 14px; }

.login-field { display: flex; flex-direction: column; gap: 7px; }
.login-field > label { font-size: var(--fs-12); color: var(--c-text-2); }

.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.login-input-wrap > svg {
  position: absolute;
  left: 11px;
  color: var(--c-text-3);
  pointer-events: none;
}
.login-input-wrap > input {
  width: 100%;
  height: 42px;
  padding: 0 12px 0 35px;
  border: 1px solid #dddddd;
  border-radius: var(--radius-sm);
  font-size: var(--fs-13);
  color: var(--c-text-1);
  background: var(--c-surface);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.login-input-wrap > input::placeholder { color: #bfbfbf; }
.login-input-wrap > input:focus {
  border-color: var(--c-brand);
  box-shadow: 0 0 0 3px rgba(0, 82, 217, .10);
}
.login-input-wrap > input[type="password"] { padding-right: 40px; }

.pwd-eye {
  position: absolute;
  right: 6px;
  width: 30px; height: 30px;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  color: var(--c-text-3);
  transition: background .15s, color .15s;
}
.pwd-eye:hover { background: var(--c-hover); color: var(--c-brand); }

.login-error {
  display: none;
  font-size: var(--fs-12);
  color: var(--c-danger);
  background: #fdecea;
  border-radius: 3px;
  padding: 7px 10px;
  line-height: 1.4;
}

.btn-lg { height: 44px; font-size: var(--fs-14); letter-spacing: 2px; }

.login-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-12);
  color: var(--c-text-3);
  line-height: 1.5;
}
.dot-inline {
  width: 5px; height: 5px; flex: 0 0 5px;
  border-radius: 50%;
  background: var(--c-success);
  display: inline-block;
}

.login-footer {
  position: relative;
  z-index: 1;
  font-size: var(--fs-12);
  color: var(--c-text-3);
  text-align: center;
}

/* ============================ 弹窗（后台） ============================ */

.modal-host { position: fixed; inset: 0; z-index: 150; }
.modal-host .modal-mask {
  position: absolute;
  inset: 0;
  /* 必须显式低于 .modal：两者是兄弟节点，若不写 z-index，
     部分浏览器会让带 animation 的 mask 盖在 modal 之上，
     导致点击弹窗内容实际命中遮罩 → 弹窗被关闭（表现为"点不动/一片黑"）。 */
  z-index: 1;
  background: rgba(0, 0, 0, .38);
  animation: mask-in .16s ease;
}
.modal-host .modal {
  position: absolute;
  left: 50%; top: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  width: 100%;
  max-width: 520px;
  background: var(--c-surface);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
  padding: 0;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-in .18s ease;
}

.modal-head {
  height: 56px;
  flex: 0 0 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px 0 20px;
  border-bottom: 1px solid var(--c-border);
}
.modal-head .modal-title { font-size: var(--fs-16); font-weight: 500; }

.modal-host .modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-foot {
  flex: 0 0 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 20px;
  background: #f9f9f9;
  border-top: 1px solid var(--c-border);
}

@keyframes mask-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { opacity: 0; transform: translate(-50%, -48%) scale(.98); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* 表单（弹窗 / 站点配置） */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-item { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-item > label { font-size: var(--fs-12); color: var(--c-text-2); }
.form-item .req { color: var(--c-danger); margin-left: 3px; }
.form-item .input, .form-item .select { height: 36px; border-color: #dddddd; border-radius: 3px; }
.form-note { font-size: var(--fs-12); color: var(--c-text-3); line-height: 1.5; }
.form-error { font-size: var(--fs-12); color: var(--c-danger); min-height: 16px; line-height: 1.4; }
.hint-inline { font-size: var(--fs-12); color: var(--c-text-3); font-weight: 400; }

/* 权限勾选盒 */
.perm-box {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 12px;
  padding: 12px;
  border: 1px solid var(--c-border);
  border-radius: 3px;
  background: #fafafa;
}
.perm-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: var(--fs-13);
  color: var(--c-text-1);
  cursor: pointer;
  padding: 3px 0;
}
.perm-item input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--c-brand); cursor: pointer; }

/* ============================ 数据统计 ============================ */

.stat-card.tone-brand { border-left-color: var(--c-brand); }
.stat-card.tone-blue { border-left-color: #4a6fa5; }
.stat-card.tone-green { border-left-color: var(--c-success); }
.stat-card.tone-orange { border-left-color: var(--c-warn); }
.stat-card.tone-plain { border-left-color: #bfbfbf; }
.stat-card-warn { border-left-color: var(--c-danger) !important; }

.stat-hint { font-size: var(--fs-12); color: var(--c-text-3); }
.stat-hint-warn { color: var(--c-danger); }
.stat-hint-ok { color: var(--c-success); }

.card-sub { font-size: var(--fs-12); color: var(--c-text-3); }

/* 中排：趋势图 + 环形图 */
.mid-row { display: grid; grid-template-columns: 1fr 320px; gap: 14px; align-items: stretch; }
.mid-row > .card { display: flex; flex-direction: column; }
.card-chart { min-width: 0; }
.card-side { min-width: 0; }

.spark-wrap { flex: 1; min-height: 200px; display: flex; align-items: center; }
.spark-svg { width: 100%; height: 240px; display: block; }

/* 环形图 */
.donut-wrap { flex: 1; display: flex; align-items: center; }
.donut-flex { display: flex; align-items: center; gap: 14px; width: 100%; }
.donut-svg { width: 132px; height: 132px; flex: 0 0 132px; }
.legend { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.legend-row { display: flex; align-items: center; gap: 6px; font-size: var(--fs-12); min-width: 0; }
.legend-row .dot { flex: 0 0 7px; margin-right: 0; }
.legend-name {
  flex: 1; min-width: 0;
  color: var(--c-text-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.legend-val { color: var(--c-text-3); font-variant-numeric: tabular-nums; flex: 0 0 auto; }

/* 下排：TOP5 + 高频物料 */
.down-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.card-half { min-width: 0; }

/* 供应商横条（带名次） */
.bar-rank {
  width: 20px; height: 20px; flex: 0 0 20px;
  border-radius: 4px;
  background: var(--c-tag-bg);
  color: var(--c-text-3);
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums;
}
.barrow:nth-child(1) .bar-rank { background: #e8f0ff; color: var(--c-brand); }
.barrow:nth-child(2) .bar-rank { background: #e8f5ee; color: var(--c-success); }
.barrow:nth-child(3) .bar-rank { background: var(--c-warn-bg); color: var(--c-warn); }

.barrow {
  display: flex;
  align-items: center;
  gap: 10px;
}
.bar-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.bar-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bar-name {
  font-size: var(--fs-12);
  color: var(--c-text-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bar-amt { font-size: var(--fs-12); color: var(--c-text-2); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.bar-track { height: 8px; border-radius: 4px; background: var(--c-divider); overflow: hidden; }
.bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #4a8cf7, var(--c-brand));
  transition: width .4s;
}

/* 高频物料迷你表 */
.mini-table { display: flex; flex-direction: column; }
.mini-head, .mini-row {
  display: grid;
  grid-template-columns: 1fr 68px 100px;
  align-items: center;
  gap: 8px;
}
.mini-head {
  font-size: var(--fs-12);
  color: var(--c-text-3);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--c-border);
}
.mini-head span:not(:first-child), .mini-num, .mini-amt { text-align: right; }
.mini-row {
  height: 40px;
  font-size: var(--fs-13);
  border-bottom: 1px solid var(--c-divider);
}
.mini-row:last-child { border-bottom: none; }
.mini-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-num { font-variant-numeric: tabular-nums; color: var(--c-text-2); }
.mini-amt { font-variant-numeric: tabular-nums; color: var(--c-text-2); }

.empty-inline { padding: 28px 0; text-align: center; color: var(--c-text-3); font-size: var(--fs-12); }

/* ============================ 站点信息 ============================ */

.site-row { display: grid; grid-template-columns: 1fr 380px; gap: 14px; align-items: start; }
.site-left { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.site-right { display: flex; flex-direction: column; gap: 12px; min-width: 0; position: sticky; top: 0; }
.site-left .card-title { margin-bottom: 14px; }

.preview-title { font-size: var(--fs-12); color: var(--c-text-3); }
.preview-bar {
  height: 28px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  background: #fbfbfb;
  border-bottom: 1px solid var(--c-border);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.pv-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.pv-url {
  margin-left: 8px;
  font-size: 11px;
  color: var(--c-text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.preview-box { padding: 0; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-sm); overflow: hidden; gap: 0; }
.preview-screen {
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 150px;
  background: linear-gradient(150deg, #eef3fb 0%, #f7f9fc 100%);
  text-align: center;
}
.pv-brand { font-size: var(--fs-16); font-weight: 600; color: var(--c-text-1); }
.preview-screen .pv-sub { font-size: var(--fs-12); color: var(--c-text-3); }
.preview-foot {
  padding: 10px 12px;
  font-size: var(--fs-12);
  color: var(--c-text-3);
  border-top: 1px solid var(--c-border);
  text-align: center;
}

.kv-list { display: flex; flex-direction: column; }
.kv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 38px;
  border-bottom: 1px solid var(--c-divider);
  font-size: var(--fs-13);
}
.kv:last-child { border-bottom: none; }
.kv > span { color: var(--c-text-3); font-size: var(--fs-12); }
.kv > b { font-weight: 500; color: var(--c-text-1); text-align: right; }

/* ============================ 员工管理 ============================ */

.acc-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.acc-stat {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-card);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.acc-stat-ico {
  width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--c-brand-light);
  color: var(--c-brand);
}
.acc-stat-ico.tone-blue { background: #eef4ff; color: #4a6fa5; }
.acc-stat-ico.tone-green { background: #e8f5ee; color: var(--c-success); }
.acc-stat-ico.tone-purple { background: #f1ecfd; color: #7f5bef; }
.acc-stat-ico.tone-plain { background: var(--c-tag-bg); color: var(--c-text-2); }
.acc-stat-ico.tone-orange { background: var(--c-warn-bg); color: var(--c-warn); }
.acc-stat-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.acc-stat-label { font-size: var(--fs-12); color: var(--c-text-3); }
.acc-stat-value { font-size: var(--fs-16); font-weight: 600; color: var(--c-text-1); font-variant-numeric: tabular-nums; }
.acc-stat-warn .acc-stat-ico { background: #fdecea; color: var(--c-danger); }

/* 工具条 */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--c-border);
  margin-bottom: 4px;
}
.spacer { flex: 1; min-width: 8px; }

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 1 260px;
  min-width: 160px;
}
.search-box > svg { position: absolute; left: 10px; color: var(--c-text-3); pointer-events: none; }
.search-box > input {
  width: 100%;
  height: 32px;
  padding: 0 10px 0 32px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  font-size: var(--fs-12);
  background: var(--c-surface);
  outline: none;
  transition: border-color .15s;
}
.search-box > input:focus { border-color: var(--c-brand); }
.search-box > input::placeholder { color: var(--c-text-4); }

.chip {
  height: 28px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text-2);
  font-size: var(--fs-12);
  white-space: nowrap;
  transition: all .15s;
}
.chip:hover { border-color: var(--c-brand); color: var(--c-brand); }
.chip-active {
  background: var(--c-brand-light);
  border-color: var(--c-brand);
  color: var(--c-brand);
  font-weight: 500;
}

.btn-ghost { background: var(--c-surface); color: var(--c-text-2); }

/* 表格内的用户单元格 */
.cell-user { display: flex; align-items: center; gap: 9px; min-width: 0; }
.ua-avatar {
  border-radius: 50%;
  color: #fff;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  line-height: 1;
  user-select: none;
}
.cell-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-dim { color: var(--c-text-3); font-size: var(--fs-12); font-variant-numeric: tabular-nums; }

/* 角色标签 */
.role-tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 3px;
  font-size: var(--fs-12);
  white-space: nowrap;
}
.role-super { background: #f1ecfd; color: #7f5bef; }
.role-mgr { background: #eef4ff; color: #4a6fa5; }
.role-buyer { background: var(--c-brand-light); color: var(--c-brand); }
.role-store { background: var(--c-warn-bg); color: var(--c-warn); }
.role-guest { background: var(--c-tag-bg); color: var(--c-text-2); }

/* 状态标签 */
.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-12);
  white-space: nowrap;
}
.status-tag::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-on { background: #e8f5ee; color: var(--c-success); }
.status-off { background: var(--c-tag-bg); color: var(--c-text-3); }

/* 文字链接按钮 */
.link {
  color: var(--c-brand);
  cursor: pointer;
  font-size: var(--fs-12);
  transition: opacity .15s;
}
.link:hover { opacity: .75; }
.link + .link { margin-left: 12px; }
.link-danger { color: var(--c-danger); }

.table-foot {
  padding-top: 12px;
  font-size: var(--fs-12);
  color: var(--c-text-3);
  text-align: right;
}

/* ============================ 空态（带图标） ============================ */

.empty-ico {
  display: flex;
  justify-content: center;
  color: var(--c-text-4);
  margin-bottom: 10px;
}
.empty-title { font-size: var(--fs-14); color: var(--c-text-2); margin-bottom: 5px; }
.empty-sub { font-size: var(--fs-12); color: var(--c-text-3); margin-bottom: 14px; }
.empty .btn { margin-top: 4px; }

/* ============================ 侧栏未登录态 ============================ */

.user-area-login { cursor: pointer; transition: background .15s; }
.user-area-login:hover { background: var(--c-hover); }
.avatar-guest {
  background: var(--c-tag-bg) !important;
  color: var(--c-text-3) !important;
}

/* ============================ OCR 状态提示 ============================ */

.notice-spacer { flex: 1; }

@media (max-width: 1024px) {
  .mid-row { grid-template-columns: 1fr; }
  .down-row { grid-template-columns: 1fr; }
  .site-row { grid-template-columns: 1fr; }
  .site-right { position: static; }
  .acc-stats { grid-template-columns: repeat(2, 1fr); }
  .donut-svg { width: 120px; height: 120px; flex-basis: 120px; }
  /* 价格页右栏内联写了 flex:0 0 340px，内联样式优先级高于类，
     必须用 !important 才能压过去 —— 否则手机上整块被挤出去 */
  .result-side { width: 100% !important; flex: 0 0 auto !important; }
}

@media (max-width: 768px) {
  .login-card { padding: 24px 20px 20px; max-width: 100%; }
  .login-wrap { padding: 24px 16px; }
  .form-row { grid-template-columns: 1fr; }
  .perm-box { grid-template-columns: 1fr; }
  .acc-stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .acc-stat { padding: 11px; gap: 9px; }
  .acc-stat-ico { width: 30px; height: 30px; flex-basis: 30px; }
  .acc-stat-value { font-size: var(--fs-14); }
  .modal-host .modal { max-width: 100%; }
  /* 首页/导入页弹窗内联写了 max-width:400/430px，小屏必须放开，否则横向溢出 */
  .modal { max-width: 100% !important; }
  .donut-flex { flex-direction: column; align-items: center; }
  .legend { width: 100%; }
  .search-box { flex: 1 1 100%; }
  .toolbar .spacer { display: none; }
  .toolbar .btn { flex: 1; }
  .spark-svg { height: 200px; }
  .preview-screen { min-height: 120px; padding: 18px 12px; }
}

@media (max-width: 420px) {
  .acc-stats { grid-template-columns: 1fr; }
  .mini-head, .mini-row { grid-template-columns: 1fr 52px 80px; }
}

/* ============================================================
   批量导入 · 步骤条与上传区
   ============================================================ */

.steps {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.step-no {
  width: 22px; height: 22px; flex: 0 0 22px;
  border-radius: 50%;
  background: var(--c-brand-light);
  color: var(--c-brand);
  font-size: var(--fs-12);
  font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums;
}
.step-text { font-size: var(--fs-13); color: var(--c-text-1); white-space: nowrap; }
.step-line {
  width: 32px; height: 1px; flex: 0 0 32px;
  background: var(--c-border);
}

.upload-main { font-size: var(--fs-13); color: var(--c-text-1); }
.upload-sub { font-size: var(--fs-12); color: var(--c-text-3); line-height: 1.5; }

@media (max-width: 768px) {
  .steps { gap: 8px; }
  .step-line { width: 18px; flex-basis: 18px; }
  .step-text { font-size: var(--fs-12); }
}

/* ============================================================
   响应式 · 平板（≤ 1180px）
   ============================================================ */
@media (max-width: 1180px) {
  .split-side { flex: 0 0 340px; width: 340px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .result-side { flex: 0 0 280px; width: 280px; }
}

/* ============================================================
   响应式 · 小屏平板 / 手机横屏（≤ 1024px）
   ============================================================ */
@media (max-width: 1024px) {
  .split { flex-direction: column; }
  .split-side, .split-side.wide-520 { width: 100%; flex: none; }
  .result-grid { flex-direction: column; }
  .result-main, .result-side { width: 100%; flex: none; }
  .admin-row { flex-direction: column; }
  .admin-row > .card { width: 100%; }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .preview-main { height: 340px; }
  .side-sticky { position: static; }
  .cat-card { width: 100%; flex: none; }
}

/* ============================================================
   响应式 · 手机（≤ 768px）—— 抽屉导航 + 单列
   ============================================================ */
@media (max-width: 768px) {
  :root {
    --topbar-h: 56px;
    --fs-26: 22px;
  }

  /* 侧边栏变抽屉 */
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    transition: transform .24s ease;
    box-shadow: var(--shadow-pop);
    width: 250px;
    flex-basis: 250px;
  }
  .sidebar.open { transform: translateX(0); }

  .menu-btn { display: flex; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-uname { display: none; }
  .topbar-title { font-size: var(--fs-14); }
  .tag-inner { display: none; }
  .topbar-right .icon-btn { display: none; }

  .content { padding: 10px; gap: 10px; }
  .card { padding: 12px; border-radius: 8px; }

  /* 搜索区竖排 */
  .search-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .btn-search { width: 100%; }
  .filter-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .date-range, .price-range { width: 100%; justify-content: space-between; }
  .date-range .input { width: 100%; flex: 1; }
  .price-range .input { width: 100%; flex: 1; }
  .filter-row .select { width: 100%; }
  .filter-row .btn-text { align-self: flex-end; }

  .metric-row { gap: 10px; }
  .metric-card { flex: 1 1 100%; padding: 12px; }
  .metric-name { font-size: var(--fs-12); }

  .form-grid, .form-grid.cols-2 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-value { font-size: var(--fs-20); }

  .card-head { flex-direction: column; align-items: stretch; }
  .card-actions { justify-content: flex-start; }

  .preview-main { height: 260px; }
  .preview-thumb { width: 60px; height: 60px; flex-basis: 60px; }

  .pagination { flex-direction: column; align-items: stretch; gap: 8px; }
  .pager { justify-content: center; }

  .barrow { grid-template-columns: 84px 1fr 72px; gap: 6px; }
  .barlabel, .barval { font-size: 11px; }

  .admin-head { flex-direction: column; }
  .tabs { padding: 4px; }
  .tab { padding: 0 12px; }

  .modal { padding: 16px; }
  .modal-mask { padding: 12px; }

  .upload-zone { padding: 16px 12px; }
  .upload-zone.lg { height: 180px; }

  .spark-inner { min-width: 560px; }

  .action-bar { flex-direction: column-reverse; }
  .action-bar .btn { width: 100%; }
}

/* ============================================================
   响应式 · 超小屏（≤ 420px）
   ============================================================ */
@media (max-width: 420px) {
  .stat-grid { grid-template-columns: 1fr; }
  .metric-value { font-size: var(--fs-20); }
  .table th, .table td { padding: 6px; }
  .table td { height: 44px; }
}

/* 触屏优化：去掉 tap 高亮 */
@media (hover: none) {
  .nav-item:hover, .btn:hover, .table tbody tr:hover { background: inherit; }
  .table tbody tr:hover { background: transparent; }
}

/* 打印 */
@media print {
  .sidebar, .topbar, .pagination, .card-actions { display: none !important; }
  .content { overflow: visible; padding: 0; }
  .app { height: auto; }
}

/* ============================================================
   分类管理 · 待人工归类清单
   ============================================================ */

.notice-ok { background: #e8f5ee; color: var(--c-text-1); }

.input-sm {
  height: 28px;
  padding: 0 10px;
  font-size: var(--fs-12);
}

#pending-card { margin-top: 16px; }

.pn-badge {
  font-size: var(--fs-12);
  color: var(--c-text-3);
  background: var(--c-hover);
  padding: 2px 8px;
  border-radius: 10px;
}

.pn-search { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pn-search .input { width: 200px; }

.pn-batch {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 1px dashed var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-hover);
  font-size: var(--fs-12);
  color: var(--c-text-3);
}
.pn-batch.on {
  border-style: solid;
  border-color: var(--c-brand);
  background: var(--c-brand-light);
  color: var(--c-text-1);
}
.pn-check {
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; white-space: nowrap;
}
.pn-sel b { color: var(--c-brand); }

.pn-table td { vertical-align: middle; }
.pn-name { font-size: var(--fs-13); color: var(--c-text-1); }
.pn-sub { font-size: var(--fs-12); color: var(--c-text-3); margin-top: 2px; }
.pn-spec { font-size: var(--fs-12); }

.pn-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding-top: 12px; font-size: var(--fs-12);
  flex-wrap: wrap;
}
.pn-pager { display: flex; gap: 8px; }

@media (max-width: 768px) {
  .pn-batch { flex-direction: column; align-items: stretch; }
  .pn-batch .select { width: 100%; }
  .pn-batch .btn { width: 100%; }
  .pn-search { width: 100%; }
  .pn-search .input { width: 100%; flex: 1 1 auto; }
  .pn-foot { flex-direction: column; align-items: stretch; }
  .pn-pager { justify-content: space-between; }
  .pn-pager .btn { flex: 1; }
}

/* ============================ 台账行内编辑 ============================ */

/* 可点击编辑的单元格：平时看着和普通文本一样，悬停才提示"这里能改" */
.cell-edit {
  display: inline-block;
  max-width: 100%;
  margin: -1px -4px;
  padding: 1px 4px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .12s, box-shadow .12s;
}
.cell-edit:hover {
  background: var(--c-brand-light);
  box-shadow: inset 0 0 0 1px rgba(0, 82, 217, .35);
}
.cell-edit:active { background: #e3f0ff; }
.cell-edit-block { display: block; width: 100%; }
/* 空值弱化显示，一眼看出哪几格还没补 */
.cell-edit-empty { color: var(--c-text-3); }

.row-actions { display: flex; align-items: center; gap: 2px; }
.row-actions .btn-text { font-size: var(--fs-12); padding: 0 4px; }

/* 编辑采购记录弹窗的表单栅格 */
.edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
}
.edit-grid .span-2 { grid-column: 1 / -1; }
.edit-grid textarea.input {
  height: auto;
  min-height: 58px;
  padding: 8px 10px;
  line-height: 1.5;
  font-family: inherit;
  resize: vertical;
}

@media (max-width: 768px) {
  .edit-grid { grid-template-columns: 1fr; }
  .edit-grid .span-2 { grid-column: auto; }
}
