/* 上海镭星激光 · 销售管理系统 — 企业微信自建应用 H5（淡蓝渐变主题，移动优先） */
:root {
  --bg: #e9f1fb;
  --bg-grad: linear-gradient(180deg, #f6fafe 0%, #e3eefb 60%, #d8e9f9 100%);
  --card: #ffffff;
  --card-2: #f1f5fb;
  --line: #d8e2ef;
  --text: #1f2937;
  --muted: #64748b;
  --primary: #2f6bff;
  --primary-weak: #e8efff;
  --ok: #16a34a;
  --ok-weak: #e7f6ec;
  --warn: #d97706;
  --warn-weak: #fdf3e3;
  --danger: #dc2626;
  --danger-weak: #fdecec;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(30, 64, 120, 0.08);
  --slogan-grad: linear-gradient(90deg, #ffd34d 0%, #ff8a3d 55%, #e8484d 100%);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* 商密保护（缓解）：禁止长按选择/弹出菜单；输入框除外 */
body { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
input, textarea, select { user-select: text; -webkit-user-select: text; -webkit-touch-callout: default; }
/* 切后台/最近任务预览时模糊整屏（防止任务卡片泄露内容） */
body.shield #app, body.shield #splash { filter: blur(16px); }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  /* 不在 body 上限宽：全屏层（开始页/水印）与渐变背景需铺满视口；宽度约束放在 #app */
  background: var(--bg-grad);
  background-attachment: fixed; /* iOS 不支持时优雅降级为随内容拉伸 */
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
}
#app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
}
.loading { text-align: center; color: var(--muted); padding: 60px 0; }

/* 登录人水印（名字+工号+日期时间 平铺，防信息泄露；淡蓝底用深蓝低透明字） */
#watermark {
  position: fixed; inset: 0;
  width: 100vw; max-width: 100vw;
  z-index: 95;
  pointer-events: none;
  background-repeat: repeat;
  display: none;
}

/* 黄红渐变标语条（顶栏下方，所有页面） */
.slogan {
  background: var(--slogan-grad);
  color: #fff;
  font-size: 14.5px; font-weight: 700; letter-spacing: 2.5px;
  text-align: center; padding: 7px 10px;
  text-shadow: 0 1px 2px rgba(150, 60, 0, 0.35);
}

/* 开始页 */
#splash {
  position: fixed; inset: 0;
  width: 100vw; max-width: 100vw; /* 显式铺满视口，不受任何父容器宽度约束 */
  z-index: 100;
  background: var(--bg-grad);
  display: flex; flex-direction: column; align-items: center;
  transition: opacity 0.35s ease;
}
#splash.hide { opacity: 0; pointer-events: none; }
#splash .splash-slogan { width: 100%; flex: none; }
.splash-inner {
  text-align: center; padding: 4vh 20px 20px; max-width: 400px; width: 100%;
  display: flex; flex-direction: column; align-items: center; /* 所有子元素严格共用一条垂直中心线 */
}
.splash-logo { width: 150px; max-width: 46%; margin-bottom: 4px; flex: none; }
.splash-code {
  font-size: 12px; font-weight: 700; letter-spacing: 4px;
  color: var(--muted); margin-bottom: 18px; flex: none;
}
.splash-icon { width: 88px; height: 88px; border-radius: 20px; box-shadow: 0 6px 18px rgba(30, 64, 120, 0.25); display: block; margin: 0 auto 16px; flex: none; }
.splash-title { font-size: 22px; letter-spacing: 4px; margin: 0 0 6px; color: var(--text); font-weight: 700; }
.splash-sub { font-size: 13px; letter-spacing: 6px; color: var(--muted); margin-bottom: 28px; }
.splash-enter { width: 180px; padding: 12px 0; font-size: 15px; letter-spacing: 6px; border-radius: 999px; }

/* 顶栏（含标语条整体吸顶） */
.topwrap { position: sticky; top: 0; z-index: 20; }
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 8px 12px;
  display: flex; align-items: center; gap: 8px;
  min-height: 52px;
}
.topbar .tb-brand {
  display: flex; flex-direction: column; align-items: center; gap: 0;
  flex: none; line-height: 1;
}
.topbar .tb-logo { height: 27px; flex: none; display: block; }
.topbar .tb-code {
  font-size: 9.5px; font-weight: 700; letter-spacing: 1.5px;
  color: var(--muted); margin-top: 2px; white-space: nowrap;
}
.topbar h1 { font-size: 17px; margin: 0; flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .back { border: none; background: none; font-size: 22px; color: var(--text); padding: 0 6px; cursor: pointer; }
.topbar .sub { font-size: 12px; color: var(--muted); }
/* 顶栏身份按钮（测试期每页快速切换身份） */
.me-btn {
  border: 1px solid var(--line); background: var(--primary-weak); color: var(--primary);
  border-radius: 999px; font-size: 13px; font-weight: 600; padding: 4px 10px 4px 8px;
  display: flex; align-items: center; gap: 4px; cursor: pointer; flex: none;
}
.me-btn .caret { font-size: 10px; opacity: 0.7; }
/* 切换身份底部弹层 */
#switchMask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(15, 35, 70, 0.45);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn 0.15s ease;
}
#switchMask .sheet {
  background: var(--card); width: 100%; max-width: 640px;
  border-radius: 16px 16px 0 0;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  animation: slideUp 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(30%); } to { transform: translateY(0); } }
.sheet-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.sheet-head b { font-size: 16px; }
.sheet-close { margin-left: auto; border: none; background: none; font-size: 18px; color: var(--muted); cursor: pointer; padding: 4px 6px; }

/* 页面容器 */
.page { padding: 12px 12px 84px; }

/* 卡片 */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
}
.card h3 { margin: 0 0 10px; font-size: 15px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 13px; }
.spacer { flex: 1; }

/* 徽标 */
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; }
.badge.ok { background: var(--ok-weak); color: var(--ok); }
.badge.warn { background: var(--warn-weak); color: var(--warn); }
.badge.gray { background: #eef1f6; color: var(--muted); }
.badge.blue { background: var(--primary-weak); color: var(--primary); }
.badge.red { background: var(--danger-weak); color: var(--danger); }

/* 列表项 */
.item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.item:last-child { border-bottom: none; }
.item .avatar {
  width: 40px; height: 40px; border-radius: 10px; flex: none;
  background: var(--primary-weak); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 600;
}
.item .avatar.green { background: var(--ok-weak); color: var(--ok); }
.item .main { flex: 1; min-width: 0; }
.item .title { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.item .desc { font-size: 13px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.item .arrow { color: #b6c2d4; align-self: center; }

/* 底部导航 */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 640px;
  background: var(--card); border-top: 1px solid var(--line);
  display: flex; z-index: 30;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; text-align: center; text-decoration: none;
  color: var(--muted); font-size: 11px; padding: 8px 0 6px;
  position: relative;
}
.tabbar a .ico { font-size: 20px; display: block; }
.tabbar a.active { color: var(--primary); font-weight: 600; }
.tabbar .dot {
  position: absolute; top: 4px; right: calc(50% - 20px);
  background: var(--danger); color: #fff; font-size: 10px;
  border-radius: 999px; min-width: 16px; height: 16px; line-height: 16px;
  padding: 0 4px;
}

/* FAB 悬浮按钮（贴内容列） */
.fab {
  position: fixed; z-index: 25;
  bottom: 76px;
  right: max(16px, calc(50% - 320px + 16px));
  right: 16px; /* 降级 */
  right: max(16px, calc(50% - 320px + 16px));
  background: var(--primary); color: #fff;
  border: none; border-radius: 999px;
  padding: 12px 18px; font-size: 15px; font-weight: 600;
  box-shadow: 0 4px 12px rgba(47, 107, 255, 0.4);
  cursor: pointer;
}

/* 表单 */
.form label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
.form label .req { color: var(--danger); margin-left: 2px; }
.form input, .form select, .form textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; font-family: inherit; background: #f8fafd;
  outline: none;
}
.form input:focus, .form select:focus, .form textarea:focus { border-color: var(--primary); background: #fff; }
.form textarea { min-height: 72px; resize: vertical; }
.form .readonly {
  background: #eef2f8; color: var(--muted);
  border: 1px dashed #c3cddd;
}
.form .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form .hint.err { color: var(--danger); }

/* 按钮 */
.btn {
  display: inline-block; border: none; border-radius: 10px;
  padding: 11px 16px; font-size: 15px; font-weight: 600;
  background: var(--primary); color: #fff; cursor: pointer;
  text-align: center;
}
.btn.block { display: block; width: 100%; }
.btn.plain { background: var(--primary-weak); color: var(--primary); }
.btn.ok { background: var(--ok-weak); color: var(--ok); }
.btn.danger { background: var(--danger-weak); color: var(--danger); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: 0.5; }
.btn + .btn { margin-left: 8px; }

/* 筛选 chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; }
.chip {
  flex: none; font-size: 13px; padding: 6px 12px;
  border-radius: 999px; background: var(--card); color: var(--muted);
  border: 1px solid var(--line); cursor: pointer;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* 时间线 */
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 14px; }
.tl-item::before {
  content: ""; position: absolute; left: -17px; top: 6px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary);
}
.tl-item.ok::before { background: var(--ok); }
.tl-item.gray::before { background: #c3c9d2; }
.tl-item .tl-head { font-weight: 600; font-size: 14px; }
.tl-item .tl-time { font-size: 12px; color: var(--muted); margin-left: 6px; font-weight: 400; }
.tl-item .tl-body { font-size: 13px; color: var(--muted); margin-top: 3px; white-space: pre-wrap; }

/* 统计表格 */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 9px 6px; border-bottom: 1px solid var(--line); text-align: center; }
.table th { color: var(--muted); font-weight: 500; font-size: 12px; }
.table td:first-child, .table th:first-child { text-align: left; }
.table .rate { font-weight: 700; color: var(--primary); }

/* 登录页 */
.login { max-width: 400px; margin: 0 auto; padding: 40px 20px; text-align: center; }
.login .login-logo { width: 190px; max-width: 64%; margin: 0 auto 6px; display: block; }
.login .login-code { font-size: 12px; font-weight: 700; letter-spacing: 3px; color: var(--muted); margin-bottom: 12px; }
.login h1 { font-size: 20px; margin: 0 0 4px; }
/* 成员网格（登录选身份 / 设置页切换岗位共用） */
.mgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.mcell {
  background: var(--card); border-radius: 12px; padding: 12px 4px;
  box-shadow: var(--shadow); cursor: pointer; border: 1px solid transparent;
}
.mcell:active { border-color: var(--primary); }
.mcell.current { border-color: var(--primary); background: var(--primary-weak); cursor: default; }
.mcell .face {
  width: 44px; height: 44px; border-radius: 50%; margin: 0 auto 6px;
  background: var(--primary-weak); color: var(--primary);
  font-size: 18px; font-weight: 600; line-height: 44px;
}
.mcell.current .face { background: var(--primary); color: #fff; }
.mcell .nm { font-size: 14px; font-weight: 600; }
.mcell .rl { font-size: 11px; color: var(--muted); }

/* 设置页 */
.kv { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); }
.envwarn {
  background: var(--warn-weak); color: var(--warn);
  border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px;
}
.empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 14px; }
.empty .ico { font-size: 36px; display: block; margin-bottom: 8px; }

/* 跟踪看板：横向阶段色块（无需滑动） + 明细列表 */
.seg-bar { display: flex; gap: 4px; margin-bottom: 12px; }
.seg {
  flex: 1; min-width: 0; border: 2px solid transparent;
  border-radius: 8px; padding: 8px 2px; text-align: center;
  cursor: pointer; font-family: inherit; line-height: 1.25;
}
.seg .sn { font-size: 10px; font-weight: 600; display: block; word-break: break-all; }
.seg .sc { font-size: 14px; font-weight: 700; display: block; margin-top: 2px; }
.seg.sel { border-color: var(--text); box-shadow: 0 2px 8px rgba(30, 64, 120, 0.25); }

/* toast */
.toast {
  position: fixed; bottom: 110px; left: 50%; transform: translateX(-50%);
  background: rgba(23, 42, 74, 0.92); color: #fff;
  padding: 10px 18px; border-radius: 10px; font-size: 14px;
  z-index: 99; max-width: 80vw; text-align: center;
}

