/* ============================================================
   提成计算系统 · iOS 27 Liquid Glass 设计语言
   圆角分层 / 毛玻璃 / 系统色板 / 弹性动效
   ============================================================ */

:root {
  /* iOS 系统色 */
  --blue: #007aff;
  --blue-press: #0062cc;
  --blue-soft: rgba(0, 122, 255, .1);
  --purple: #af52de;
  --purple-soft: rgba(175, 82, 222, .12);
  --green: #34c759;
  --green-soft: rgba(52, 199, 89, .12);
  --orange: #ff9500;
  --orange-soft: rgba(255, 149, 0, .12);
  --red: #ff3b30;
  --red-soft: rgba(255, 59, 48, .1);
  --teal: #5ac8fa;

  /* 中性层次 */
  --bg: #f2f2f7;
  --bg-elevated: #ffffff;
  --fill-1: rgba(120, 120, 128, .08);
  --fill-2: rgba(120, 120, 128, .12);
  --fill-3: rgba(120, 120, 128, .18);
  --label: #1c1c1e;
  --label-2: #3a3a3c;
  --label-3: #6c6c70;
  --label-4: #8e8e93;
  --separator: rgba(60, 60, 67, .1);
  --separator-strong: rgba(60, 60, 67, .18);

  /* 兼容旧变量名（沿用原来的类） */
  --primary: var(--blue);
  --primary-dark: var(--blue-press);
  --primary-soft: var(--blue-soft);
  --text: var(--label);
  --text-2: var(--label-2);
  --muted: var(--label-4);
  --border: var(--separator);
  --border-strong: var(--separator-strong);
  --danger: var(--red);
  --danger-soft: var(--red-soft);
  --success: var(--green);
  --success-soft: var(--green-soft);
  --warn: var(--orange);
  --warn-soft: var(--orange-soft);
  --auto: var(--blue);
  --auto-soft: var(--blue-soft);
  --manual: var(--purple);
  --manual-soft: var(--purple-soft);

  /* 圆角体系 */
  --r-xl: 28px;
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --r-xs: 9px;

  /* 阴影：低对比度多糖扩散 */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 14px rgba(0, 0, 0, .04);
  --shadow-md: 0 1px 3px rgba(0, 0, 0, .05), 0 10px 30px rgba(0, 0, 0, .06);
  --shadow-lg: 0 2px 8px rgba(0, 0, 0, .06), 0 24px 60px rgba(0, 0, 0, .1);
  --shadow-inner: inset 0 1px 0 rgba(255, 255, 255, .85);

  /* 动效曲线 */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

/* hidden 必须能盖过 .center-page 的 display:flex */
[hidden] { display: none !important; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--label);
  min-height: 100dvh;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -.01em;
  /* 极淡的环境光，让纯灰底不呆板 */
  background-image:
    radial-gradient(900px 500px at 12% -8%, rgba(0, 122, 255, .07), transparent 60%),
    radial-gradient(800px 460px at 92% 4%, rgba(175, 82, 222, .055), transparent 62%);
  background-attachment: fixed;
}

.page { min-height: 100dvh; }

/* ---------- 登录 ---------- */
.center-page { display: flex; align-items: center; justify-content: center; padding: 24px; }

.login-card {
  background: rgba(255, 255, 255, .78);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  backdrop-filter: saturate(180%) blur(30px);
  padding: 42px 38px 34px;
  border-radius: var(--r-xl);
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: var(--shadow-lg), var(--shadow-inner);
  width: 384px;
  animation: cardIn .6s var(--ease-out) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to { opacity: 1; transform: none; }
}

.login-logo {
  width: 56px; height: 56px; border-radius: 16px;
  display: grid; place-items: center; font-size: 28px; margin-bottom: 16px;
  background: linear-gradient(145deg, #4da3ff, #007aff);
  box-shadow: 0 8px 20px rgba(0, 122, 255, .32), var(--shadow-inner);
}
.login-card h1 { font-size: 26px; font-weight: 700; letter-spacing: -.6px; }
.subtitle { color: var(--label-4); margin: 6px 0 28px; font-size: 13.5px; }

.login-card label {
  display: block; margin-bottom: 15px; font-size: 12.5px; font-weight: 600;
  color: var(--label-3); letter-spacing: .01em;
}
.login-card input {
  display: block; width: 100%; margin-top: 7px;
  padding: 12px 14px; border: 1px solid transparent; border-radius: var(--r-sm);
  font-size: 16px; font-family: inherit; background: var(--fill-1);
  color: var(--label); transition: .22s var(--ease-out);
}
.login-card input:focus {
  outline: none; background: #fff; border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, .13);
}

/* ---------- 按钮 ---------- */
.btn-primary {
  width: 100%; padding: 13px; background: var(--blue); color: #fff;
  border: none; border-radius: var(--r-sm); font-size: 16px; font-weight: 600;
  font-family: inherit; cursor: pointer; letter-spacing: .01em;
  transition: transform .16s var(--ease-out), background .16s, box-shadow .16s;
  box-shadow: 0 4px 14px rgba(0, 122, 255, .28);
}
.btn-primary:hover { background: #1a88ff; }
.btn-primary:active { transform: scale(.975); background: var(--blue-press); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary.danger { background: var(--red); box-shadow: 0 4px 14px rgba(255, 59, 48, .28); }
.btn-primary.danger:hover { background: #ff5449; }
.btn-inline { width: auto; padding: 10px 20px; font-size: 14px; }

.btn-ghost {
  padding: 9px 16px; background: var(--fill-1); color: var(--label-2);
  border: none; border-radius: var(--r-sm); cursor: pointer; font-size: 13.5px;
  font-family: inherit; font-weight: 500; transition: .16s var(--ease-out);
}
.btn-ghost:hover { background: var(--fill-2); }
.btn-ghost:active { transform: scale(.97); }
.btn-reset { padding: 8px 14px; font-size: 13px; }

.error { color: var(--red); font-size: 13px; margin-top: 12px; min-height: 18px; }
.muted { color: var(--label-4); font-size: 13px; }

/* ---------- 顶栏：悬浮液态玻璃 ---------- */
header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; height: 64px; padding: 0 26px;
  background: rgba(255, 255, 255, .72);
  -webkit-backdrop-filter: saturate(200%) blur(26px);
  backdrop-filter: saturate(200%) blur(26px);
  border-bottom: 1px solid rgba(60, 60, 67, .08);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .8) inset;
}
.header-title { display: flex; align-items: center; gap: 11px; min-width: 0; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  font-size: 16px; background: linear-gradient(145deg, #4da3ff, #007aff);
  box-shadow: 0 3px 10px rgba(0, 122, 255, .3);
}
.header-title h1 { font-size: 16.5px; font-weight: 700; letter-spacing: -.3px; white-space: nowrap; }
.badge {
  background: var(--blue-soft); color: var(--blue); padding: 4px 10px;
  border-radius: 100px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.header-right { display: flex; align-items: center; gap: 10px; font-size: 13px; flex-shrink: 0; }
.user-chip {
  background: var(--fill-1); padding: 7px 14px; border-radius: 100px;
  font-size: 13px; font-weight: 600; color: var(--label-2); white-space: nowrap;
}

/* 分段控件式导航（iOS Segmented Control） */
nav {
  display: flex; gap: 2px; background: var(--fill-1); padding: 3px;
  border-radius: var(--r-sm); flex-shrink: 0;
}
.nav-btn {
  padding: 7px 15px; border: none; background: transparent; cursor: pointer;
  font-size: 13.5px; font-family: inherit; color: var(--label-3);
  border-radius: 9px; font-weight: 500; transition: .2s var(--ease-out);
  white-space: nowrap;
}
.nav-btn:hover { color: var(--label); }
.nav-btn.active {
  background: #fff; color: var(--label); font-weight: 650;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .1), 0 0 0 .5px rgba(0, 0, 0, .02);
}

main { padding: 26px 26px 70px; max-width: 1380px; margin: 0 auto; }

/* ---------- 通用工具栏（非订单页） ---------- */
.toolbar { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.toolbar label { font-size: 13px; color: var(--label-3); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.toolbar h3 { font-size: 17px; font-weight: 700; letter-spacing: -.3px; }
.toolbar input, .toolbar select {
  padding: 9px 12px; border: 1px solid transparent; border-radius: var(--r-sm);
  font-size: 13.5px; font-family: inherit; background: var(--fill-1);
  color: var(--label); transition: .2s var(--ease-out);
}
.toolbar input:focus, .toolbar select:focus {
  outline: none; background: #fff; border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, .12);
}

/* ---------- 筛选栏 ---------- */
.filter-bar {
  background: rgba(255, 255, 255, .72);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border: 1px solid rgba(255, 255, 255, .85);
  border-radius: var(--r-lg); padding: 16px 18px 12px;
  box-shadow: var(--shadow-sm), var(--shadow-inner);
  margin-bottom: 16px;
}
.filter-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 11.5px; font-weight: 650; color: var(--label-4);
  letter-spacing: .03em; text-transform: uppercase; padding-left: 2px;
}
.field input, .field select {
  padding: 9px 12px; border: 1px solid transparent; border-radius: var(--r-sm);
  font-size: 13.5px; font-family: inherit; background: var(--fill-1);
  color: var(--label); transition: .2s var(--ease-out); min-height: 38px;
}
.field select { padding-right: 30px; cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.field input:focus, .field select:focus {
  outline: none; background-color: #fff; border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, .12);
}
.field-search { min-width: 230px; flex: 1 1 230px; max-width: 320px; }

/* 搜索框 */
.search-wrap { position: relative; display: block; }
.search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--label-4); pointer-events: none;
}
.search-wrap input {
  width: 100%; padding-left: 34px; padding-right: 32px;
  -webkit-appearance: none; appearance: none;
}
.search-wrap input::-webkit-search-cancel-button { display: none; }
.search-clear {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--fill-3); color: #fff; display: grid; place-items: center;
  transition: .15s var(--ease-out);
}
.search-clear svg { width: 10px; height: 10px; }
.search-clear:hover { background: var(--label-4); }

.filter-meta { display: flex; align-items: center; gap: 14px; margin-top: 10px; min-height: 18px; }
.filter-meta .muted { font-size: 12.5px; }

/* ---------- 面板 ---------- */
.panel {
  background: rgba(255, 255, 255, .82);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: var(--r-lg); padding: 20px 22px;
  box-shadow: var(--shadow-sm), var(--shadow-inner);
  margin-bottom: 16px;
}
.panel-head { display: flex; align-items: baseline; gap: 11px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h3 { font-size: 15.5px; font-weight: 700; letter-spacing: -.25px; }
.panel-sub { font-size: 12px; color: var(--label-4); }
.panel-alert {
  border-color: rgba(255, 149, 0, .28);
  background: linear-gradient(180deg, rgba(255, 252, 245, .92), rgba(255, 255, 255, .82));
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }

/* ---------- KPI ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi {
  background: rgba(255, 255, 255, .85);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: var(--r-lg); padding: 18px 20px;
  box-shadow: var(--shadow-sm), var(--shadow-inner);
  position: relative; overflow: hidden;
  transition: transform .25s var(--ease-out), box-shadow .25s var(--ease-out);
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-md), var(--shadow-inner); }
.kpi::before {
  content: ''; position: absolute; left: 0; top: 18px; bottom: 18px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--blue);
}
.kpi.warn::before { background: var(--red); }
.kpi.success::before { background: var(--green); }
.kpi-label {
  font-size: 12px; color: var(--label-4); font-weight: 600;
  letter-spacing: .02em; margin-bottom: 9px; text-transform: uppercase;
}
.kpi-value { font-size: 27px; font-weight: 750; letter-spacing: -.9px; line-height: 1.05; }
.kpi-unit { font-size: 13px; color: var(--label-4); font-weight: 600; margin-left: 3px; letter-spacing: 0; }

/* ---------- 柱状图 ---------- */
.chart-box { width: 100%; overflow-x: auto; padding-bottom: 2px; }
/* 顶部 padding 预留给金额 tooltip，避免被 overflow 裁切 */
.bar-chart {
  display: flex; align-items: flex-end; justify-content: center; gap: 7px;
  height: 222px; padding: 40px 4px 0; min-width: 100%;
}
.bar-col {
  flex: 1 1 0; max-width: 92px; min-width: 18px;
  display: flex; flex-direction: column; align-items: center;
  justify-content: flex-end; height: 100%; position: relative; cursor: pointer;
}
.bar-fill {
  width: 100%; max-width: var(--bar-max, 38px);
  background: linear-gradient(180deg, #5aa9ff, #007aff);
  border-radius: 7px 7px 3px 3px; min-height: 3px;
  transition: transform .22s var(--ease-spring), filter .18s;
  transform-origin: bottom;
}
.bar-col:hover .bar-fill { filter: brightness(1.08); transform: scaleY(1.015); }
/* 深色 tooltip（iOS 风格），确保在白色面板上清晰可读 */
.bar-value {
  position: absolute; bottom: 100%; margin-bottom: 7px;
  font-size: 11px; color: #fff; white-space: nowrap;
  opacity: 0; transform: translateY(4px);
  transition: opacity .18s var(--ease-out), transform .18s var(--ease-out);
  background: rgba(28, 28, 30, .9);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  padding: 5px 9px; border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .2); z-index: 3; font-weight: 600;
  letter-spacing: -.1px; pointer-events: none;
}
.bar-value::after {
  content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 4px solid transparent; border-top-color: rgba(28, 28, 30, .9);
}
.bar-col:hover .bar-value { opacity: 1; transform: translateY(0); }
/* 触摸设备点击柱子后常显 tooltip */
.bar-col.active .bar-value { opacity: 1; transform: translateY(0); }
.bar-label { font-size: 10.5px; color: var(--label-4); margin-top: 7px; white-space: nowrap; font-weight: 500; }

/* ---------- 排名列表 ---------- */
.rank-list { display: flex; flex-direction: column; gap: 7px; }
.rank-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: var(--r-sm); background: rgba(120, 120, 128, .045);
  transition: .18s var(--ease-out);
}
.rank-item:hover { background: rgba(120, 120, 128, .08); }
.rank-no {
  width: 25px; height: 25px; border-radius: 8px; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; background: var(--fill-2); color: var(--label-3);
  flex-shrink: 0;
}
.rank-no.top1 { background: linear-gradient(145deg, #ffd60a, #ffb800); color: #6b4a00; box-shadow: 0 2px 8px rgba(255, 184, 0, .3); }
.rank-no.top2 { background: linear-gradient(145deg, #e8e8ed, #c7c7cc); color: #4a4a4f; }
.rank-no.top3 { background: linear-gradient(145deg, #ffcc9e, #e8a970); color: #6b3d12; }
.rank-name { flex: 1; font-weight: 650; font-size: 13.5px; display: flex; align-items: center; gap: 7px; min-width: 0; }
.rank-name .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-bar { flex: 2; height: 6px; background: var(--fill-2); border-radius: 100px; overflow: hidden; min-width: 40px; }
.rank-bar > i { display: block; height: 100%; border-radius: 100px; transition: width .6s var(--ease-out); }
.rank-val { font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 76px; text-align: right; letter-spacing: -.2px; }
.rank-sub { font-size: 11.5px; color: var(--label-4); font-weight: 600; min-width: 52px; text-align: right; }
.empty-hint { text-align: center; color: var(--label-4); font-size: 13.5px; padding: 30px 0; }

/* 人员色点 */
.pdot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; display: inline-block; }

/* ---------- 异常 ---------- */
.anomaly-list { display: flex; flex-direction: column; gap: 16px; }

/* 按日期分组 */
.anomaly-group { display: flex; flex-direction: column; gap: 8px; }
.anomaly-group-head {
  display: flex; align-items: baseline; gap: 9px;
  padding: 0 2px 2px;
}
.anomaly-date {
  font-size: 13px; font-weight: 700; color: var(--label-2);
  letter-spacing: -.1px;
}
.anomaly-count {
  font-size: 11px; font-weight: 650; color: var(--red);
  background: var(--red-soft); padding: 2px 8px; border-radius: 100px;
}

.anomaly-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-radius: var(--r-md); background: var(--red-soft);
  border: 1px solid rgba(255, 59, 48, .16); font-size: 13px;
}
.anomaly-icon {
  width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center;
  background: rgba(255, 59, 48, .12); color: var(--red); font-size: 15px; flex-shrink: 0;
  font-weight: 700;
}
.anomaly-main { flex: 1; min-width: 0; }
.anomaly-title { font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; }
.anomaly-table { color: var(--label); }
.anomaly-meta { color: var(--label-3); font-size: 12px; margin-top: 3px; }
/* 已处理按钮：提高优先级，避免被 .btn-sm 的默认色覆盖 */
.anomaly-item .anomaly-handle {
  flex-shrink: 0;
  background: #fff;
  color: var(--red);
  border: 1px solid rgba(255, 59, 48, .35);
  font-weight: 650;
}
.anomaly-item .anomaly-handle:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.tag { font-size: 11px; padding: 3px 9px; border-radius: 100px; font-weight: 650; letter-spacing: .01em; }
.tag-warn { background: var(--orange-soft); color: #b26a00; }
.tag-danger { background: var(--red-soft); color: var(--red); }

/* ---------- 图例 ---------- */
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; font-size: 12.5px; color: var(--label-3); }
.legend-item { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-auto { background: var(--blue); }
.dot-manual { background: var(--purple); }
.dot-empty { background: #c7c7cc; }
.dot-audited { background: var(--green); }

/* ---------- 订单卡片 ---------- */
.orders-list { display: flex; flex-direction: column; gap: 12px; }

/* 区域分组 */
.area-group {
  margin-bottom: 26px;
  padding-left: 12px;
  border-left: 3px solid var(--fill-3);
}
.area-group:last-child { margin-bottom: 0; }
.area-head {
  display: flex; align-items: center; gap: 10px;
  padding: 0 2px 9px; border-bottom: 1.5px solid var(--separator-strong);
  margin-bottom: 12px;
}
.area-name { font-size: 15px; font-weight: 750; letter-spacing: -.3px; color: var(--label); }
.area-count {
  font-size: 11.5px; font-weight: 650; padding: 2px 9px; border-radius: 100px;
  background: var(--fill-2); color: var(--label-3);
}
.area-low {
  font-size: 11.5px; font-weight: 650; padding: 2px 9px; border-radius: 100px;
  background: var(--red-soft); color: var(--red);
}
.area-sum {
  margin-left: auto; font-size: 13px; font-weight: 700; color: var(--label-2);
  font-variant-numeric: tabular-nums;
}
.area-body { display: flex; flex-direction: column; gap: 12px; }

.order-card {
  background: rgba(255, 255, 255, .88);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border: 1px solid rgba(255, 255, 255, .92);
  border-radius: var(--r-lg); padding: 16px 18px;
  box-shadow: var(--shadow-sm), var(--shadow-inner);
  transition: box-shadow .25s var(--ease-out), transform .25s var(--ease-out);
  animation: rowIn .4s var(--ease-out) both;
}
@keyframes rowIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.order-card:hover { box-shadow: var(--shadow-md), var(--shadow-inner); }

.order-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 14px; }
.order-left { display: flex; align-items: center; gap: 11px; min-width: 0; }
.order-right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.order-stats { display: flex; align-items: center; gap: 7px; }
.people-chip {
  font-size: 11.5px; color: var(--label-4); font-weight: 600;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
/* 管理员可编辑的人数 */
.people-chip.editable {
  background: none; border: none; font-family: inherit; cursor: pointer;
  padding: 2px 7px 2px 6px; border-radius: 7px;
  display: inline-flex; align-items: center; gap: 4px;
  transition: .15s var(--ease-out);
}
.people-chip.editable:hover {
  background: var(--blue-soft); color: var(--blue);
}
.edit-mark {
  width: 10px; height: 10px; opacity: .5; flex-shrink: 0;
  transition: opacity .15s;
}
.people-chip.editable:hover .edit-mark { opacity: 1; }
/* 人均消费胶囊 */
.avg-chip {
  font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 100px;
  background: var(--fill-2); color: var(--label-2);
  letter-spacing: -.1px; font-variant-numeric: tabular-nums; white-space: nowrap;
  border: 1px solid transparent;
}
/* 人均低于区域阈值：标红 */
.avg-chip.low {
  background: var(--red-soft); color: var(--red);
  border-color: rgba(255, 59, 48, .3);
}
/* 整单标红：低人均订单 */
.order-card.low-avg {
  border-color: rgba(255, 59, 48, .38);
  background: linear-gradient(180deg, rgba(255, 246, 246, .96), rgba(255, 255, 255, .9));
  box-shadow: inset 3px 0 0 var(--red), var(--shadow-sm);
}
.order-card.low-avg:hover {
  box-shadow: inset 3px 0 0 var(--red), var(--shadow-md);
}
.table-name { font-size: 16px; font-weight: 700; letter-spacing: -.3px; }
.order-meta { font-size: 11.5px; color: var(--label-4); margin-top: 3px; }
.money {
  font-size: 20px; font-weight: 750; color: var(--label);
  font-variant-numeric: tabular-nums; letter-spacing: -.6px; flex-shrink: 0;
}
.money.zero { color: var(--label-4); }
.assign-count {
  font-size: 11px; padding: 4px 10px; border-radius: 100px; font-weight: 650;
  background: var(--fill-1); color: var(--label-3); flex-shrink: 0; white-space: nowrap;
}
.assign-count.done { background: var(--green-soft); color: var(--green); }

.assign-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }

.assign-item {
  border: 1.5px solid transparent; border-radius: var(--r-md); padding: 11px 12px;
  background: rgba(120, 120, 128, .05); position: relative;
  transition: .2s var(--ease-out);
  display: flex; flex-direction: column;
}
/* 调查表：两个下拉并排，避免卡片过高 */
.assign-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 7px; }
.assign-pair select { margin-bottom: 0; }
/* 未分配：虚线圈 */
.assign-item.unassigned {
  border: 1.5px dashed rgba(120, 120, 128, .26);
  background: rgba(120, 120, 128, .03);
}
/* 已选择：白底 + 左侧色条 + 描边 */
.assign-item.filled { background: #fff; }
.assign-item.auto {
  border-color: rgba(0, 122, 255, .28);
  box-shadow: inset 3px 0 0 var(--blue), 0 1px 2px rgba(0, 122, 255, .05);
}
.assign-item.manual {
  border-color: rgba(175, 82, 222, .3);
  box-shadow: inset 3px 0 0 var(--purple), 0 1px 2px rgba(175, 82, 222, .05);
}
.assign-item.audited {
  border-color: rgba(52, 199, 89, .32);
  box-shadow: inset 3px 0 0 var(--green), 0 1px 2px rgba(52, 199, 89, .05);
}
/* 公海未达标：锁定态 */
.assign-item.blocked {
  border: 1.5px dashed rgba(255, 149, 0, .45);
  background: rgba(255, 149, 0, .05);
}

.assign-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.dim-label { font-size: 11.5px; color: var(--label-4); font-weight: 650; letter-spacing: .01em; }
.src-tag { font-size: 10px; font-weight: 700; padding: 2.5px 7px; border-radius: 100px; letter-spacing: .02em; }
.src-tag.auto { background: var(--blue-soft); color: var(--blue); }
.src-tag.manual { background: var(--purple-soft); color: var(--purple); }
.src-tag.audited { background: var(--green-soft); color: var(--green); }
.src-tag.blocked { background: var(--orange-soft); color: var(--orange); }

/* 公海标签（订单标题旁） */
.sea-tag {
  display: inline-block; margin-left: 8px; vertical-align: middle;
  font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 100px;
  background: rgba(90, 200, 250, .18); color: #0b7fa8;
  letter-spacing: .02em;
}
.sea-tag.blocked { background: var(--orange-soft); color: #b26a00; }

/* 公海未达标提示 */
.blocked-tip {
  font-size: 10.5px; line-height: 1.45; color: #b26a00;
  background: var(--orange-soft); border-radius: 7px;
  padding: 5px 8px; margin-top: 2px; font-weight: 550;
}
.blocked-tip.admin {
  color: var(--label-4); background: var(--fill-1);
  margin-top: 7px; font-weight: 500;
}

.assign-person {
  display: flex; align-items: center; gap: 7px; font-size: 14.5px; font-weight: 650;
  min-height: 22px; margin-bottom: 9px; letter-spacing: -.2px;
}
.assign-person .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assign-person.empty { color: #b8b8bd; font-weight: 500; font-size: 13px; letter-spacing: 0; }

.assign-item select, .assign-item input[type=number] {
  width: 100%; padding: 8px 10px; border: 1px solid transparent; border-radius: var(--r-xs);
  font-size: 13px; font-family: inherit; margin-bottom: 7px;
  background: var(--fill-1); color: var(--label);
  transition: .18s var(--ease-out);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 28px; cursor: pointer;
}
.assign-item select:focus {
  outline: none; background-color: #fff; border-color: var(--blue);
  box-shadow: 0 0 0 3.5px rgba(0, 122, 255, .12);
}
.assign-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.btn-sm {
  padding: 6px 12px; font-size: 12px; border-radius: 100px; cursor: pointer;
  border: none; background: var(--fill-2); color: var(--label-2);
  font-family: inherit; font-weight: 600;
  transition: .16s var(--ease-out);
}
.btn-sm:hover { background: var(--fill-3); }
.btn-sm:active { transform: scale(.95); }
.btn-sm.primary { background: var(--blue); color: #fff; box-shadow: 0 2px 8px rgba(0, 122, 255, .25); }
.btn-sm.primary:hover { background: #1a88ff; }
.btn-sm.audit { background: var(--green); color: #fff; box-shadow: 0 2px 8px rgba(52, 199, 89, .25); }
.btn-sm.audit:hover { background: #3dd166; }

/* ---------- 0 金额折叠 ---------- */
.zero-box { margin-top: 20px; }
.zero-toggle {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 14px 17px;
  background: rgba(255, 255, 255, .6); border: 1.5px dashed var(--separator-strong);
  border-radius: var(--r-md); cursor: pointer; font-size: 13.5px; color: var(--label-2);
  font-family: inherit; font-weight: 550; text-align: left;
  transition: .2s var(--ease-out);
}
.zero-toggle:hover { background: rgba(255, 255, 255, .9); border-color: rgba(120, 120, 128, .3); }
.zero-arrow { display: inline-block; transition: transform .25s var(--ease-out); font-size: 11px; color: var(--label-4); }
.zero-arrow.open { transform: rotate(90deg); }
.zero-box .orders-list { margin-top: 12px; }

/* ---------- 报表 ---------- */
.report-cards { display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px; }
.report-card {
  background: rgba(255, 255, 255, .86);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid rgba(255, 255, 255, .92);
  border-radius: var(--r-lg); padding: 22px 24px;
  box-shadow: var(--shadow-sm), var(--shadow-inner);
}
.report-card h3 {
  font-size: 14px; margin-bottom: 16px; color: var(--label-3);
  font-weight: 650; letter-spacing: -.1px;
}
.report-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 0; border-bottom: 1px solid var(--separator); font-size: 14px;
}
.report-row:last-child { border-bottom: none; }
.report-row .lbl { color: var(--label-2); }
.report-row .val { font-variant-numeric: tabular-nums; font-weight: 650; letter-spacing: -.2px; }
.report-row.total {
  font-size: 20px; font-weight: 750; color: var(--blue);
  border-top: 1.5px solid var(--separator-strong); padding-top: 16px; margin-top: 5px;
  letter-spacing: -.4px;
}
.report-row.deduct { color: var(--red); }
.report-row.reward { color: var(--green); }
.report-row.pending { color: var(--orange); font-size: 13px; }
.report-row.excluded { color: #b26a00; font-size: 13px; }
.report-note {
  font-size: 11.5px; color: var(--label-4); margin-top: 12px;
  line-height: 1.5; padding-top: 10px; border-top: 1px dashed var(--separator);
}

/* ---------- 导出栏 ---------- */
.export-bar {
  background: rgba(255, 255, 255, .78);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: var(--r-lg); padding: 16px 18px;
  box-shadow: var(--shadow-sm), var(--shadow-inner);
  margin-bottom: 16px;
}
.export-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.export-title { font-size: 14.5px; font-weight: 700; letter-spacing: -.2px; }
.export-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.export-row .field { min-width: 0; }
#export-hint { margin-top: 9px; font-size: 12.5px; min-height: 17px; }

/* ---------- 报表表内标识 ---------- */
.pending-banner {
  font-size: 12.5px; color: var(--orange); font-weight: 600;
  background: var(--orange-soft); padding: 6px 12px; border-radius: 100px;
}
.pending-tip {
  display: inline-block; margin-left: 6px; font-size: 10.5px; font-weight: 650;
  color: var(--orange); background: var(--orange-soft);
  padding: 1px 7px; border-radius: 100px; white-space: nowrap;
}
.reward-val { color: var(--green); font-weight: 700; font-variant-numeric: tabular-nums; }
.reward-x {
  font-style: normal; font-size: 10.5px; opacity: .7; margin-left: 3px; font-weight: 600;
}
.row-actions { display: flex; gap: 5px; white-space: nowrap; }

/* ---------- 弹窗输入框 ---------- */
.modal-input {
  width: 100%; padding: 11px 13px; margin-bottom: 8px;
  border: 1.5px solid var(--separator-strong); border-radius: var(--r-sm);
  font-size: 17px; font-family: inherit; text-align: center; font-weight: 600;
  background: var(--fill-1); color: var(--label);
  transition: .15s var(--ease-out);
}
.modal-input:focus {
  outline: none; background: #fff; border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, .12);
}
.modal-error { color: var(--red); font-size: 12px; margin-bottom: 8px; }

/* ---------- 表格 ---------- */
.data-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: rgba(255, 255, 255, .88);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-radius: var(--r-lg); overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .92);
  box-shadow: var(--shadow-sm);
}
.data-table th, .data-table td { padding: 12px 14px; text-align: left; font-size: 13.5px; border-bottom: 1px solid var(--separator); }
.data-table th {
  background: rgba(120, 120, 128, .055); color: var(--label-4);
  font-weight: 650; font-size: 11.5px; letter-spacing: .03em; text-transform: uppercase;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background .15s; }
.data-table tbody tr:hover { background: rgba(120, 120, 128, .04); }

/* ---------- 表单 ---------- */
.inline-form { display: flex; gap: 9px; margin-bottom: 20px; flex-wrap: wrap; }
.inline-form input, .inline-form select {
  padding: 10px 13px; border: 1px solid transparent; border-radius: var(--r-sm);
  font-size: 13.5px; font-family: inherit; background: var(--fill-1);
  color: var(--label); transition: .2s var(--ease-out);
}
.inline-form input:focus, .inline-form select:focus {
  outline: none; background: #fff; border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, .12);
}

/* ---------- 模态弹窗（iOS Alert） ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, .28);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 24px;
  opacity: 0; transition: opacity .18s var(--ease-out);
}
.modal-mask.show { opacity: 1; }
.modal-card {
  width: 100%; max-width: 340px;
  background: rgba(255, 255, 255, .96);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  backdrop-filter: saturate(180%) blur(30px);
  border-radius: var(--r-xl); padding: 26px 24px 20px; text-align: center;
  box-shadow: var(--shadow-lg);
  transform: scale(.92); opacity: 0;
  transition: transform .26s var(--ease-spring), opacity .2s;
}
.modal-mask.show .modal-card { transform: scale(1); opacity: 1; }
.modal-icon {
  width: 50px; height: 50px; border-radius: 50%; margin: 0 auto 14px;
  display: grid; place-items: center; font-size: 23px; font-weight: 700;
  background: var(--orange-soft); color: var(--orange);
}
.modal-icon.danger { background: var(--red-soft); color: var(--red); }
.modal-card h3 { font-size: 17px; font-weight: 700; margin-bottom: 9px; letter-spacing: -.3px; }
.modal-card p { font-size: 13.5px; color: var(--label-3); line-height: 1.6; margin-bottom: 22px; }
.modal-card p b { color: var(--label); font-weight: 650; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.modal-actions .btn-ghost, .modal-actions .btn-primary {
  width: 100%; padding: 12px; font-size: 15px; border-radius: var(--r-sm);
}

/* ---------- 表格横向滚动容器 ---------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--r-lg);
}
.table-wrap::-webkit-scrollbar { height: 6px; }
/* 表格滑动提示：仅移动端显示 */
.table-hint { display: none; }

/* ============================================================
   响应式：平板
   ============================================================ */
@media (max-width: 1100px) {
  .two-col { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .field-search { max-width: none; flex: 1 1 100%; }
}

/* 平板中间档：四维度 2 列比 4 列更好操作 */
@media (min-width: 641px) and (max-width: 1024px) {
  .assign-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   响应式：平板竖屏 / 大屏手机
   ============================================================ */
@media (max-width: 820px) {
  /* 移动端 fixed 背景在 iOS 上渲染异常且耗性能，改为随页滚动 */
  body { background-attachment: scroll; }

  /* 顶栏：压缩成两行（标题+用户 / 导航），并适配刘海安全区 */
  header {
    height: auto;
    padding: calc(10px + env(safe-area-inset-top)) 14px 8px;
    flex-wrap: wrap;
    gap: 8px 10px;
    align-items: center;
  }
  .header-title { flex: 1 1 auto; gap: 8px; min-width: 0; }
  .header-title h1 { font-size: 15px; }
  .logo-mark { width: 28px; height: 28px; font-size: 14px; border-radius: 9px; }
  .badge { display: none; }              /* 小屏隐藏门店标签，省空间 */
  .header-right { flex: 0 0 auto; gap: 6px; }
  .user-chip { font-size: 12px; padding: 6px 11px; }
  .btn-ghost { padding: 7px 12px; font-size: 12.5px; }

  /* 导航：横向滑动，隐藏滚动条，右侧渐隐提示可滑动 */
  nav {
    order: 3; width: 100%; overflow-x: auto; overflow-y: hidden;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent);
  }
  nav::-webkit-scrollbar { display: none; }
  .nav-btn { padding: 7px 13px; font-size: 13px; flex: 0 0 auto; }

  main { padding: 16px 12px calc(60px + env(safe-area-inset-bottom)); }

  /* 筛选栏：搜索独占一行，其余两列 */
  .filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .field { flex: none; min-width: 0; }
  .field-search { grid-column: 1 / -1; }
  #sync-btn, #filter-reset { width: 100%; }
  .filter-meta { flex-wrap: wrap; gap: 6px 12px; }

  /* 输入控件：iOS 需 ≥16px 才不触发自动放大 */
  .field input, .field select, .toolbar input, .toolbar select,
  .inline-form input, .inline-form select { font-size: 16px; min-height: 42px; }

  /* 订单卡片：四维度改单列，操作区更宽裕 */
  .assign-grid { grid-template-columns: 1fr; gap: 8px; }
  .order-card { padding: 14px; border-radius: var(--r-md); }
  .order-head { gap: 10px; align-items: flex-start; }
  .order-left { flex: 1 1 auto; min-width: 0; flex-wrap: wrap; gap: 6px 8px; }
  .order-left > div { min-width: 0; }
  /* 订单号一行截断，避免被右侧金额挤压换行 */
  .order-meta {
    font-size: 10.5px; line-height: 1.45;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 100%;
  }
  .order-right { flex: 0 0 auto; }
  .table-name { font-size: 15px; }
  .money { font-size: 17px; letter-spacing: -.4px; }
  .order-stats { gap: 5px; }
  .people-chip { font-size: 10.5px; }
  .avg-chip { font-size: 11px; padding: 2px 8px; }

  /* 触摸目标：按钮 ≥38px */
  .btn-sm { padding: 9px 15px; font-size: 13px; min-height: 38px; }
  .assign-item { padding: 12px 14px; border-radius: var(--r-sm); }
  .assign-person { font-size: 15px; }
  .assign-item select { min-height: 40px; font-size: 15px; }
  .dim-label { font-size: 12px; }
  .src-tag { font-size: 10.5px; padding: 3px 8px; }

  /* KPI 更紧凑 */
  .kpi { padding: 14px 16px; border-radius: var(--r-md); }
  .kpi-value { font-size: 21px; letter-spacing: -.6px; }
  .kpi-label { font-size: 11px; margin-bottom: 7px; }

  /* 图表 */
  .bar-chart { height: 186px; padding-top: 36px; gap: 5px; }
  .bar-col { max-width: 60px; }
  .bar-label { font-size: 9.5px; }
  .bar-value { font-size: 10.5px; padding: 4px 8px; }

  /* 排名 / 异常 */
  .rank-item { padding: 9px 10px; gap: 8px; }
  .rank-name { min-width: 0; flex: 1 1 auto; }
  .rank-bar { flex: 0 1 34%; min-width: 26px; }
  .rank-val { min-width: 64px; font-size: 12.5px; }
  .rank-sub { min-width: 38px; font-size: 10.5px; }
  .rank-no { width: 23px; height: 23px; font-size: 11px; }
  .anomaly-item { padding: 11px 12px; gap: 10px; }

  /* 表格：横向滚动，保证列不挤压 */
  .data-table { min-width: 620px; }
  .data-table th, .data-table td { padding: 10px 11px; font-size: 13px; white-space: nowrap; }
  .table-hint {
    display: block; text-align: center; font-size: 11.5px;
    color: var(--label-4); margin-top: 8px;
  }

  /* 报表 */
  .report-card { padding: 18px 18px; border-radius: var(--r-md); }
  .report-row { font-size: 13.5px; padding: 10px 0; }
  .report-row.total { font-size: 18px; }

  /* 弹窗靠近底部更易单手操作 */
  .modal-mask { padding: 20px; align-items: center; }
  .modal-card { max-width: calc(100vw - 40px); padding: 24px 20px 18px; }

  /* 工具栏：日期/月份并排，标签不换行 */
  .toolbar { gap: 10px; }
  .toolbar label {
    flex: 1 1 0; min-width: 0; white-space: nowrap;
    gap: 6px;
  }
  .toolbar input { flex: 1 1 auto; min-width: 0; width: 100%; }

  /* 登录页铺满安全宽度 */
  .login-card { width: 100%; max-width: 384px; padding: 34px 24px 28px; }
  .center-page { padding: 20px; }

  /* 触摸体验 */
  .btn-primary, .btn-ghost, .btn-sm, .nav-btn, .zero-toggle { touch-action: manipulation; }
}

/* ============================================================
   响应式：手机（≤640px）
   ============================================================ */
@media (max-width: 640px) {
  .kpi-row { gap: 10px; }
  .kpi-value { font-size: 19px; }
  .kpi-unit { font-size: 11px; }

  /* 筛选栏：显式定位，避免 grid 自动排列错位 */
  .filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
  .field-search { grid-column: 1 / -1; grid-row: 1; }
  .field-date   { grid-column: 1 / 2;  grid-row: 2; }
  .field-area   { grid-column: 2 / 3;  grid-row: 2; }
  .field-status { grid-column: 1 / -1; grid-row: 3; }
  .field-user   { grid-column: 1 / -1; grid-row: 4; }
  #sync-btn     { grid-column: 1 / -1; grid-row: 5; }
  #filter-reset { grid-column: 1 / -1; grid-row: 6; }
  .field { flex: none; min-width: 0; width: 100%; }

  /* 导出栏：日期两列，人员与按钮全宽 */
  .export-row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
  .export-row .field-user { grid-column: 1 / -1; }
  #export-btn { grid-column: 1 / -1; width: 100%; }

  /* 区域分组头紧凑化 */
  .area-head { flex-wrap: wrap; gap: 6px 9px; }
  .area-name { font-size: 14px; }
  .area-sum { margin-left: 0; width: 100%; font-size: 12px; }

  /* 订单头：金额换到右侧固定，桌台信息占满 */
  .order-left { align-items: flex-start; flex-wrap: wrap; gap: 6px 8px; }
  .assign-count { font-size: 10.5px; padding: 3px 8px; }

  /* 图例：两列网格，避免挤成一行截断 */
  .legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }

  /* 异常项：图标与内容同行，按钮换到下一行全宽 */
  .anomaly-item { flex-wrap: wrap; row-gap: 8px; }
  .anomaly-icon { order: 1; }
  .anomaly-main { order: 2; flex: 1 1 0; min-width: 0; }
  .anomaly-item .anomaly-handle { order: 3; flex: 0 0 100%; width: 100%; min-height: 38px; }

  /* 两个并排下拉在窄屏改上下排列，避免挤压 */
  .assign-pair { grid-template-columns: 1fr; gap: 6px; }

  /* 面板内边距收紧 */
  .panel { padding: 16px 16px; border-radius: var(--r-md); }
  .panel-head { gap: 6px 10px; margin-bottom: 12px; }

  /* 图表再压一点，保证首屏能看到 */
  .bar-chart { height: 168px; padding-top: 34px; }

  /* 全员报表：表格已是横向滚动，这里只收紧字号 */
  .data-table { min-width: 700px; }

  /* 表单：单列 */
  .inline-form { flex-direction: column; }
  .inline-form input, .inline-form select, .inline-form .btn-primary { width: 100%; }
}

/* ============================================================
   响应式：小屏手机（≤390px）
   ============================================================ */
@media (max-width: 390px) {
  main { padding: 14px 10px calc(56px + env(safe-area-inset-bottom)); }
  .header-title h1 { font-size: 14px; }
  .nav-btn { padding: 6px 11px; font-size: 12.5px; }
  .money { font-size: 16px; }
  .kpi-value { font-size: 17.5px; }
  .assign-item { padding: 11px 12px; }
  .btn-sm { padding: 8px 12px; font-size: 12.5px; }
}

/* ============================================================
   触摸设备：去掉 hover 依赖，增大点击区
   ============================================================ */
@media (hover: none) {
  .order-card:hover { box-shadow: var(--shadow-sm), var(--shadow-inner); }
  .kpi:hover { transform: none; }
  .bar-col:hover .bar-fill { transform: none; filter: none; }
  /* 触摸设备上 tooltip 用点击后常显由 JS 处理，这里保证可读 */
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* ============================================================
   登录页改版（企业微信免密登录 + 账号密码兼容）
   ============================================================ */

.login-card { width: 400px; padding: 38px 36px 26px; }

/* 品牌区：图标与标题并排，比原来居中的大标题更紧凑 */
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.login-brand .login-logo {
  margin: 0; flex: 0 0 52px; width: 52px; height: 52px;
  font-size: 26px; border-radius: 15px;
}
.login-brand-text h1 { font-size: 21px; font-weight: 700; letter-spacing: -.4px; line-height: 1.2; }
.login-brand-text .subtitle { margin: 4px 0 0; font-size: 12.5px; color: var(--label-4); }

/* 企业微信登录按钮：企微蓝，视觉上作为首选入口 */
.btn-wecom {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 9px;
  padding: 13px 16px; margin-bottom: 4px;
  font-family: inherit; font-size: 15.5px; font-weight: 600; letter-spacing: .01em;
  color: #fff; cursor: pointer; border: none; border-radius: var(--r-md);
  background: linear-gradient(160deg, #2b9bff, #0082ef 60%, #0070d9);
  box-shadow: 0 8px 20px rgba(0, 130, 239, .28), var(--shadow-inner);
  transition: transform .22s var(--ease-out), box-shadow .22s var(--ease-out), filter .22s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.btn-wecom:hover { filter: brightness(1.04); box-shadow: 0 10px 24px rgba(0, 130, 239, .34); }
.btn-wecom:active { transform: scale(.975); }
.btn-wecom:disabled { opacity: .62; cursor: default; transform: none; }
.btn-wecom .wecom-icon { width: 21px; height: 21px; flex: 0 0 21px; }
@media (prefers-reduced-motion: reduce) { .btn-wecom { transition: none; } }

.wecom-hint {
  margin: 10px 0 0; font-size: 12.5px; color: var(--label-4);
  text-align: center; line-height: 1.5;
}

/* 分隔线：说明下方为备用登录方式 */
.login-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0 18px; color: var(--label-4); font-size: 12px;
}
.login-divider::before, .login-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--separator);
}
.login-divider span { flex: 0 0 auto; letter-spacing: .02em; }

.login-card input::placeholder { color: var(--label-4); opacity: .75; }
.login-foot {
  margin: 18px 0 0; text-align: center; font-size: 11.5px;
  color: var(--label-4); letter-spacing: .01em;
}
#login-error:empty { margin: 0; }
#login-error { margin-top: 12px; }

@media (max-width: 480px) {
  .login-card { width: 100%; max-width: 400px; padding: 30px 22px 22px; }
  .login-brand { gap: 12px; margin-bottom: 22px; }
  .login-brand .login-logo { flex-basis: 46px; width: 46px; height: 46px; font-size: 23px; }
  .login-brand-text h1 { font-size: 19px; }
  .btn-wecom { padding: 13px 14px; font-size: 15px; }
}

/* ============================================================
   右上角用户菜单
   ============================================================ */

.user-menu-wrap { position: relative; }

/* .user-chip 现在改成按钮，重置原生样式 */
.user-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; font-family: inherit; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .18s var(--ease-out), color .18s var(--ease-out), transform .18s var(--ease-out);
}
.user-chip:hover { background: var(--fill-2); }
.user-chip:active { transform: scale(.97); }
.user-chip[aria-expanded="true"] { background: var(--fill-2); color: var(--label); }
.chip-chev {
  width: 12px; height: 12px; flex: 0 0 12px; opacity: .5;
  transition: transform .22s var(--ease-out);
}
.user-chip[aria-expanded="true"] .chip-chev { transform: rotate(180deg); opacity: .8; }

.user-menu {
  position: absolute; top: calc(100% + 9px); right: 0; z-index: 80;
  min-width: 158px; padding: 6px;
  background: rgba(255, 255, 255, .94);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg), 0 0 0 .5px rgba(60, 60, 67, .1);
  transform-origin: top right;
  animation: menuIn .18s var(--ease-out);
}
@keyframes menuIn {
  from { opacity: 0; transform: scale(.94) translateY(-5px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.user-menu-item {
  display: block; width: 100%; padding: 10px 12px; text-align: left;
  border: none; background: transparent; cursor: pointer;
  font-family: inherit; font-size: 13.5px; font-weight: 500;
  color: var(--label-2); border-radius: var(--r-xs);
  transition: background .15s var(--ease-out), color .15s var(--ease-out);
}
.user-menu-item:hover { background: var(--fill-1); color: var(--label); }
.user-menu-item.is-danger { color: var(--red); }
.user-menu-item.is-danger:hover { background: var(--red-soft); }
.user-menu-sep { height: 1px; margin: 5px 8px; background: var(--separator); }

/* ============================================================
   表单型弹窗（编辑用户 / 修改密码）
   ============================================================ */

.modal-card.modal-form {
  max-width: 430px; text-align: left; padding: 26px 26px 20px;
}
.modal-form h3 { margin-bottom: 6px; }
.modal-form .modal-sub {
  font-size: 12.5px; color: var(--label-4); margin: 0 0 18px; line-height: 1.5;
}
.form-grid { display: grid; gap: 14px; }
.form-field { display: grid; gap: 6px; }
.form-field > span { font-size: 12.5px; font-weight: 600; color: var(--label-3); }
.form-field input, .form-field select {
  width: 100%; box-sizing: border-box;
  padding: 11px 13px; font-size: 14.5px; font-family: inherit;
  color: var(--label); background: var(--fill-1);
  border: 1.5px solid var(--separator-strong); border-radius: var(--r-sm);
  transition: .15s var(--ease-out);
}
.form-field input:focus, .form-field select:focus {
  outline: none; background: #fff; border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, .12);
}
.form-field input[readonly] {
  background: var(--fill-2); color: var(--label-4); cursor: default;
}
.form-field input[readonly]:focus { box-shadow: none; border-color: var(--separator-strong); background: var(--fill-2); }
.field-tip { font-size: 11.5px; color: var(--label-4); font-style: normal; line-height: 1.45; }
.modal-form .modal-error { margin: 12px 0 0; }
.modal-form .modal-actions { margin-top: 18px; }

/* 企微绑定状态标签 */
.wecom-cell { font-size: 12.5px; }
.wecom-bound { color: var(--blue); font-weight: 600; }
.wecom-none { color: var(--label-4); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* 已停用账号整行弱化，避免误分配 */
.data-table tbody tr.row-off { opacity: .55; }
.data-table tbody tr.row-off:hover { opacity: .8; }

@media (max-width: 640px) {
  .user-menu { min-width: 140px; }
  .modal-card.modal-form { max-width: calc(100vw - 32px); padding: 22px 18px 16px; }
  .form-field input, .form-field select { font-size: 16px; min-height: 44px; }
  .row-actions { gap: 5px; }
}

/* ============================================================
   用户管理 · 新增用户（弹窗）
   ============================================================ */

.users-toolbar { gap: 12px; }
.users-count { font-size: 12.5px; color: var(--label-4); }
.users-count b { color: var(--label-2); font-weight: 600; }
.users-add-btn { margin-left: auto; }

/* 必填星号 */
.form-field .req {
  color: var(--red); font-style: normal; font-weight: 700;
  margin-left: 2px; font-size: 12px;
}

/* 密码自动生成时的禁用态 */
.form-field input:disabled {
  background: var(--fill-2); color: var(--label-4);
  cursor: not-allowed; border-color: var(--separator);
}
.form-field input:disabled::placeholder { color: var(--label-4); }
.field-tip.is-auto { color: var(--blue); font-style: normal; }

/* 随机密码回显 */
.pwd-box {
  display: flex; align-items: center; justify-content: center;
  padding: 16px 14px; margin: 2px 0 0;
  background: var(--fill-1); border: 1.5px dashed var(--separator-strong);
  border-radius: var(--r-sm);
}
.pwd-box code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 20px; letter-spacing: 2px; font-weight: 600;
  color: var(--label); word-break: break-all; text-align: center;
  -webkit-user-select: all; user-select: all;
}
.pwd-box-actions { display: flex; justify-content: center; margin-top: 10px; }

@media (max-width: 640px) {
  .users-add-btn { width: 100%; margin-left: 0; }
  .pwd-box code { font-size: 18px; }
}
