/* ============================================================
   西藏技师学院 · 化学药品出入库管理系统
   视觉方向：实验室化学品标签风格
   深青墨导航 + 青绿主色 + 琥珀强调 + 六边形分子签名元素
   ============================================================ */

/* ---------- 1. 设计令牌 ---------- */
:root {
  --bg: #F2F5F7;
  --surface: #FFFFFF;
  --surface-2: #F7FAFB;
  --border: #E3E9EE;
  --border-strong: #CBD8DF;

  --nav-bg: #0F2830;
  --nav-bg-2: #163A44;
  --nav-text: #9FB8C1;
  --nav-text-active: #FFFFFF;
  --nav-active: rgba(14, 124, 123, .22);

  --primary: #0E7C7B;
  --primary-hover: #0A6463;
  --primary-soft: #E1F1F0;
  --primary-line: #B9DEDC;

  --accent: #E9A23B;
  --accent-soft: #FBF0DC;

  --text: #17262E;
  --text-2: #42555F;
  --muted: #7A8B94;

  --danger: #D94F4F;
  --danger-soft: #FBE9E9;
  --warning: #E08A1E;
  --warning-soft: #FCF0DD;
  --success: #2E9E6B;
  --success-soft: #E4F4EC;
  --info: #3E7FB8;
  --info-soft: #E6EFF7;
  --gray: #7A8B94;
  --gray-soft: #EFF2F4;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 40, 48, .05), 0 10px 28px rgba(15, 40, 48, .07);
  --shadow-sm: 0 1px 2px rgba(15, 40, 48, .06);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --sidebar-w: 236px;
  --tabbar-h: 62px;
  --topbar-h: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(14,124,123,.18); }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

.btn, .nav-item, .tab, .mc-more { text-decoration: none; }

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

.num { font-variant-numeric: tabular-nums; letter-spacing: .01em; }

/* 六边形网格底纹（签名元素） */
.hex-pattern {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='62' height='108' viewBox='0 0 62 108'%3E%3Cpath d='M31 4l27 15.6v31L31 66 4 50.6v-31zM31 60l27 15.6v31L31 122 4 106.6v-31z' fill='none' stroke='%230E7C7B' stroke-opacity='.08' stroke-width='1.4'/%3E%3C/svg%3E");
  background-size: 62px 108px;
}

/* ---------- 2. 应用骨架 ---------- */
.app { min-height: 100vh; }

/* ---------- 3. 侧栏（PC） ---------- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--nav-bg);
  display: flex;
  flex-direction: column;
  z-index: 40;
  color: var(--nav-text);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.brand .logo-hex {
  width: 42px; height: 42px;
  flex: none;
  color: #7FD1C6;
  filter: drop-shadow(0 0 10px rgba(14,124,123,.35));
}

.brand .brand-name {
  color: #FFFFFF;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.3;
}

.brand .brand-sub {
  font-size: 11.5px;
  color: #7FA2AD;
  margin-top: 3px;
  letter-spacing: .06em;
}

.side-nav { flex: 1; padding: 14px 12px; overflow-y: auto; }

.side-nav .nav-sec {
  font-size: 11px;
  letter-spacing: .14em;
  color: #5E828D;
  padding: 14px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 9px;
  color: var(--nav-text);
  font-size: 14px;
  background: none;
  border: 0;
  text-align: left;
  position: relative;
  transition: background .15s, color .15s;
  margin-bottom: 2px;
}

.nav-item .ic { width: 19px; height: 19px; flex: none; opacity: .9; }

.nav-item:hover { background: rgba(255,255,255,.06); color: #E8F1F3; }

.nav-item.active {
  background: var(--nav-active);
  color: var(--nav-text-active);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -12px; top: 50%;
  width: 7px; height: 14px;
  transform: translateY(-50%);
  background: var(--accent);
  clip-path: polygon(100% 0, 100% 100%, 0 50%);
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #2A200B;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  border-radius: 999px;
  padding: 0 6px;
}

.side-foot {
  padding: 14px 20px;
  font-size: 11.5px;
  color: #5E828D;
  border-top: 1px solid rgba(255,255,255,.08);
  letter-spacing: .03em;
}

/* ---------- 4. 主区 / 顶栏 ---------- */
.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 26px;
  background: rgba(242, 245, 247, .86);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.page-title h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .01em;
}

.page-title p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.top-actions { display: flex; align-items: center; gap: 10px; }

/* 用户角标（微信授权登录模拟） */
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}

.user-chip .wx-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-chip .wx-avatar .ic { width: 17px; height: 17px; }

.user-chip .uc-name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.user-chip .uc-sub { font-size: 11px; color: var(--muted); }
.user-chip .uc-caret { color: var(--muted); width: 14px; height: 14px; }

.menu-wrap { position: relative; }

.dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 60;
}

.dropdown .dd-title {
  font-size: 11px;
  color: var(--muted);
  padding: 6px 10px 4px;
  letter-spacing: .06em;
}

.dropdown .dd-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  background: none;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  text-align: left;
}

.dropdown .dd-item:hover { background: var(--surface-2); }
.dropdown .dd-item .ic { width: 16px; height: 16px; color: var(--muted); }
.dropdown .dd-item.on { color: var(--primary); font-weight: 600; }
.dropdown .dd-item.on .ic { color: var(--primary); }
.dropdown .dd-sep { height: 1px; background: var(--border); margin: 5px 4px; }

/* ---------- 5. 内容区 / 通用组件 ---------- */
.content { flex: 1; padding: 24px 26px 48px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
}

.card-head h3 {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 9px;
}

.card-head h3 .hex-dot {
  width: 12px; height: 12px;
  background: var(--primary);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  flex: none;
}

.card-head .card-sub { font-size: 12px; color: var(--muted); }
.card-body { padding: 18px 20px; }

/* KPI 卡片 */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(218px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.kpi {
  position: relative;
  padding: 18px 20px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}

.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.kpi .kpi-label {
  font-size: 13px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.kpi .kpi-label .ic { width: 17px; height: 17px; color: var(--muted); }

.kpi .kpi-value {
  font-size: 30px;
  font-weight: 700;
  margin-top: 10px;
  line-height: 1.1;
}

.kpi .kpi-value .unit { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 4px; }

.kpi .kpi-foot {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

.kpi .kpi-corner {
  position: absolute;
  right: -16px; top: -16px;
  width: 74px; height: 74px;
  opacity: .07;
  color: var(--primary);
}

.kpi.kpi-warn .kpi-corner { color: var(--danger); }

/* 图表网格 */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.chart { width: 100%; min-height: 320px; }

.chart-card.span2 { grid-column: span 2; }

.btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

/* 仪表盘 hero 条 */
.hero-strip {
  position: relative;
  border-radius: var(--radius);
  padding: 2px;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
}

.hero-strip .hs-inner {
  position: relative;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.hero-strip .hs-title { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.hero-strip .hs-title .hex-dot { width: 14px; height: 14px; background: var(--accent); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.hero-strip .hs-text { font-size: 13px; color: var(--text-2); }

/* 徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge .ic { width: 12px; height: 12px; }

.badge.b-success { background: var(--success-soft); color: #1E7A50; }
.badge.b-warning { background: var(--warning-soft); color: #B26A0E; }
.badge.b-danger  { background: var(--danger-soft); color: #B93A3A; }
.badge.b-info    { background: var(--info-soft); color: #2F6391; }
.badge.b-gray    { background: var(--gray-soft); color: #5C6D77; }
.badge.b-teal    { background: var(--primary-soft); color: var(--primary); }
.badge.b-accent  { background: var(--accent-soft); color: #A96F12; }

/* 化学品编号 / 单号 chip */
.code-chip {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid var(--primary-line);
  border-radius: 6px;
  padding: 2px 7px;
  white-space: nowrap;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 16px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
}

.btn .ic { width: 16px; height: 16px; }

.btn:hover { border-color: var(--primary); color: var(--primary); }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #FFFFFF; box-shadow: 0 4px 12px rgba(14,124,123,.28); }

.btn-danger { background: var(--danger); border-color: var(--danger); color: #FFF; }
.btn-danger:hover { background: #C43F3F; border-color: #C43F3F; color: #FFF; }

.btn-soft { background: var(--primary-soft); border-color: var(--primary-soft); color: var(--primary); }
.btn-soft:hover { background: #D3ECEA; color: var(--primary); }

.btn-ghost { background: none; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }

.btn-sm { height: 30px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn-sm .ic { width: 14px; height: 14px; }
.btn-xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 7px; }

.btn-icon {
  width: 34px; height: 34px;
  padding: 0;
  border-radius: 9px;
}
.btn-icon .ic { width: 17px; height: 17px; }

.btn-block { width: 100%; }

/* 工具栏 */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.toolbar .grow { flex: 1; }

.search-box {
  position: relative;
  min-width: 240px;
  flex: 1;
  max-width: 340px;
}

.search-box .ic {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--muted);
  pointer-events: none;
}

.search-box .input { padding-left: 36px; width: 100%; }

/* 表单 */
.input, .select, .textarea {
  height: 38px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 0 12px;
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.textarea { height: auto; min-height: 76px; padding: 9px 12px; resize: vertical; }

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14,124,123,.12);
}

.input::placeholder, .textarea::placeholder { color: #A6B4BC; }

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }

.field .label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}

.field .label .req { color: var(--danger); margin-left: 2px; }

.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

.fx-edit { display: flex; gap: 10px; }
.fx-edit .fx-chem { flex: 1; }
.fx-edit .fx-qty { width: 130px; flex: none; }

/* 表格 */
.table-wrap { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
  letter-spacing: .02em;
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }

.table .t-main { font-weight: 600; }
.table .t-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.table .t-actions { display: flex; gap: 6px; align-items: center; }

/* 库存条 */
.stock-cell { display: flex; align-items: center; gap: 10px; min-width: 120px; }

.stock-bar {
  flex: 1;
  max-width: 90px;
  height: 6px;
  border-radius: 999px;
  background: var(--gray-soft);
  overflow: hidden;
}

.stock-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--success);
}

.stock-bar i.mid { background: var(--warning); }
.stock-bar i.low { background: var(--danger); }

.stock-num { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stock-num small { font-weight: 500; color: var(--muted); font-size: 12px; }

/* 分页 */
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-2);
}

.pager .btn { min-width: 34px; padding: 0 10px; }
.pager .pager-info { margin: 0 6px; }

/* 空状态 */
.empty {
  padding: 52px 20px;
  text-align: center;
  color: var(--muted);
}

.empty .empty-hex {
  width: 56px; height: 56px;
  margin: 0 auto 14px;
  border: 1.6px dashed var(--border-strong);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  color: #B3C1C9;
}

.empty .empty-hex .ic { width: 24px; height: 24px; }
.empty .empty-title { font-size: 14px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.empty .empty-sub { font-size: 12.5px; margin-bottom: 16px; }

/* 列表（移动端 / 动态流） */
.list { display: flex; flex-direction: column; }

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
}

.list-item:hover { background: var(--surface-2); }
.list-item:last-child { border-bottom: 0; }

.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 8px; }
.list-item .li-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.list-item .li-right { text-align: right; flex: none; }
.list-item .li-right .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.list-item .li-right .s { font-size: 11.5px; color: var(--muted); }

/* 类型分布统计行 */
.stat-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; }
.stat-row .sr-name { width: 96px; flex: none; font-size: 13px; color: var(--text-2); }
.stat-row .sr-bar { flex: 1; height: 8px; border-radius: 999px; background: var(--gray-soft); overflow: hidden; }
.stat-row .sr-bar i { display: block; height: 100%; border-radius: 999px; }
.stat-row .sr-num { width: 52px; flex: none; text-align: right; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* 动态流时间轴 */
.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 12px; padding: 11px 0; }
.feed-item .fd-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  flex: none;
  border: 2.5px solid var(--primary-soft);
  background: var(--primary);
}
.feed-item .fd-main { flex: 1; min-width: 0; }
.feed-item .fd-title { font-size: 13.5px; }
.feed-item .fd-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.feed-item .fd-time { font-size: 11.5px; color: #A6B4BC; flex: none; padding-top: 3px; }

/* 预警卡列表 */
.warn-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px dashed var(--border);
}
.warn-item:last-child { border-bottom: 0; }
.warn-item .w-name { flex: 1; min-width: 0; }
.warn-item .w-name .n { font-weight: 600; font-size: 13.5px; }
.warn-item .w-name .s { font-size: 12px; color: var(--muted); }
.warn-item .w-num { font-variant-numeric: tabular-nums; font-weight: 700; }
.warn-item .w-num small { color: var(--muted); font-weight: 500; }

/* ---------- 6. 弹窗 / 抽屉 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(10, 24, 30, .5);
  backdrop-filter: blur(3px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: var(--surface);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(10, 24, 30, .24);
  animation: modal-in .18s ease-out;
}

.modal-lg { max-width: 720px; }

@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
}

.modal-head h3 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.modal-head h3 .hex-dot { width: 12px; height: 12px; background: var(--primary); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }

.modal-body { padding: 20px 22px; overflow-y: auto; }

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 16px 16px;
}

/* 详情信息网格 */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.info-grid .ig-item { padding: 10px 12px; background: var(--surface-2); border-radius: 9px; }
.info-grid .ig-label { font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
.info-grid .ig-value { font-size: 13.5px; font-weight: 600; word-break: break-all; }
.info-grid .ig-wide { grid-column: 1 / -1; }

/* 二维码展示 */
.qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
}
.qr-box svg { width: 148px; height: 148px; }
.qr-box .qr-code { font-family: var(--mono); font-size: 12.5px; color: var(--primary); font-weight: 600; }

/* ---------- 7. Toast ---------- */
.toast-root {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  background: #17262E;
  color: #FFF;
  font-size: 13.5px;
  padding: 11px 16px;
  border-radius: 11px;
  box-shadow: 0 12px 32px rgba(10, 24, 30, .3);
  animation: toast-in .2s ease-out;
  max-width: 360px;
}

.toast .ic { width: 17px; height: 17px; flex: none; }
.toast.t-ok .ic { color: #6FD3A5; }
.toast.t-err .ic { color: #F08A8A; }
.toast.t-warn .ic { color: #F2BE72; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 8. 扫码 ---------- */
.scan-mask {
  position: fixed;
  inset: 0;
  background: rgba(7, 17, 22, .94);
  z-index: 110;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.scan-stage { width: 100%; max-width: 380px; text-align: center; }

.scan-view {
  position: relative;
  width: 260px;
  height: 260px;
  margin: 0 auto;
  border-radius: 16px;
  overflow: hidden;
  background:
    linear-gradient(rgba(20, 62, 72, .6), rgba(20, 62, 72, .6)),
    radial-gradient(circle at 30% 30%, rgba(127, 209, 198, .18), transparent 60%),
    radial-gradient(circle at 70% 70%, rgba(233, 162, 59, .12), transparent 55%);
}

.scan-view::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(127,209,198,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(127,209,198,.07) 1px, transparent 1px);
  background-size: 26px 26px;
}

.scan-corners { position: absolute; inset: 0; }

.scan-corners i {
  position: absolute;
  width: 34px; height: 34px;
  border: 3px solid #7FD1C6;
  border-radius: 5px;
}
.scan-corners i:nth-child(1) { left: 14px; top: 14px; border-right: 0; border-bottom: 0; border-radius: 9px 0 0 0; }
.scan-corners i:nth-child(2) { right: 14px; top: 14px; border-left: 0; border-bottom: 0; border-radius: 0 9px 0 0; }
.scan-corners i:nth-child(3) { left: 14px; bottom: 14px; border-right: 0; border-top: 0; border-radius: 0 0 0 9px; }
.scan-corners i:nth-child(4) { right: 14px; bottom: 14px; border-left: 0; border-top: 0; border-radius: 0 0 9px 0; }

.scan-line {
  position: absolute;
  left: 22px; right: 22px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #7FD1C6, transparent);
  box-shadow: 0 0 12px rgba(127, 209, 198, .8);
  animation: scan-sweep 2.2s ease-in-out infinite;
}

@keyframes scan-sweep {
  0% { top: 26px; opacity: .35; }
  50% { top: calc(100% - 28px); opacity: 1; }
  100% { top: 26px; opacity: .35; }
}

.scan-tip { color: #B9D3DA; font-size: 14px; margin-top: 20px; letter-spacing: .05em; }
.scan-tip b { color: #7FD1C6; }

.scan-fields { margin-top: 20px; display: flex; gap: 8px; }
.scan-fields .input { flex: 1; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.2); color: #FFF; }
.scan-fields .input::placeholder { color: #6E8A93; }
.scan-fields .input:focus { border-color: #7FD1C6; box-shadow: 0 0 0 3px rgba(127,209,198,.16); }

.scan-actions { margin-top: 14px; display: flex; justify-content: center; gap: 10px; }
.scan-actions .btn { border-color: rgba(255,255,255,.22); background: rgba(255,255,255,.06); color: #E4F1F3; }
.scan-actions .btn:hover { border-color: #7FD1C6; color: #7FD1C6; }
.scan-actions .btn-primary { background: var(--primary); border-color: var(--primary); color: #FFF; }
.scan-actions .btn-primary:hover { color: #FFF; }

/* ---------- 9. 移动端底部导航 ---------- */
.tabbar {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 50;
}

.tabbar .tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 11px;
  position: relative;
  min-height: 44px;
}

.tabbar .tab .ic { width: 21px; height: 21px; }

.tabbar .tab.active { color: var(--primary); font-weight: 600; }

.tabbar .tab .tab-badge {
  position: absolute;
  top: 6px;
  left: 50%;
  margin-left: 8px;
  min-width: 17px;
  height: 17px;
  line-height: 17px;
  padding: 0 5px;
  background: var(--danger);
  color: #FFF;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 999px;
  text-align: center;
}

/* 移动端首页 */
.m-hero {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  padding: 20px;
  color: #FFFFFF;
  background: var(--nav-bg);
}

.m-hero::after {
  content: "";
  position: absolute;
  right: -34px; top: -34px;
  width: 130px; height: 130px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='62' height='108' viewBox='0 0 62 108'%3E%3Cpath d='M31 4l27 15.6v31L31 66 4 50.6v-31zM31 60l27 15.6v31L31 122 4 106.6v-31z' fill='none' stroke='%237FD1C6' stroke-opacity='.28' stroke-width='1.6'/%3E%3C/svg%3E");
  background-size: 62px 108px;
}

.m-hero .mh-label { font-size: 13px; color: #9FB8C1; display: flex; align-items: center; gap: 7px; }
.m-hero .mh-label .ic { width: 15px; height: 15px; }

.m-hero .mh-value { font-size: 42px; font-weight: 800; margin-top: 6px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.m-hero .mh-value small { font-size: 14px; font-weight: 500; color: #9FB8C1; margin-left: 5px; }

.m-hero .mh-foot { margin-top: 12px; display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #BFD5DB; }
.m-hero .mh-foot .btn { border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.1); color: #FFF; height: 30px; }
.m-hero .mh-foot .btn:hover { border-color: #7FD1C6; color: #7FD1C6; }

.m-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.m-stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 8px; text-align: center; }
.m-stat .v { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.m-stat .v.up { color: var(--success); }
.m-stat .v.down { color: var(--primary); }
.m-stat .v.warn { color: var(--danger); }
.m-stat .l { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

.m-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm); }
.m-card .mc-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; }
.m-card .mc-head h3 { font-size: 14.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.m-card .mc-head h3 .hex-dot { width: 11px; height: 11px; background: var(--primary); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.m-card .mc-more { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 3px; }
.m-card .mc-more .ic { width: 14px; height: 14px; }

/* 移动端筛选 chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px; -webkit-overflow-scrolling: touch; }
.chip {
  flex: none;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--text-2);
}
.chip.on { background: var(--primary); border-color: var(--primary); color: #FFF; font-weight: 600; }

/* 移动端抽屉（详情） */
.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(10, 24, 30, .5);
  z-index: 100;
  display: flex;
  align-items: flex-end;
}

.sheet {
  background: var(--surface);
  width: 100%;
  border-radius: 18px 18px 0 0;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  animation: sheet-in .22s ease-out;
}

@keyframes sheet-in {
  from { transform: translateY(40px); opacity: .6; }
  to { transform: none; opacity: 1; }
}

.sheet .sheet-grip { width: 40px; height: 4px; border-radius: 999px; background: var(--border-strong); margin: 10px auto 4px; }
.sheet .sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px 8px; }
.sheet .sheet-head h3 { font-size: 16px; font-weight: 700; }
.sheet .sheet-body { padding: 8px 18px 20px; overflow-y: auto; }

/* ---------- 10. 响应式 ---------- */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .tabbar { display: flex; }

  .topbar {
    height: 56px;
    padding: 0 14px;
    border-bottom: 1px solid var(--border);
  }

  .page-title h1 { font-size: 16px; }
  .page-title p { display: none; }

  .content { padding: 14px 14px calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom, 0px)); }

  .user-chip { padding: 4px 9px 4px 4px; }
  .user-chip .uc-sub { display: none; }
  .user-chip .uc-name { font-size: 12.5px; }
  .user-chip .wx-avatar { width: 27px; height: 27px; }

  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .kpi-value { font-size: 24px; }

  .chart-grid { grid-template-columns: 1fr; }
  .chart { min-height: 280px; }
  .chart-card.span2 { grid-column: auto; }

  .card-head { padding: 13px 16px; }
  .card-body { padding: 14px 16px; }
  .toolbar { padding: 12px 16px; }
  .search-box { min-width: 100%; max-width: none; }

  .form-grid { grid-template-columns: 1fr; }
  .fx-edit { flex-direction: column; }
  .fx-edit .fx-qty { width: 100%; }

  .table th, .table td { padding: 10px 12px; }

  .toast-root { left: 50%; right: auto; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom, 0px)); width: max-content; max-width: calc(100vw - 40px); }

  .modal { max-width: 100%; border-radius: 16px; }
  .modal-mask { padding: 12px; }

  .hero-strip .hs-inner { padding: 14px 16px; }
}

@media (max-width: 400px) {
  .kpi-grid { grid-template-columns: 1fr; }
}

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* 焦点可见性 */
.btn:focus-visible, .nav-item:focus-visible, .chip:focus-visible,
.tab:focus-visible, .input:focus-visible, .select:focus-visible, .textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* ============================================================
   11. 业务扩展（登录、提示、二维码、表单错误）
   ============================================================ */

/* 登录页 */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  background:
    radial-gradient(circle at 15% 15%, rgba(14,124,123,.14), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(233,162,59,.12), transparent 45%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.auth-head {
  padding: 26px 26px 18px;
  background: var(--nav-bg);
  color: #FFF;
  position: relative;
}

.auth-head .logo-hex { width: 40px; height: 40px; color: #7FD1C6; }
.auth-head h1 { font-size: 17px; margin-top: 12px; font-weight: 700; letter-spacing: .02em; }
.auth-head p { font-size: 12px; color: #9FB8C1; margin-top: 4px; }

.auth-body { padding: 22px 26px 26px; }
.auth-body .field .label { font-size: 12.5px; }

.auth-body .btn { height: 42px; width: 100%; font-size: 14px; }

.auth-sep {
  display: flex; align-items: center; gap: 10px;
  color: var(--muted); font-size: 12px; margin: 16px 0;
}
.auth-sep::before, .auth-sep::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}

.btn-wechat {
  background: #07C160; border-color: #07C160; color: #FFF;
}
.btn-wechat:hover { background: #06AD56; border-color: #06AD56; color: #FFF; }

.auth-hint { font-size: 12px; color: var(--muted); line-height: 1.7; margin-top: 14px; }
.auth-error {
  background: var(--danger-soft); color: #A93131; border-radius: 9px;
  padding: 9px 12px; font-size: 12.5px; margin-bottom: 14px;
}

/* 提示条 */
.flash-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.flash {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 11px 14px; border-radius: 10px; font-size: 13px;
  border: 1px solid transparent;
}
.flash .ic { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.flash-ok { background: var(--success-soft); color: #1E7A50; border-color: #C8E8D8; }
.flash-err { background: var(--danger-soft); color: #A93131; border-color: #F2CFCF; }
.flash ul { margin: 4px 0 0; padding-left: 18px; }

/* 表单错误 */
.err-msg { color: #B93A3A; font-size: 12px; margin-top: 4px; }

/* 二维码容器 */
.qr-box .qr-canvas { width: 148px; height: 148px; display: flex; align-items: center; justify-content: center; background: #FFF; border-radius: 8px; }
.qr-box .qr-canvas img, .qr-box .qr-canvas canvas { width: 148px !important; height: 148px !important; }

/* 弹窗开关 */
.modal-mask[hidden] { display: none !important; }

/* 标签式提示 */
.meta-line { font-size: 12px; color: var(--muted); }

/* 表格内紧凑按钮 */
.t-actions form { display: inline; }

/* 移动端表格卡片化辅助 */
@media (max-width: 900px) {
  .hide-m { display: none !important; }
  .auth-card { max-width: 100%; }
}

/* 详情页 */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

/* 分页（自定义 view）*/
.pager .pager-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 30px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-2); font-size: 12.5px; margin-left: 6px;
}
.pager .pager-btn:hover { border-color: var(--primary); color: var(--primary); }
.pager .pager-btn.active { background: var(--primary); border-color: var(--primary); color: #FFF; font-weight: 600; }
.pager .pager-btn.disabled { opacity: .45; pointer-events: none; }
/* 登录表单与滚动条细节 */
.auth-body .input { width: 100%; }
.chips { scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
