/* ===== 基础 ===== */
:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --line: #e8ecf3;
  --line-soft: #f0f3f8;
  --text: #1f2937;
  --text-strong: #111827;
  --muted: #8a94a6;
  --muted-soft: #b6bfcd;
  --primary: #1f6feb;
  --primary-soft: #f2f7ff;
  --in: #15803d;
  --out: #e11d48;
  --stock: #1f6feb;
  --weight: #7c3aed;
  --warn: #b45309;
  --warn-bg: rgba(245, 158, 11, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; }

/* ===== 布局 ===== */
.app { display: flex; min-height: 100vh; align-items: flex-start; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--card);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 22px 16px 18px;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px 20px; }

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2b7cf6, #1f6feb);
  color: #fff;
  font-size: 19px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px rgba(31, 111, 235, 0.28);
  flex-shrink: 0;
}

.brand-title { font-size: 16px; font-weight: 700; color: var(--text-strong); letter-spacing: 0.5px; }
.brand-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; }

.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease;
}
.nav-item:hover { background: #f5f8fd; }
.nav-item.is-active { background: var(--primary-soft); }
.nav-item.is-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 3px;
  background: var(--primary);
}
.nav-label { display: block; font-size: 14px; font-weight: 600; color: #374151; }
.nav-item.is-active .nav-label { color: var(--primary); }
.nav-desc { display: block; font-size: 11px; color: var(--muted-soft); margin-top: 1px; }

.side-foot {
  margin-top: 14px;
  padding: 12px 12px;
  border-radius: 10px;
  background: #f7f9fc;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
}

.main {
  flex: 1;
  min-width: 0;
  padding: 22px 30px 40px;
  max-width: 1560px;
}

/* ===== 顶栏 ===== */
.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}
.topbar h1 { margin: 0; font-size: 22px; font-weight: 700; color: var(--text-strong); letter-spacing: 0.3px; }
.page-sub { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.sync { font-size: 12px; color: var(--muted-soft); }

/* ===== 概览统计 ===== */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 18px; }

.stat {
  background: var(--card);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 4px 16px rgba(17, 37, 68, 0.05);
  border: 1px solid transparent;
}
.stat-label { font-size: 12.5px; color: var(--muted); }
.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-strong);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.3px;
}
.stat-unit { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.stat--stock .stat-value { color: var(--stock); }
.stat--in .stat-value { color: var(--in); }
.stat--out .stat-value { color: var(--out); }
.stat--weight { background: linear-gradient(135deg, #fbf8ff, #f6f1ff); border-color: #ece2ff; }
.stat--weight .stat-value { color: var(--weight); font-size: 21px; }

.stats-loading {
  grid-column: 1 / -1;
  background: var(--card);
  border-radius: 14px;
  padding: 18px;
  color: var(--muted);
  font-size: 13.5px;
}
.stats-loading--error { color: var(--out); }

/* ===== 卡片 ===== */
.card {
  background: var(--card);
  border-radius: 16px;
  padding: 20px 22px 18px;
  box-shadow: 0 6px 22px rgba(17, 37, 68, 0.05);
  margin-bottom: 18px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.card-title { margin: 0; font-size: 15.5px; font-weight: 700; color: var(--text-strong); display: flex; align-items: center; }
.card-title::before {
  content: '';
  width: 3px;
  height: 15px;
  border-radius: 3px;
  background: var(--primary);
  margin-right: 9px;
}
.card-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ===== 控件 ===== */
.input {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  font-size: 13.5px;
  color: var(--text-strong);
  background: #fff;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
}
.input:focus { border-color: #9dc0fb; box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.1); }
.input:disabled { background: #f6f8fb; color: var(--muted-soft); cursor: not-allowed; }
.input--search { width: 230px; }
.input--date { width: 148px; }
.input--month { width: 138px; }
.input--year { width: 104px; }
.tilde { color: var(--muted-soft); font-size: 13px; }

/* 分段切换（月报 / 年报） */
.seg { display: inline-flex; background: #f2f5fa; border-radius: 8px; padding: 3px; gap: 2px; }
.seg-item {
  border: none;
  background: transparent;
  font: inherit;
  font-size: 12.5px;
  color: #5b6675;
  padding: 5px 15px;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s;
}
.seg-item:hover { color: var(--primary); }
.seg-item.is-active {
  background: #fff;
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(31, 111, 235, 0.18);
}

.btn {
  height: 34px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn--sm { height: 30px; padding: 0 12px; font-size: 12.5px; }
.btn--primary {
  background: linear-gradient(135deg, #2b7cf6, #1f6feb);
  color: #fff;
  box-shadow: 0 6px 14px rgba(31, 111, 235, 0.24);
}
.btn--primary:hover { filter: brightness(1.05); }
.btn--primary:disabled {
  background: #c3d3ea;
  box-shadow: none;
  cursor: not-allowed;
  filter: none;
}
.btn--ghost { background: #fff; color: var(--primary); border-color: #cddffb; }
.btn--ghost:hover { background: var(--primary-soft); }
.btn--danger { background: #fff; color: var(--out); border-color: #f7cdd7; }
.btn--danger:hover { background: #fff5f8; }

.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: #4b5563; cursor: pointer; }
.switch input { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }

/* ===== 汇总条 ===== */
.strip {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  background: var(--primary-soft);
  border-radius: 12px;
  padding: 12px 18px;
  margin-bottom: 14px;
}
.strip-item { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; color: #4b5563; }
.strip-item b { font-size: 16px; font-variant-numeric: tabular-nums; color: var(--text-strong); }
.strip-item em { font-style: normal; font-size: 12px; color: var(--muted); }
.strip--wide .strip-item { flex-direction: column; align-items: flex-start; gap: 2px; }
.strip--wide .strip-item b { font-size: 19px; }

.num-in { color: var(--in) !important; }
.num-out { color: var(--out) !important; }
.num-stock { color: var(--stock) !important; }
.num-weight { color: var(--weight) !important; }

/* ===== 表格 ===== */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl thead th {
  text-align: left;
  font-size: 12.5px;
  font-weight: 600;
  color: #6b7280;
  background: #f7f9fc;
  padding: 9px 14px;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.tbl thead th:first-child { border-radius: 8px 0 0 8px; }
.tbl thead th:last-child { border-radius: 0 8px 8px 0; }
.tbl tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
  color: #374151;
  vertical-align: middle;
}
.tbl tbody tr:hover td { background: #fafcff; }
.tbl tbody tr:last-child td { border-bottom: none; }

.th-num, .td-num { text-align: right; font-variant-numeric: tabular-nums; }
.th-act, .td-act { text-align: right; width: 76px; }
.td-strong { font-weight: 600; color: var(--text-strong); }
.td-remark {
  color: var(--muted);
  font-size: 12.5px;
  max-width: 260px;
  word-break: break-all;
  white-space: normal;
}
.dash { color: var(--muted-soft); }
.td-empty { text-align: center; color: var(--muted-soft); padding: 34px 0 !important; }

.row-total td {
  background: #f7f9fc !important;
  font-weight: 700;
  color: var(--text-strong);
  border-top: 1px solid var(--line);
}
.row-total td:first-child { border-radius: 0 0 0 8px; }
.row-total td:last-child { border-radius: 0 0 8px 0; }

.tag {
  display: inline-block;
  margin-left: 8px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 4px 7px;
  border-radius: 6px;
  vertical-align: middle;
}
.tag--warn { background: var(--warn-bg); color: var(--warn); }

.sub-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #4b5563;
  margin: 22px 0 10px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.sub-title .count { font-size: 12px; font-weight: 400; color: var(--muted); }
.sub-title:first-of-type { margin-top: 6px; }

.hint { font-size: 12px; color: var(--muted-soft); margin: 12px 0 0; }

.empty {
  text-align: center;
  color: var(--muted-soft);
  font-size: 13.5px;
  padding: 70px 20px;
  background: var(--card);
  border-radius: 16px;
}
.empty--error { color: var(--out); }
.empty--error .btn { margin-top: 14px; }

/* ===== 表单 ===== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; }
.form-grid--single { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field--full { grid-column: 1 / -1; }
.field label { font-size: 12.5px; color: #4b5563; font-weight: 500; }
.field .req { color: var(--out); margin-left: 2px; }
.field .input { height: 38px; width: 100%; }
.field-hint { margin: 0; font-size: 11.5px; color: var(--muted-soft); }
.field-hint--error { color: var(--out); }
.field--static { justify-content: flex-start; }
.static-value {
  height: 38px;
  line-height: 38px;
  padding: 0 11px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--weight);
  font-weight: 700;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.form-foot { display: flex; gap: 12px; margin-top: 22px; }
.form-foot .btn { height: 40px; padding: 0 26px; font-size: 14px; }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; align-items: start; }
.side-preview { position: sticky; top: 22px; }

.preview {
  background: linear-gradient(135deg, #fbf8ff, #f3edff);
  border: 1px solid #ece2ff;
  border-radius: 16px;
  padding: 22px 20px;
  text-align: center;
}
.preview-label { font-size: 12.5px; color: #6b7280; }
.preview-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--weight);
  margin-top: 10px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}
.preview-formula { font-size: 11.5px; color: var(--muted-soft); margin-top: 10px; line-height: 1.6; }

/* ===== 出库选批次 ===== */
.pick-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.pick-table-wrap { max-height: 62vh; overflow-y: auto; border-radius: 10px; }
.tbl--pick thead th { position: sticky; top: 0; z-index: 1; }
.row-pick { cursor: pointer; }
.row-pick.is-selected td { background: var(--primary-soft) !important; }

.picked {
  background: #f7f9fc;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
}
.picked--empty { color: var(--muted-soft); font-size: 12.5px; text-align: center; padding: 22px 16px; }
.picked-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  padding: 4px 0;
}
.picked-row span { color: var(--muted); }
.picked-row b { color: var(--text-strong); font-weight: 600; text-align: right; }

/* ===== 月报表 ===== */
.report-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.report-label { font-size: 16px; font-weight: 700; color: var(--text-strong); }
.report-time { font-size: 12px; color: var(--muted-soft); }

/* ===== 页脚 ===== */
.foot { text-align: center; font-size: 11.5px; color: var(--muted-soft); padding: 26px 0 6px; }

/* ===== 轻提示 ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translate(-50%, 16px);
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  font-size: 13.5px;
  padding: 11px 20px;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 99;
  max-width: 70vw;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }
.toast--error { background: rgba(190, 18, 60, 0.94); }

/* ===== 首页：快捷操作 ===== */
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.quick-item {
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; text-align: left; cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.quick-item:hover { border-color: #c7d7f5; box-shadow: 0 6px 16px rgba(31, 111, 235, 0.08); transform: translateY(-1px); }
.quick-title { font-size: 14px; font-weight: 700; color: var(--text-strong); }
.quick-desc { font-size: 12px; color: var(--muted); }

/* ===== 首页：最近动态 ===== */
.feed { display: flex; flex-direction: column; gap: 8px; }
.feed-item {
  display: flex; flex-direction: column; gap: 3px; width: 100%; text-align: left;
  padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: 10px;
  background: #fff; cursor: pointer;
}
.feed-item:hover { background: var(--primary-soft); border-color: #cfe0fb; }
.feed-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.feed-title { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; color: var(--text-strong); }
.feed-qty { font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.feed-qty--in { color: var(--in); }
.feed-qty--out { color: var(--out); }
.feed-spec { font-size: 12.5px; color: #4b5563; }
.feed-meta { font-size: 12px; color: var(--muted); }
.badge { display: inline-block; font-size: 11px; font-weight: 600; line-height: 1; padding: 4px 6px; border-radius: 6px; }
.badge--in { background: rgba(21, 128, 61, 0.1); color: var(--in); }
.badge--out { background: rgba(225, 29, 72, 0.1); color: var(--out); }

/* ===== 可点击表格行 ===== */
.row-click { cursor: pointer; }
.row-click:hover td { background: var(--primary-soft); }

/* ===== 悬浮新增按钮（仅手机端显示，见媒体查询） ===== */
.fab-wrap { display: none; }
.fab {
  width: 52px; height: 52px; border: none; border-radius: 50%;
  background: linear-gradient(135deg, #2b7cf6, #1f6feb); color: #fff;
  font-size: 26px; line-height: 1; cursor: pointer;
  box-shadow: 0 10px 22px rgba(31, 111, 235, 0.34);
}
.fab:active { transform: scale(0.96); }

/* ===== 详情弹窗 ===== */
.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-mask { position: absolute; inset: 0; background: rgba(17, 24, 39, 0.44); }
.modal-card {
  position: relative; width: 100%; max-width: 420px; max-height: 82vh; overflow: auto;
  background: #fff; border-radius: 16px; box-shadow: 0 24px 60px rgba(17, 24, 39, 0.24);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 10px; border-bottom: 1px solid var(--line-soft); }
.modal-head h3 { margin: 0; font-size: 16px; color: var(--text-strong); }
.modal-x { border: none; background: transparent; font-size: 16px; color: var(--muted); cursor: pointer; }
.modal-body { padding: 6px 18px 4px; }
.modal-row { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px dashed var(--line-soft); font-size: 13px; }
.modal-row span { flex-shrink: 0; color: var(--muted); }
.modal-row b { color: var(--text-strong); font-weight: 600; text-align: right; word-break: break-all; }
.modal-warn { margin: 10px 0 0; padding: 9px 11px; border-radius: 8px; background: var(--warn-bg); color: var(--warn); font-size: 12px; }
.modal-foot { display: flex; gap: 10px; padding: 14px 18px 16px; }
.modal-foot .btn { flex: 1; }
body.modal-open { overflow: hidden; }

/* ===== 自适应 ===== */
/* 表格横向滚动条（平时隐藏，手机上滑到才出现） */
.tbl-scroll { border-radius: 10px; }
.tbl-scroll .tbl { min-width: 720px; }
@media (hover: none) {
  .tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
.tbl-scroll::-webkit-scrollbar { height: 6px; }
.tbl-scroll::-webkit-scrollbar-thumb { background: #d7dee9; border-radius: 3px; }

@media (max-width: 1240px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .two-col, .pick-layout { grid-template-columns: 1fr; }
  .side-preview { position: static; }
}
@media (max-width: 900px) {
  .sidebar { width: 180px; padding: 18px 12px; }
  .main { padding: 18px 16px 30px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .input--search { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
}

/* ===== 手机 / 企业微信内置浏览器（H5） =====
   方案：把左侧竖排导航改成底部标签栏。
   只改布局顺序与尺寸，DOM 结构一个字不动（nav 仍是 #nav，按钮仍是 .nav-item），
   所以 app.js 的路由、高亮、事件绑定全部无需修改。 */
@media (max-width: 700px) {
  html, body { font-size: 15px; }

  /* 顶部让出一条给刘海/状态栏 */
  body {
    padding-top: env(safe-area-inset-top, 0px);
    -webkit-text-size-adjust: 100%;
  }

  .app { display: block; min-height: 100vh; }

  /* —— 侧栏 → 底部标签栏 —— */
  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    z-index: 50;
    width: auto;
    height: auto;
    padding: 0;
    border-right: none;
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 18px rgba(17, 37, 68, 0.07);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  /* 手机端不需要品牌区与说明区 */
  .brand, .side-foot { display: none; }

  .nav {
    flex-direction: row;
    gap: 0;
    flex: none;
    overflow: hidden;
    padding: 0 2px;
  }

  /* 手机上只保留 5 个主标签（首页/入库/出库/库存/报表），与小程序 tabBar 一致；
     新增入库、新增出库、日期查询改由页内按钮与首页快捷入口进入 */
  .nav-item:not(.is-tab) { display: none; }

  .nav-item {
    flex: 1 1 0;
    min-width: 0;
    border-radius: 0;
    padding: 9px 2px 10px;
    text-align: center;
  }
  .nav-item:hover { background: transparent; }
  .nav-item.is-active { background: transparent; }
  /* 原选中态是左侧竖条，手机上改成顶部横条 */
  .nav-item.is-active::before {
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    width: 22px;
    height: 3px;
  }
  .nav-label { font-size: 12px; font-weight: 500; line-height: 1.3; }
  .nav-item.is-active .nav-label { font-weight: 700; }
  .nav-desc { display: none; }

  /* —— 主区域 —— */
  .main {
    padding: 14px 12px calc(76px + env(safe-area-inset-bottom, 0px));
    max-width: none;
  }

  .topbar {
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
  }
  .topbar h1 { font-size: 20px; }
  .page-sub { font-size: 12.5px; }
  .topbar-right { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
  .sync { width: 100%; text-align: right; font-size: 11.5px; }

  /* —— 统计卡：两列，字号收小；只在首页显示，其余页把空间让给内容 —— */
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
  body:not([data-route='home']) .stats { display: none; }
  .stat { padding: 12px 13px; border-radius: 12px; }
  .stat-label { font-size: 12px; }
  .stat-value { font-size: 20px; margin-top: 4px; }
  .stat--weight .stat-value { font-size: 18px; }

  /* —— 卡片 —— */
  .card { padding: 14px 13px; border-radius: 14px; margin-bottom: 14px; }
  .card-head { margin-bottom: 12px; gap: 10px; }
  .card-title { font-size: 15px; }
  .card-tools { width: 100%; gap: 8px; }

  /* 表单控件放大到可点的大小（≥40px，iOS 也能避免自动缩放） */
  .input { height: 38px; font-size: 15px; }
  .input--search,
  .input--date,
  .input--month,
  .input--year { width: 100%; }
  .field .input { height: 42px; }
  .form-grid { gap: 12px; }
  .form-foot { margin-top: 18px; }
  .form-foot .btn { flex: 1; padding: 0 12px; }

  .btn { height: 38px; font-size: 14px; padding: 0 14px; }
  .btn--sm { height: 34px; font-size: 13px; }

  .seg { width: 100%; }
  .seg-item { flex: 1; text-align: center; }

  .strip { gap: 12px 20px; padding: 12px 14px; }

  /* —— 表格横向滚动（8 列在手机上不可能挤下） —— */
  .card table.tbl,
  .pick-table-wrap { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl { font-size: 13px; min-width: 620px; }
  .tbl thead th,
  .tbl tbody td { padding: 9px 10px; }
  .td-remark { max-width: 150px; }
  .pick-table-wrap { max-height: none; }

  .two-col,
  .pick-layout { grid-template-columns: 1fr; gap: 12px; }
  .side-preview,
  .picked { position: static; }
  .picked { margin-bottom: 14px; }

  .empty { padding: 48px 16px; }

  .toast {
    left: 12px;
    right: 12px;
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    transform: translateY(12px);
    max-width: none;
    text-align: center;
    font-size: 14px;
  }
  .toast.is-show { transform: translateY(0); }

  /* —— 企业微信环境提示 —— */
  .wecom-tip {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 12px;
    padding: 10px 13px;
    margin-bottom: 14px;
    font-size: 12.5px;
    color: #92400e;
  }
  .wecom-tip[hidden] { display: none; }
  .wecom-tip summary { cursor: pointer; font-weight: 600; }
  .wecom-tip p { margin: 8px 0 4px; }
  .wecom-tip ul { margin: 6px 0 0; padding-left: 18px; line-height: 1.7; }

  /* —— 首页：快捷入口两列，最近动态整行可点 —— */
  .quick-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .quick-item { padding: 14px 13px; }
  .quick-title { font-size: 14.5px; }
  .feed-item { padding: 11px 12px; }

  /* —— 悬浮新增按钮：贴在底部标签栏上方，拇指可及 —— */
  .fab-wrap {
    display: block;
    position: fixed;
    right: 16px;
    bottom: calc(74px + env(safe-area-inset-bottom, 0px));
    z-index: 60;
  }

  /* —— 弹窗贴底显示，接近原生操作表 —— */
  .modal { align-items: flex-end; padding: 0; }
  .modal-card { max-width: none; border-radius: 16px 16px 0 0; max-height: 86vh; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .modal-foot .btn { height: 42px; }
}

/* 电脑端不显示这条提示（它只在窄屏有意义） */
@media (min-width: 701px) {
  .wecom-tip { display: none; }
}

/* ===== 账号与权限 ===== */

/* 顶栏「当前账号」按钮 */
.who {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text);
}
.who:hover { background: var(--primary-soft); border-color: #cddffb; }
.who-name { font-weight: 600; color: var(--text-strong); }
.who-role {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--line-soft);
  color: var(--muted);
}
.who-role--admin { background: #eef3ff; color: #1f4fd8; }
.who-role--editor { background: #edfaf1; color: var(--in); }
.who-role--viewer { background: #f5f6f9; color: var(--muted); }

/* 角色标签 */
.role-tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--line-soft);
  color: var(--muted);
}
.role-tag--admin { background: #eef3ff; color: #1f4fd8; }
.role-tag--editor { background: #edfaf1; color: var(--in); }
.role-tag--viewer { background: #f2f3f6; color: #6b7280; }
.role-tag--xs { font-size: 10.5px; padding: 0 5px; margin-left: 6px; }

/* 操作日志的动作标签 */
.audit-tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  background: var(--line-soft);
  color: var(--muted);
  white-space: nowrap;
}
.audit-tag--in { background: #edfaf1; color: var(--in); }
.audit-tag--out { background: #fff1f4; color: var(--out); }
.audit-tag--danger { background: #fff1f4; color: var(--out); }
.audit-tag--admin { background: #eef3ff; color: #1f4fd8; }

/* 只读账号的提示条 */
.readonly-tip {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #f7f9fd;
  border: 1px solid #e3ecfb;
  color: #4b5563;
  font-size: 12.5px;
  line-height: 1.6;
}
.readonly-tip b { color: #1f4fd8; }

/* 表格里的小状态点 */
.ok-dot,
.off-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.ok-dot { background: #22c55e; }
.off-dot { background: #cbd5e1; }
.row-off td { opacity: 0.55; }

.tag--self { background: #eef3ff; color: #1f4fd8; margin-left: 6px; }
.td-muted { color: var(--muted); }
.td-nowrap,
.th-nowrap { white-space: nowrap; }
.muted-note { font-size: 12px; color: var(--muted-soft); }

/* 弹窗里的表单 */
.modal-card--form { width: 100%; max-width: 460px; }
.modal-field { display: block; padding: 10px 0 0; }
.modal-field > span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.modal-field .input { width: 100%; height: 38px; }
.modal-field select.input { height: 38px; background: #fff; }
.input-row { display: flex; gap: 8px; align-items: center; }
.input-row .input { flex: 1; min-width: 0; }
.modal-hint { margin: 12px 0 0; padding: 9px 11px; border-radius: 8px; background: #f7f9fd; color: #4b5563; font-size: 12px; line-height: 1.6; }

/* ===== 登录层 ===== */
body.is-login { overflow: hidden; }
body.is-login .app,
body.is-login .fab-wrap,
body.is-login .wecom-tip { visibility: hidden; }

.login {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(160deg, #eef4ff 0%, #f7f9fc 45%, #f4f6fa 100%);
}
.login[hidden] { display: none; }
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 26px 24px 22px;
  box-shadow: 0 12px 40px rgba(31, 45, 78, 0.09);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.login-brand-text h1 { margin: 0; font-size: 17px; color: var(--text-strong); letter-spacing: 0.2px; }
.login-brand-text p { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }
.login-field { display: block; margin-bottom: 14px; }
.login-field > span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.login-field .input { width: 100%; height: 42px; font-size: 15px; }
.login-btn { width: 100%; height: 44px; font-size: 15px; margin-top: 4px; }
.login-err {
  margin: 0 0 12px;
  padding: 9px 11px;
  border-radius: 8px;
  background: #fff1f4;
  color: var(--out);
  font-size: 12.5px;
}
.login-err[hidden] { display: none; }
.login-foot { margin: 14px 0 0; font-size: 11.5px; color: var(--muted-soft); line-height: 1.65; text-align: center; }

@media (max-width: 700px) {
  .who { height: 34px; padding: 0 8px; }
  .who-role { display: none; }
  .login-card { padding: 22px 18px 18px; }
  .modal-field .input { height: 42px; font-size: 15px; }
  .readonly-tip { font-size: 12px; padding: 9px 12px; }
}

/* ===== 企业微信免密登录 ===== */
.login-wecom { margin-bottom: 16px; }
.login-wecom[hidden] { display: none; }
.login-wecom-btn {
  width: 100%;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #07c160;
  border-radius: 8px;
  background: #07c160;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}
.login-wecom-btn:hover { background: #06ad56; border-color: #06ad56; }
.wecom-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.22);
  font-size: 11px;
}
.login-wecom-hint {
  margin: 8px 0 0;
  font-size: 11.5px;
  color: var(--muted-soft);
  text-align: center;
}
.login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 4px;
  color: var(--muted-soft);
  font-size: 11.5px;
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ===== 管理员密码二次验证 ===== */
.verify-box { padding: 4px 2px 6px; }
.verify-desc { margin: 0 0 8px; font-size: 13px; line-height: 1.75; color: var(--text); }
.verify-desc b { color: var(--text-strong); }
.verify-desc--sub { margin-bottom: 16px; font-size: 12.5px; color: var(--muted); }
.verify-form { display: flex; gap: 10px; align-items: center; max-width: 460px; }
.verify-form .input { flex: 1; height: 40px; }
.verify-form .btn { height: 40px; white-space: nowrap; }
.verify-msg { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }
.verify-msg.is-error { color: var(--out); }
.verify-msg[hidden] { display: none; }

@media (max-width: 700px) {
  .verify-form { flex-direction: column; align-items: stretch; max-width: none; }
  .verify-form .input,
  .verify-form .btn { height: 42px; width: 100%; }
}

/* ===== 企业微信免密登录设置卡 ===== */
.wx-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 6px 0 0;
}
.wx-field { display: block; min-width: 0; }
.wx-field > span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.wx-field .input { width: 100%; height: 36px; }
.wx-row { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; margin: 14px 0 0; }
.wx-check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text); cursor: pointer; }
.wx-check input { width: 15px; height: 15px; accent-color: #1f6feb; }
.wx-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.wx-inline .input { height: 32px; width: auto; min-width: 96px; background: #fff; }
.wx-cb { margin: 12px 0 0; font-size: 12px; color: var(--muted); word-break: break-all; }
.wx-cb code { background: #f4f6fa; padding: 2px 6px; border-radius: 5px; font-size: 11.5px; color: var(--text-strong); }
.wx-foot { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.wx-msg { font-size: 12.5px; color: var(--muted); }
.wx-msg.is-ok { color: #12813f; }
.wx-msg.is-error { color: var(--out); }
.wx-msg[hidden] { display: none; }

@media (max-width: 700px) {
  .wx-grid { grid-template-columns: 1fr; }
  .wx-field .input { height: 42px; font-size: 15px; }
  .wx-row { gap: 12px; }
  .wx-foot .btn { flex: 1 1 auto; height: 40px; }
}
