:root {
  --blue: #2B5CE6;
  --magenta: #E4007E;
  --grad: linear-gradient(135deg, #2B5CE6 0%, #5B3CD6 55%, #E4007E 100%);
  --dark: #1F2329;
  --grey: #6B7280;
  --line: #EDF0F5;
  --bg: #F5F7FB;
  --green: #0EA35E;
  --red: #E5484D;
  --amber: #E8A317;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--dark);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px;
  background: var(--grad);
}
.login-card {
  width: 100%; max-width: 400px;
  background: #fff; border-radius: 20px;
  padding: 28px 24px 24px;
  box-shadow: 0 18px 50px rgba(20, 30, 80, .25);
}
.login-logo { width: 86px; display: block; margin: 0 auto 6px; }
.login-title { text-align: center; font-size: 19px; font-weight: 700; margin: 6px 0 2px; }
.login-sub { text-align: center; font-size: 12px; color: var(--grey); margin-bottom: 22px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--grey); margin-bottom: 6px; }
.field input {
  width: 100%; height: 46px; border: 1px solid var(--line);
  border-radius: 12px; padding: 0 14px; font-size: 15px;
  background: #FAFBFD; outline: none; transition: .15s;
}
.field input:focus { border-color: var(--blue); background: #fff; }
.btn-primary {
  width: 100%; height: 48px; border: none; border-radius: 12px;
  background: var(--grad); color: #fff; font-size: 16px; font-weight: 600;
  margin-top: 8px; cursor: pointer;
}
.btn-primary:disabled { opacity: .6; }
.login-err { color: var(--red); font-size: 13px; text-align: center; min-height: 18px; margin-top: 10px; }

/* ---------- 顶部 ---------- */
.hero {
  background: var(--grad);
  color: #fff;
  padding: 18px 18px 58px;
  border-radius: 0 0 26px 26px;
  position: relative;
}
.hero-top { display: flex; align-items: center; justify-content: space-between; }
.hero-co { font-size: 12px; opacity: .85; letter-spacing: .5px; }
.hero-name { font-size: 21px; font-weight: 700; margin-top: 6px; }
.hero-right { text-align: right; }
.month-select {
  background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.35);
  border-radius: 10px; padding: 7px 10px; font-size: 13px; outline: none;
}
.month-select option { color: #1F2329; }

/* ---------- 卡片 ---------- */
.cards {
  margin: 12px 14px 0;
  background: #fff; border-radius: 18px;
  padding: 18px 8px 14px;
  box-shadow: 0 10px 30px rgba(30, 40, 90, .10);
  position: relative;
}
.cards-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stat { text-align: center; padding: 6px 2px; border-radius: 10px; cursor: pointer; }
.stat.active { background: #F2F5FF; }
.stat-num { font-size: 22px; font-weight: 700; line-height: 1.2; }
.stat-lbl { font-size: 11px; color: var(--grey); margin-top: 3px; }
.stat.q .stat-num { color: var(--green); }
.stat.uq .stat-num { color: var(--red); }
.stat.pd .stat-num { color: var(--amber); }

.salary-card {
  margin: 14px 0 4px; padding: 14px 16px;
  background: linear-gradient(120deg, #FFF4FA, #F1F4FF);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: space-between;
}
.salary-card .lbl { font-size: 12px; color: var(--grey); }
.salary-card .amt { font-size: 26px; font-weight: 800; color: #C2006A; letter-spacing: -.5px; }
.salary-card .amt small { font-size: 13px; font-weight: 600; }

/* ---------- 列表 ---------- */
.section { padding: 16px 14px 90px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-title { font-size: 15px; font-weight: 700; }
.search {
  width: 100%; height: 40px; border: 1px solid var(--line); border-radius: 11px;
  padding: 0 12px; font-size: 14px; background: #fff; outline: none; margin-bottom: 10px;
}
.tabs { display: flex; gap: 8px; margin-bottom: 12px; overflow-x: auto; padding-bottom: 2px; }
.tab {
  flex: 0 0 auto; padding: 8px 14px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line); font-size: 13px; color: var(--grey);
  cursor: pointer; white-space: nowrap;
}
.tab.active { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }

.dev {
  background: #fff; border-radius: 14px; padding: 13px 14px; margin-bottom: 10px;
  cursor: pointer; border: 1px solid #F1F3F8;
}
.dev-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dev-store { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-sn { font-size: 11.5px; color: #9AA1AC; margin-top: 3px; font-family: ui-monospace, Menlo, monospace; }
.dev-meta { font-size: 12px; color: var(--grey); margin-top: 7px; display: flex; gap: 12px; flex-wrap: wrap; }
.badge { font-size: 11px; padding: 3px 9px; border-radius: 999px; font-weight: 600; flex: 0 0 auto; }
.badge.q { background: #E7F7EF; color: var(--green); }
.badge.uq { background: #FDECEC; color: var(--red); }
.badge.pd { background: #FDF6E3; color: #B07A00; }

.empty { text-align: center; color: #A0A6B0; font-size: 13px; padding: 40px 0; }

/* ---------- 详情弹层 ---------- */
.sheet-mask {
  position: fixed; inset: 0; background: rgba(15, 20, 35, .45);
  display: none; z-index: 50;
}
.sheet-mask.show { display: block; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
  background: #fff; border-radius: 22px 22px 0 0;
  max-height: 88vh; overflow-y: auto;
  transform: translateY(101%); transition: transform .22s ease;
  padding: 8px 18px 28px;
}
.sheet.show { transform: translateY(0); }
.sheet-bar { width: 42px; height: 5px; border-radius: 999px; background: #E3E6EC; margin: 6px auto 14px; }
.sheet h3 { margin: 0 0 2px; font-size: 17px; }
.sheet .sub { font-size: 12px; color: var(--grey); margin-bottom: 16px; }
.metric { display: flex; align-items: flex-start; gap: 10px; padding: 11px 0; border-bottom: 1px solid #F3F5F9; }
.metric:last-of-type { border-bottom: none; }
.metric .ico { width: 20px; height: 20px; border-radius: 50%; flex: 0 0 auto; margin-top: 1px;
  display: flex; align-items: center; justify-content: center; font-size: 12px; color: #fff; font-weight: 700; }
.metric .ico.ok { background: var(--green); }
.metric .ico.no { background: var(--red); }
.metric .body { flex: 1; }
.metric .name { font-size: 14px; font-weight: 600; }
.metric .val { font-size: 12.5px; color: var(--grey); margin-top: 2px; }
.metric .val b { color: var(--dark); }
.reason-box {
  margin-top: 14px; background: #FDF6F6; border: 1px solid #F8DCDC; border-radius: 12px;
  padding: 12px 14px; font-size: 13px; color: #A32B2B; line-height: 1.6;
}
.reason-box.ok { background: #EEF9F3; border-color: #CBEBD9; color: #0B7A46; }
.reason-box.pd { background: #FDF8EA; border-color: #F2E2B8; color: #8A6400; }

.actions { display: flex; gap: 10px; margin-top: 20px; }
.btn-ghost {
  flex: 1; height: 44px; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; font-size: 15px; color: var(--grey); cursor: pointer;
}
.btn-fill {
  flex: 1; height: 44px; border-radius: 12px; border: none;
  background: var(--grad); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
}

/* ---------- 面板切换 ---------- */
.panel-switch {
  display: flex; gap: 6px; margin: -34px 14px 0; position: relative; z-index: 2;
  background: rgba(255,255,255,.9); padding: 5px; border-radius: 14px;
  box-shadow: 0 6px 18px rgba(30,40,90,.10);
}
.panel-switch .ps {
  flex: 1; border: none; background: transparent; padding: 10px 8px;
  border-radius: 10px; font-size: 14px; color: #6B7280; cursor: pointer; font-weight: 500;
}
.panel-switch .ps.active { background: var(--grad); color: #fff; font-weight: 700; }
.foot-note { text-align: center; font-size: 11px; color: #A0A6B0; padding: 6px 0 2px; }


/* ---------- 底部导航 ---------- */
body { padding-bottom: 0; }
#appView { padding-bottom: 66px; }
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; background: rgba(255,255,255,.97);
  border-top: 1px solid #EDF0F5;
  padding-bottom: env(safe-area-inset-bottom);
  backdrop-filter: blur(8px);
}
.bottomnav button {
  flex: 1; border: none; background: transparent; padding: 9px 0 8px;
  font-size: 11px; color: #9AA1AC; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.bottomnav button span { font-size: 19px; line-height: 1; filter: grayscale(1); opacity: .55; }
.bottomnav button.active { color: var(--blue); font-weight: 600; }
.bottomnav button.active span { filter: none; opacity: 1; }

/* ---------- 签到 ---------- */
.progress { height: 8px; background: rgba(255,255,255,.28); border-radius: 999px; margin-top: 10px; overflow: hidden; }
.progress-bar { height: 100%; background: #fff; border-radius: 999px; transition: width .3s; }
.card-block {
  background: #fff; border-radius: 16px; padding: 18px; margin-bottom: 14px;
  box-shadow: 0 2px 12px rgba(30,40,90,.05);
}
.field select {
  width: 100%; height: 46px; border: 1px solid var(--line); border-radius: 12px;
  padding: 0 12px; font-size: 15px; background: #FAFBFD; outline: none;
}
.visit-item {
  display: flex; gap: 12px; background: #fff; border-radius: 14px;
  padding: 10px; margin-bottom: 10px; align-items: center;
}
.visit-item img { width: 62px; height: 62px; border-radius: 10px; object-fit: cover; background: #EEF1F7; }
.visit-item .v-body { flex: 1; min-width: 0; }
.visit-item .v-store { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visit-item .v-meta { font-size: 11.5px; color: #9AA1AC; margin-top: 4px; }
.purpose-tag { display: inline-block; background: #EEF2FF; color: #2B5CE6; font-size: 10.5px; padding: 1px 7px; border-radius: 6px; margin-left: 6px; }

/* ---------- 排行榜 ---------- */
.rank-row {
  display: flex; align-items: center; gap: 12px; background: #fff;
  border-radius: 14px; padding: 12px 14px; margin-bottom: 8px;
}
.rank-row.me { background: linear-gradient(120deg,#FFF4FA,#F1F4FF); border: 1px solid #E6DFFF; }
.rank-no { width: 26px; font-weight: 800; color: #9AA1AC; text-align: center; font-size: 15px; }
.rank-name { flex: 1; font-size: 15px; font-weight: 600; }
.rank-count { font-size: 17px; font-weight: 800; color: #2B5CE6; }
.rank-count small { font-size: 11px; color: #9AA1AC; font-weight: 500; }


/* ---------- 工单小标签 ---------- */
.chips { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.chip {
  background: #fff; border: 1px solid var(--line, #EDF0F5);
  border-radius: 10px; padding: 7px 12px; font-size: 12.5px; color: #6B7280;
}
.chip b { font-size: 15px; color: #1F2329; margin-left: 3px; }
.chip.ok b { color: #0EA35E; }


/* ---------- 办公模块 ---------- */
.office-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
}
.office-item {
  background: #fff; border-radius: 16px; padding: 18px 16px;
  box-shadow: 0 2px 12px rgba(30,40,90,.05); cursor: pointer;
  transition: transform .12s;
}
.office-item:active { transform: scale(.97); }
.office-item.off { opacity: .55; }
.oi-icon { font-size: 26px; line-height: 1; }
.oi-name { font-size: 15px; font-weight: 700; margin-top: 10px; }
.oi-desc { font-size: 11.5px; color: #9AA1AC; margin-top: 3px; }


/* ---------- 掉线预警 ---------- */
.alert-card {
  margin: 12px 14px 0; background: #FFF7EC; border: 1px solid #F5DFBF;
  border-radius: 14px; padding: 13px 14px; display: flex; align-items: center; gap: 12px;
  cursor: pointer;
}
.alert-ico { font-size: 22px; line-height: 1; }


/* ---------- 今日路线 ---------- */
.route-stop {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid #F3F5F9;
}
.route-stop:last-of-type { border-bottom: none; }
.rs-no {
  flex: 0 0 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, #2B5CE6, #7C5CE6); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 700;
}
.rs-body { flex: 1; min-width: 0; }
.rs-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-meta { font-size: 11.5px; color: #9AA1AC; margin-top: 3px; }
.rs-nav {
  flex: 0 0 auto; font-size: 12.5px; color: #2B5CE6; text-decoration: none;
  border: 1px solid #D9E2FF; background: #F4F7FF; padding: 6px 12px; border-radius: 9px;
}
