/* ===================== 秩序巡逻打卡 · 公共样式 ===================== */
:root {
  --primary: #6d5efc;
  --primary-2: #8b7bff;
  --bg: #f4f5fb;
  --bg-soft: #ffffff;
  --text: #1a1c2b;
  --muted: #8b90a8;
  --border: #e7e9f3;
  --ok: #10b981;
  --err: #ef4444;
  --warn: #f59e0b;
  --shadow: 0 1px 2px rgba(24, 26, 38, .05), 0 12px 32px -10px rgba(24, 26, 38, .12);
  --shadow-sm: 0 1px 2px rgba(24, 26, 38, .04), 0 6px 18px -8px rgba(24, 26, 38, .1);
  --shadow-lift: 0 10px 30px -12px rgba(109, 94, 252, .35);
}

* { box-sizing: border-box; }

/* hidden 属性必须优先于任何 display 规则（否则 .lightbox / #cam / .loc-manual 等会漏出来） */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 480px at 8% -10%, color-mix(in srgb, var(--primary) 7%, transparent), transparent 60%),
    radial-gradient(900px 400px at 100% 0%, color-mix(in srgb, var(--primary-2) 5%, transparent), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 按钮 ---------- */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; border: none; border-radius: 12px; padding: 11px 18px;
  font-weight: 600; font-size: 15px; cursor: pointer;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 6px 18px -6px rgba(109, 94, 252, .5);
  transition: transform .12s, filter .12s;
}
.btn-primary:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-ghost {
  background: transparent; border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 8px 14px; cursor: pointer; font-size: 14px; transition: background .12s;
}
.btn-ghost:hover { background: var(--bg); }
.block { display: block; width: 100%; }
.lg { padding: 14px; font-size: 16px; }
.sm { padding: 6px 10px; font-size: 13px; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.field input, .field textarea, .field select {
  font-weight: 400; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font-size: 15px; font-family: inherit; background: #fff; color: var(--text);
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}
.field textarea { min-height: 84px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.form-msg { font-size: 13px; margin-top: 6px; }
.form-msg.err { color: var(--err); }
.form-msg.ok { color: var(--ok); }
.muted { color: var(--muted); }
.sm, .muted.sm { font-size: 13px; }

/* ---------- 登录卡片 ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card {
  width: 100%; max-width: 360px; background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: 20px; padding: 28px; box-shadow: var(--shadow);
}
.brand-lg { font-size: 22px; font-weight: 800; text-align: center; margin-bottom: 6px; }
.center { text-align: center; }
.auth-card .field { margin-bottom: 12px; }

/* ---------- 巡逻员端布局 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: color-mix(in srgb, var(--bg-soft) 80%, transparent);
  backdrop-filter: blur(14px); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; }
.top-right { display: flex; align-items: center; gap: 10px; }
.who { font-size: 14px; color: var(--muted); }
.shift-badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: color-mix(in srgb, var(--warn) 16%, transparent); color: #b45309;
}
.shift-badge.shift-night { background: color-mix(in srgb, #6366f1 16%, transparent); color: #4338ca; }

.home { padding: 14px; max-width: 760px; margin: 0 auto; }
.sec-row { display: flex; align-items: baseline; justify-content: space-between; margin: 16px 2px 8px; }
.sec-title { font-size: 16px; margin: 14px 2px 8px; }

.map-box { width: 100%; height: 280px; border-radius: 16px; overflow: hidden; background: #eef1fb; box-shadow: var(--shadow); margin-bottom: 14px; }
.map-box.sm { height: 200px; }
.map-status { margin: -8px 0 12px; font-size: 13px; }
.map-status.err { color: var(--err); }
.map-fallback {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; color: var(--muted); padding: 20px; line-height: 1.6;
  background: linear-gradient(135deg, #eef1fb, #f7f8ff);
}

/* 实时定位状态条（巡逻端首页）：圆点脉冲表示正在跟踪 */
.loc-live {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: -6px 0 12px; padding: 9px 12px; font-size: 13px; line-height: 1.5;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 12px; color: var(--muted); box-shadow: var(--shadow-sm);
}
.loc-live .dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: #2b7cff; position: relative; }
.loc-live.live .dot::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid rgba(43, 124, 255, .45); animation: locPulse 1.6s ease-out infinite;
}
@keyframes locPulse { 0% { transform: scale(.55); opacity: .9; } 100% { transform: scale(1.7); opacity: 0; } }
.loc-live b { color: var(--text); }
.loc-live.err { color: var(--err); border-color: color-mix(in srgb, var(--err) 35%, var(--border)); }
.loc-live.err .dot { background: var(--err); }
@media (prefers-reduced-motion: reduce) { .loc-live.live .dot::after { animation: none; } }

/* ---------- 地址搜索选点 ---------- */
.geo-search { display: flex; gap: 10px; margin-bottom: 10px; }
.geo-search input {
  flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 13px; font-size: 14px; background: var(--bg-soft); color: var(--text);
}
.geo-search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent); }
.geo-search .btn-primary { flex: 0 0 auto; }
.geo-results {
  border: 1px solid var(--border); border-radius: 14px; background: var(--bg-soft);
  box-shadow: var(--shadow-sm); margin-bottom: 12px; overflow: hidden;
}
.geo-hd { padding: 10px 13px; font-size: 13px; color: var(--muted); background: var(--bg-soft); border-bottom: 1px solid var(--border); }
.geo-hint { padding: 0 13px 11px; font-size: 13px; color: var(--muted); }
.geo-list { max-height: 260px; overflow-y: auto; }
.geo-item {
  display: flex; align-items: flex-start; gap: 9px; width: 100%; text-align: left;
  padding: 10px 13px; border: 0; border-bottom: 1px solid var(--border);
  background: transparent; color: var(--text); font: inherit; cursor: pointer;
}
.geo-item:last-child { border-bottom: 0; }
.geo-item:hover, .geo-item:focus-visible { background: color-mix(in srgb, var(--primary) 8%, transparent); outline: none; }
.gi-ico { flex: 0 0 auto; line-height: 1.5; }
.gi-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gi-txt b { font-size: 14px; font-weight: 600; }
.gi-txt i { font-style: normal; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.coords-manual { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; margin-bottom: 8px; }
.coords-manual label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.coords-manual input { font-weight: 400; border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; font-size: 14px; width: 100%; }
.coords-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
/* 蓝色「我的位置」标记，区别于红色点位标记 */
.me-dot { width: 16px; height: 16px; border-radius: 50%; background: #2b7cff; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(43,124,255,.55); }
/* 定位/跟随按钮激活态 */
.btn-primary.active, .btn-ghost.active { background: #0a8f6b; color: #fff; border-color: #0a8f6b; }

.point-list { display: grid; gap: 10px; }
.point-card {
  display: block; position: relative; background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px; text-decoration: none; color: var(--text); box-shadow: var(--shadow-sm);
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.point-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: color-mix(in srgb, var(--primary) 30%, transparent); }
.pc-name { font-weight: 600; font-size: 15px; }
.pc-addr { margin-top: 4px; font-size: 13px; }
.pc-flag { position: absolute; top: 14px; right: 14px; font-size: 12px; color: var(--muted); }

/* ---------- 打卡页 ---------- */
.checkin { padding: 14px; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.point-head { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 14px; padding: 14px; box-shadow: var(--shadow-sm); }
.point-name { font-size: 18px; font-weight: 700; }
.need-loc { margin-top: 6px; font-size: 13px; color: var(--primary); }
.need-loc.off { color: var(--muted); }
.cam-box, .loc-box { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 14px; padding: 14px; box-shadow: var(--shadow-sm); }
#cam, #preview { width: 100%; border-radius: 10px; background: #000; display: block; }
.cam-hint { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.cam-actions { display: flex; gap: 10px; margin-top: 10px; }
.loc-info { margin-top: 10px; font-size: 14px; }
.blur-warn { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 9px 11px;
  background: color-mix(in srgb, var(--err) 12%, var(--bg-soft)); border: 1px solid color-mix(in srgb, var(--err) 45%, transparent);
  border-radius: 10px; color: var(--err); font-size: 13px; font-weight: 600; }
.blur-warn a { color: var(--err); text-decoration: underline; white-space: nowrap; }

/* 整屏相机：点「打开摄像头」后视频铺满整个屏幕，底部浮出拍照/取消工具栏 */
body.cam-open { overflow: hidden; }
/* 2026-09-23：object-fit 由 cover 改 contain —— 取景要「跟手机自带相机一样宽」，
   cover 会把 4:3 的画面按屏幕比例裁掉左右（本机最多裁掉近 4 成宽），巡逻员看到的
   比实际拍到的窄，正是「巡逻相机比手机相机窄」的第二个原因。contain 显示完整画幅。 */
body.cam-open #cam {
  position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; height: 100dvh;
  object-fit: contain; z-index: 60; background: #000; border-radius: 0; display: block;
  border: none;
}
.cam-toolbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61;
  display: flex; gap: 14px; justify-content: center; align-items: center; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0,0,0,.55), rgba(0,0,0,0));
}
.cam-toolbar .round { min-width: 84px; padding: 14px 22px; font-size: 16px; border-radius: 999px; }
.cam-toolbar .btn-ghost.round { background: rgba(255,255,255,.85); color: #222; border-color: rgba(255,255,255,.85); }
/* 整屏相机提示：点屏幕任意处即拍照（2026-09-21 取消了单独的拍照按钮） */
.cam-toolbar .cap-hint { color: #fff; font-size: 14px; font-weight: 600; text-shadow: 0 1px 4px rgba(0,0,0,.6); }

/* 整屏相机：顶部镜头切换条（2026-09-23）——自动识别不到超广角的机型靠它手动切。
   pointer-events:none 让渐变区仍可「点屏幕拍照」，只有 chips 本身在接事件。 */
.cam-lensbar { position: fixed; left: 0; right: 0; top: 0; z-index: 62; pointer-events: none;
  padding: calc(8px + env(safe-area-inset-top)) 10px 26px;
  background: linear-gradient(to bottom, rgba(0,0,0,.58), rgba(0,0,0,0)); }
.lens-chips { display: flex; gap: 8px; overflow-x: auto; pointer-events: auto;
  padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.lens-chips::-webkit-scrollbar { display: none; height: 0; }
.lens-chip { flex: 0 0 auto; border: 1px solid rgba(255,255,255,.45); background: rgba(0,0,0,.4);
  color: #fff; font-size: 13px; font-weight: 600; padding: 7px 13px; border-radius: 999px;
  line-height: 1; white-space: nowrap; }
.lens-chip.on { background: #fff; color: #111; border-color: #fff; }
.lens-chip .lc-tag { font-size: 11px; opacity: .8; margin-left: 4px; }
.lens-chip.on .lc-tag { opacity: .65; }
.lens-info { margin-top: 6px; pointer-events: none; color: rgba(255,255,255,.88); font-size: 11.5px;
  text-shadow: 0 1px 3px rgba(0,0,0,.75); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes shake-pic { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-8px)} 40%{transform:translateX(8px)} 60%{transform:translateX(-5px)} 80%{transform:translateX(5px)} }
#preview.shake { animation: shake-pic .5s ease; }

/* 打卡说明（现场打卡页） */
.checkin-tip { background: color-mix(in srgb, var(--primary) 8%, var(--bg-soft)); border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border));
  border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; font-size: 13.5px; color: #2b3340; line-height: 1.4; }
.checkin-tip b { color: var(--primary); }
.checkin-tip ul { margin: 6px 0 0; padding-left: 20px; }
.checkin-tip li { margin: 3px 0; }

/* 照片槽位网格（最多 3 张，至少 2 张方可提交打卡）
   2026-09-21：槽位缩小一半（约 86px 见方），改为「单元大堂 / 周边道路 / 周边卫生」三格 */ 
.photo-grid { display: grid; grid-template-columns: repeat(3, 86px); gap: 12px; margin-top: 12px; justify-content: center; }
.photo-slot { position: relative; width: 86px; height: 86px; border: 2px dashed var(--border); border-radius: 12px;
  background: var(--bg-soft); display: flex; align-items: center; justify-content: center; overflow: hidden;
  cursor: pointer; transition: border-color .15s, background .15s; }
.photo-slot.empty:hover { border-color: var(--primary); }
.photo-slot.filled { border-style: solid; border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.photo-slot .ph-label { color: var(--muted); font-size: 12px; font-weight: 600; pointer-events: none; text-align: center; line-height: 1.25; padding: 0 4px; }
.photo-slot .ph-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-slot .ph-cap { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.55); color: #fff;
  font-size: 10.5px; line-height: 1.5; text-align: center; pointer-events: none; }
.photo-slot .ph-del { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border: none; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; font-size: 12px; line-height: 20px; text-align: center; cursor: pointer; padding: 0; z-index: 2; }
.photo-tip { margin-top: 8px; font-size: 12.5px; color: var(--muted); text-align: center; }

/* 照片槽位：人员督勤点位固定类型（人员照/督勤表/周边照/卫生，2026-09-22 起人形识别已取消、人员照仍上传）
   4 列自适应宽度（原来固定 86px，4 个会撑破手机屏） */
.photo-grid.fixed4 { grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; }
.photo-grid.fixed4 .photo-slot { width: 100%; height: auto; aspect-ratio: 1 / 1; }
.photo-slot.verified { border-style: solid; border-color: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 16%, transparent); }
.photo-slot.verified::after { content: "✓"; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--ok); color: #fff; font-size: 12px; line-height: 20px; text-align: center; z-index: 2; }
.photo-slot.checking { border-style: solid; border-color: var(--primary); animation: phPulse 1s ease-in-out infinite; }
@keyframes phPulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
.photo-slot.ph-fail { border-style: solid; border-color: var(--err); animation: phShake .32s ease 2; }
@keyframes phShake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }

/* 人员照自动识别结果提示条（识别中 / 已识别 / 未通过 / 组件加载失败） */
.pc-hint { margin-top: 8px; padding: 9px 12px; border-radius: 10px; font-size: 12.5px; line-height: 1.55;
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--muted); text-align: center; }
.pc-hint.loading { color: #6d28d9; background: color-mix(in srgb, var(--primary) 8%, var(--bg-soft));
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.pc-hint.ok { color: #047857; background: color-mix(in srgb, var(--ok) 10%, var(--bg-soft));
  border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }
.pc-hint.err { color: var(--err); background: color-mix(in srgb, var(--err) 9%, var(--bg-soft));
  border-color: color-mix(in srgb, var(--err) 45%, var(--border)); }

/* 同点位二次打卡等待提示（打卡页） */
.recheck-tip { padding: 11px 13px; border-radius: 12px; font-size: 13px; line-height: 1.6;
  background: color-mix(in srgb, var(--warn) 14%, var(--bg-soft));
  border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--border)); color: #92400e; }
.recheck-tip b { color: #b45309; }

/* 首页：新任务弹窗提醒 + 滚动刷新提示 */
.task-alert-mask { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; padding: 24px; }
.task-alert { width: 100%; max-width: 340px; background: var(--bg-soft); border-radius: 18px; padding: 22px 20px;
  text-align: center; box-shadow: 0 18px 50px rgba(0,0,0,.3); animation: pop .25s ease; }
@keyframes pop { from{transform:scale(.9);opacity:0} to{transform:scale(1);opacity:1} }
.task-alert .ta-ico { font-size: 40px; }
.task-alert .ta-title { font-size: 17px; font-weight: 800; margin: 6px 0 4px; }
.task-alert .ta-name { color: var(--primary); font-weight: 700; font-size: 16px; margin-bottom: 16px; word-break: break-all; }
.task-alert .ta-left { font-size: 13px; color: var(--muted); margin: -8px 0 14px; }
.task-alert .ta-actions { display: flex; gap: 10px; }
.task-alert .ta-actions .btn-primary, .task-alert .ta-actions .btn-ghost { flex: 1; padding: 12px; font-size: 15px; }
.task-alert .ta-actions .btn-primary { background: #0a8f6b; border-color: #0a8f6b; color: #fff; }
.refresh-tip { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 70;
  background: rgba(30,41,59,.9); color: #fff; font-size: 13px; padding: 8px 16px; border-radius: 999px;
  opacity: 0; transition: opacity .25s; pointer-events: none; }
.refresh-tip.show { opacity: 1; }
.loc-info.ok { color: var(--ok); }
.loc-info.warn { color: var(--warn); }
.loc-info.err { color: var(--err); }
.loc-manual { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.loc-manual-row { display: flex; gap: 8px; }
.loc-manual-row input { flex: 1; min-width: 0; padding: 9px 10px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; background: #fff; }
.link-btn { align-self: flex-start; background: none; border: none; color: var(--primary); font-size: 13px; padding: 4px 0; cursor: pointer; text-decoration: underline; }
.success-box { text-align: center; padding: 40px 20px; }
.success-box .muted { margin: 10px 0 18px; }

/* 后台「🛰️ 实时定位」：地图上以姓名气泡显示巡逻员位置 */
.live-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.live-layout .map-box { height: 460px; margin-bottom: 0; }
.live-list { min-width: 0; }
.live-pin {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 3px 9px; border-radius: 10px; font-size: 12px; font-weight: 700; line-height: 1.25;
  white-space: nowrap; box-shadow: 0 2px 8px rgba(0, 0, 0, .22);
}
.live-pin .lp-sub { font-size: 10px; font-weight: 600; opacity: .85; }
.live-pin.on { background: #10b981; color: #fff; }
.live-pin.off { background: #9ca3af; color: #fff; }
.pt-pin { width: 14px; height: 14px; border-radius: 50%; background: #6d5efc; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(109,94,252,.5); }
.badge-on { color: #047857; font-weight: 700; }
.badge-off { color: #6b7280; font-weight: 600; }
/* 轨迹回放（2026-09-22）：点姓名查看当日行走轨迹 */
.track-name { color: inherit; text-decoration: none; border-bottom: 1px dashed transparent; cursor: pointer; }
.track-name:hover b, .track-name:focus b { color: var(--primary, #6d5efc); border-bottom: 1px dashed currentColor; }
.track-panel {
  border: 1px solid var(--line, #e5e7eb); border-radius: 12px;
  padding: 10px 12px; margin: 0 0 10px; background: var(--card, #fff);
}
.track-panel .tp-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.track-panel .tp-head input[type="date"] { padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line, #e5e7eb); }
.track-panel .tp-head .btn-ghost { padding: 4px 10px; }
.track-endpin {
  width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
.track-endpin.s { background: #10b981; }
.track-endpin.e { background: #3b6cf6; }
@media (max-width: 900px) {
  .live-layout { grid-template-columns: 1fr; }
  .live-layout .map-box { height: 320px; }
}

/* ---------- 聊天室语音通话（2026-09-21）：来电响铃 / 通话条 / 选人面板 ---------- */
.call-ring { position: fixed; inset: 0; z-index: 200; background: rgba(15, 23, 42, .62);
  display: flex; align-items: center; justify-content: center; padding: 22px; }
.cr-card { width: 100%; max-width: 320px; background: #fff; border-radius: 20px; padding: 26px 20px 20px;
  text-align: center; box-shadow: 0 20px 55px rgba(0, 0, 0, .35); animation: pop .25s ease; }
.cr-avatar { font-size: 42px; line-height: 1; animation: crShake .9s ease-in-out infinite; }
@keyframes crShake { 0%,100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }
@media (prefers-reduced-motion: reduce) { .cr-avatar { animation: none; } }
.cr-title { font-size: 14px; color: var(--muted); margin-top: 8px; }
.cr-name { font-size: 21px; font-weight: 800; margin: 4px 0 2px; word-break: break-all; }
.cr-sub { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.cr-actions { display: flex; gap: 12px; }
.cr-btn { flex: 1; border: none; border-radius: 999px; padding: 13px 0; font-size: 15.5px; font-weight: 700; cursor: pointer; }
.cr-btn.no { background: #f1f3f5; color: #444; }
.cr-btn.yes { background: #10b981; color: #fff; }

.call-bar { position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 190;
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px;
  background: rgba(17, 24, 39, .93); color: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.cb-dot { width: 9px; height: 9px; border-radius: 50%; background: #34d399; animation: locPulse2 1.4s infinite; flex: 0 0 auto; }
@keyframes locPulse2 { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .6); } 100% { box-shadow: 0 0 0 10px rgba(52, 211, 153, 0); } }
.cb-text { flex: 1 1 auto; min-width: 0; font-size: 13.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cb-text em { font-style: normal; color: #a7f3d0; font-variant-numeric: tabular-nums; }
.cb-btn { flex: 0 0 auto; border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.12);
  color: #fff; font-size: 13px; padding: 7px 12px; border-radius: 999px; cursor: pointer; }
.cb-btn.on { background: #f59e0b; border-color: #f59e0b; color: #fff; }
.cb-btn.hang { background: #ef4444; border-color: #ef4444; font-weight: 700; }
.call-flash { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 195;
  background: rgba(30, 41, 59, .92); color: #fff; font-size: 13px; padding: 8px 16px; border-radius: 999px;
  opacity: 0; transition: opacity .25s; pointer-events: none; }
.call-flash.show { opacity: 1; }

.cp-body { max-height: 60vh; overflow-y: auto; }
.cp-all { width: 100%; border: 1px solid color-mix(in srgb, var(--primary) 40%, var(--border));
  background: color-mix(in srgb, var(--primary) 10%, #fff); color: var(--primary);
  font: inherit; font-size: 14.5px; font-weight: 700; padding: 12px; border-radius: 12px; cursor: pointer; }
.cp-list { margin-top: 10px; display: grid; gap: 6px; }
.cp-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; font: inherit;
  padding: 10px 12px; border: 1px solid var(--border); background: #fff; border-radius: 12px; cursor: pointer; }
.cp-item:hover { border-color: var(--primary); }
.cp-avatar { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; background: color-mix(in srgb, var(--primary) 14%, #fff);
  color: var(--primary); font-weight: 700; text-align: center; line-height: 32px; }
.cp-name { flex: 1 1 auto; min-width: 0; font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-go { flex: 0 0 auto; font-size: 13px; color: var(--primary); font-weight: 700; }

/* ---------- 后台布局 ---------- */
.admin { background: var(--bg); }
.admin-top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: color-mix(in srgb, var(--bg-soft) 85%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border);
}
.admin-top .brand { font-weight: 700; }
.admin-top .sub { color: var(--muted); font-weight: 500; font-size: 13px; }
/* 顶栏单位名（2026-09-26）：显示在顶栏中部，替换原先挤在「后台」旁的小徽标，更显眼 */
.admin-top .top-tenant {
  margin-left: auto; font-size: 18px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 40vw;
}
.admin-top .top-right { margin-left: auto; }
@media (max-width: 640px) { .admin-top .top-tenant { font-size: 15px; max-width: 34vw; } }
.menu-toggle { display: none; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text); }
.admin-layout { display: flex; align-items: flex-start; }
.admin-side {
  width: 200px; flex: 0 0 200px; padding: 16px 10px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 53px; height: calc(100vh - 54px);   /* ⚠️ 高度按顶栏实际 54px 算，少 1px 也会让整页 scrollHeight 超出一屏 */
}
.side-item { padding: 11px 14px; border-radius: 10px; text-decoration: none; color: var(--text); font-size: 14px; transition: background .12s; }
.side-item:hover { background: var(--bg); }
.side-item.active { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); font-weight: 600; }
.admin-main { flex: 1; padding: 20px; min-width: 0; }
.page-title { font-size: 20px; margin: 0 0 14px; }

/* ---------- 卡片 / 表格 ---------- */
.card { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 16px; padding: 16px; box-shadow: var(--shadow-sm); }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-sm); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table.compact th, .table.compact td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.table.compact th { background: var(--bg); color: var(--muted); font-weight: 600; font-size: 13px; }
.table.compact tr:last-child td { border-bottom: none; }
.table.compact tbody tr:hover { background: color-mix(in srgb, var(--primary) 4%, transparent); }
.op-bar { display: flex; gap: 6px; flex-wrap: wrap; }
.op { border: 1px solid var(--border); background: var(--bg-soft); border-radius: 8px; padding: 5px 9px; font-size: 13px; cursor: pointer; color: var(--text); transition: background .12s; }
.op:hover { background: var(--bg); }
.op-xs { font-size: 12px; padding: 2px 6px; }   /* 行内小按钮（如任务改名 ✏️） */

/* ---------- 任务页双栏（2026-09-28）：左「部门任务」右「点位任务规则」；窄屏回退上下堆叠 ---------- */
.tasks-duo { display: flex; gap: 16px; align-items: stretch; }
.tasks-duo > .card-l { width: 58%; min-width: 460px; flex: none; margin-bottom: 16px; }
.tasks-duo > .card-r { flex: 1; min-width: 360px; margin-bottom: 16px; }
@media (max-width: 1180px) {
  .tasks-duo { flex-direction: column; }
  .tasks-duo > .card-l { width: auto; }
}
/* 部门任务详情弹窗（2026-09-28）：卡面仅 任务/部门/周期，详情收进弹窗 */
.dept-row { cursor: pointer; }
.dept-row:hover { background: color-mix(in srgb, var(--primary) 6%, transparent); }

/* ---------- 概览页部门统计两栏并排（2026-09-28晚）：左「部门当日」右「部门当月」；窄屏回退上下堆叠 ---------- */
.dept-duo { display: flex; gap: 16px; align-items: flex-start; }
.dept-duo > .dept-col { flex: 1 1 50%; min-width: 0; }
@media (max-width: 1180px) {
  .dept-duo { flex-direction: column; }
}

/* ---------- 彩蛋配置面板左右两栏（2026-09-28晚）：左=日期/文案，右=启用开关+数量 ---------- */
.egg-duo { display: flex; gap: 28px; align-items: flex-start; }
.egg-duo .egg-l { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.egg-duo .egg-l label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.egg-duo .egg-l input { font-weight: 400; border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; font-size: 14px; }
.egg-duo .egg-r { flex: none; width: 200px; display: flex; flex-direction: column; gap: 14px; }
.egg-duo .egg-check { font-weight: 600; margin-top: 22px; }
.egg-duo .egg-num { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.egg-duo .egg-num input { font-weight: 400; border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; font-size: 14px; width: 100%; box-sizing: border-box; }
@media (max-width: 760px) {
  .egg-duo { flex-direction: column; gap: 12px; }
  .egg-duo .egg-r { width: auto; }
  .egg-duo .egg-check { margin-top: 0; }
}
/* 指定必中人员多选（2026-09-29） */
.egg-assign { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; margin-top: 14px; }
.egg-assign-sel { font-weight: 400; border: 1px solid var(--border); border-radius: 10px; padding: 8px; font-size: 14px; width: 100%; box-sizing: border-box; min-height: 110px; background: var(--bg-soft); }
.egg-assign-sel:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 概览页最近打卡（左）+ 巡逻彩蛋（右）两栏并排（2026-09-28晚）；监督员无彩蛋时左栏占满；窄屏回退 ---------- */
.recent-egg-duo { display: flex; gap: 16px; align-items: flex-start; }
.recent-egg-duo > .recent-col { flex: 1.1 1 0; min-width: 0; }
.recent-egg-duo > .egg-col { flex: 1 1 0; min-width: 0; }
.recent-egg-duo .egg-col .egg-duo { gap: 14px; }
.recent-egg-duo .egg-col .egg-r { width: 150px; }
@media (max-width: 1180px) {
  .recent-egg-duo { flex-direction: column; }
}
.dd-row { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.dd-row:last-child { border-bottom: none; }
.dd-k { flex: none; width: 118px; color: var(--muted); }
.dd-v { flex: 1; min-width: 0; word-break: break-all; }
.op.danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 30%, transparent); }
.op.mini { padding: 3px 7px; border-radius: 6px; font-size: 12px; }

/* 巡逻员账号：明文密码展示 */
.col-pwd { white-space: nowrap; }
.pwd-val {
  display: inline-block; margin-right: 6px; padding: 3px 9px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px; letter-spacing: .3px;
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  border: 1px dashed color-mix(in srgb, var(--primary) 32%, transparent);
  border-radius: 7px;
  -webkit-user-select: all; user-select: all;
}
.pwd-head { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.pwd-head b { color: var(--primary); }
.fill-result { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.fill-row { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.fill-user { min-width: 160px; color: var(--muted); }

.shift-tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.shift-tag.s-day { background: color-mix(in srgb, var(--warn) 16%, transparent); color: #b45309; }
.shift-tag.s-night { background: color-mix(in srgb, #6366f1 16%, transparent); color: #4338ca; }
/* 账号列表里的「班次」下拉：外观对齐 .shift-tag，选中即保存 */
.shift-sel { padding: 3px 6px; border-radius: 999px; font-size: 12px; line-height: 1.5;
  border: 1px solid rgba(0, 0, 0, .1); background: #fff; color: inherit; cursor: pointer; }
.shift-sel.s-day { background: color-mix(in srgb, var(--warn) 16%, transparent); color: #b45309; border-color: transparent; }
.shift-sel.s-night { background: color-mix(in srgb, #6366f1 16%, transparent); color: #4338ca; border-color: transparent; }
.shift-sel:disabled { opacity: .6; cursor: progress; }
/* 账号列表里的「部门」下拉（2026-09-28）：外观对齐班次下拉，已分配显淡青、未分配灰 */
.dept-sel { padding: 3px 6px; border-radius: 999px; font-size: 12px; line-height: 1.5;
  border: 1px solid rgba(0, 0, 0, .1); background: #fff; color: inherit; cursor: pointer; }
.dept-sel.d-on { background: color-mix(in srgb, #0ea5e9 14%, transparent); color: #0369a1; border-color: transparent; }
.dept-sel:disabled { opacity: .6; cursor: progress; }
/* 账号列表里的「姓名」输入框：外观像纯文本，悬停/聚焦才显出可编辑（选中即保存，同班次下拉） */
.name-inp { width: 104px; max-width: 100%; padding: 4px 6px; font-size: 14px; font-family: inherit;
  color: var(--text); background: transparent; border: 1px dashed transparent; border-radius: 8px; }
.name-inp:hover { border-color: var(--border); background: var(--bg-soft); }
.name-inp:focus { outline: none; border-color: var(--primary); border-style: solid;
  background: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent); }
.name-inp:disabled { opacity: .6; cursor: progress; }
.name-inp.err { border-color: var(--err); border-style: solid; background: color-mix(in srgb, var(--err) 8%, transparent); }
/* 单点位规则面板：白班/夜班/全天 快捷按钮 */
.shift-quick { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.shift-quick .op { font-size: 12px; padding: 4px 8px; }

/* ---------- 点位任务规则编辑器（① 选点位 ② 选班次 ③ 每日/每周 ④ 保存即下发）---------- */
.rp-block { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; background: #fff; }
.rp-hd { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; margin-bottom: 10px; min-width: 0; }
.rp-no { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px;
  border-radius: 50%; background: var(--primary); color: #fff; font-size: 12px; font-weight: 700; flex: none; }
.rp-hd .op { font-size: 12px; padding: 3px 8px; }
/* 2026-09-28：任务配置弹窗「周期」与「保存并下发」左右双列（周期左、选项+按钮右） */
.bk-period-row { display: flex; gap: 22px; align-items: flex-start; }
.bk-period-l { flex: 1 1 46%; min-width: 0; }
.bk-period-r { flex: 1 1 54%; min-width: 0; border-left: 1px dashed var(--border); padding-left: 22px; }
.bk-period-r .check { display: flex; align-items: flex-start; gap: 7px; margin-bottom: 7px; font-size: 13px; }
.bk-period-r .check input { margin-top: 3px; flex: none; }
@media (max-width: 900px) {
  .bk-period-row { flex-direction: column; gap: 12px; }
  .bk-period-r { border-left: 0; padding-left: 0; }
}
/* ① 点位多选：横向流式排列（胶囊式，自动换行） */
/* 2026-09-28：执行点位改为单条横向展示——每个点位独占一行，名称/徽章/地址横向排开 */
.pts-grid { display: flex; flex-direction: column; gap: 6px;
  max-height: 260px; overflow: auto; padding: 2px; }
.pt-item { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; min-width: 0;
  width: 100%; max-width: none; padding: 7px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: #fbfbfd; cursor: pointer; }
.pt-item:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, #fff); }
.pt-item input { margin-top: 0; flex: none; }
.pt-n { font-size: 13px; font-weight: 600; flex: none; white-space: nowrap; }
.pt-a { font-size: 11px; color: var(--muted); flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* ③ 星期选择 */
.wd-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.wd-chips .op { font-size: 12px; padding: 3px 8px; }
.wd { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border: 1px solid var(--border);
  border-radius: 999px; font-size: 13px; cursor: pointer; background: #fff; }
.wd:has(input:checked) { border-color: var(--primary); background: var(--primary); color: #fff; font-weight: 600; }
.wd input { margin: 0; }
@media (max-width: 560px) {
  .rp-block { padding: 10px; }
  /* 2026-09-28 移除：.pts-grid 已改 flex 单列横向条目，grid-template-columns 无效 */
}

/* ---------- 🎯 一键配置：弹窗式编辑器 ---------- */
.modal-mask { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: flex-start;
  justify-content: center; padding: 4vh 16px; overflow-y: auto;
  background: rgba(15, 23, 42, .48); backdrop-filter: blur(2px); }
.modal-box { background: #fff; border-radius: 16px; width: 720px; max-width: 100%;
  max-height: 92vh; overflow-y: auto; padding: 16px 18px 14px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, .30); animation: modalIn .18s ease-out; }
@keyframes modalIn { from { transform: translateY(14px) scale(.98); opacity: 0; }
  to { transform: none; opacity: 1; } }
.pwd-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.modal-x { margin-left: auto; flex: none; border: none; background: #f1f5f9; color: #475569;
  width: 30px; height: 30px; border-radius: 8px; font-size: 17px; line-height: 1;
  cursor: pointer; }
.modal-x:hover { background: #e2e8f0; color: #0f172a; }
@media (max-width: 560px) {
  .modal-mask { padding: 2vh 10px; }
  .modal-box { padding: 14px 12px 12px; }
}

/* 2026-09-28：「任务配置」弹窗改为半屏（右侧抽屉，占屏幕一半宽、满高，内部滚动） */
/* 2026-09-28：「任务配置」弹窗 = 满屏缩小一半、水平居中（宽 50vw、满高、左右留白对称） */
/* 2026-09-28：弹窗高度随内容自适应（消除底部白条），四周留 4vh 不贴边，圆角恢复 */
#bulkModal.modal-mask { padding: 4vh 0; align-items: center; justify-content: center; }
#bulkPanel.modal-box { width: 50vw; max-width: 50vw; height: auto; max-height: 92vh;
  border-radius: 14px; padding: 20px 28px; margin: 0; overflow: auto; }

/* 顶栏聊天室入口（原右下悬浮球已移到顶栏右上角） */
.chat-link { font-size: 15px; line-height: 1; padding: 4px 10px; text-decoration: none; white-space: nowrap; }
/* 聊天室未读角标：首页图标右上角显示还有多少条没看，进聊天室看完即消失 */
.chat-link { position: relative; }
.chat-badge {
  position: absolute; top: -4px; right: -4px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: #ef4444; color: #fff; font-size: 11px; font-weight: 700;
  line-height: 17px; text-align: center; box-shadow: 0 0 0 2px var(--bg-soft);
}
.chat-link.has-unread { color: #ef4444; font-weight: 700; }

/* 首页底部中间：「更新内容」= 手动刷新任务数据（2026-09-21 需求澄清，不再是更新日志入口） */
.home-foot { display: flex; justify-content: center; padding: 22px 0 30px; }
.foot-btn {
  border: 1px solid var(--border); background: var(--bg-soft); color: var(--muted);
  font: inherit; font-size: 13.5px; padding: 9px 20px; border-radius: 999px; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: border-color .15s, color .15s;
}
.foot-btn:hover { border-color: var(--primary); color: var(--primary); }
.foot-btn:disabled { opacity: .65; cursor: progress; }

/* 首页「待上传数据」区块（2026-09-23 本地缓存 + WLAN 上传）：缓存的打卡草稿列表 */
.pending-box {
  margin-top: 14px; background: var(--bg-soft); border: 1px solid color-mix(in srgb, #0ea5e9 40%, var(--border));
  border-radius: 14px; padding: 10px 12px; box-shadow: var(--shadow-sm); min-width: 0;
}
.pending-hd {
  display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14.5px; color: var(--text, #1f2937);
}
.pending-body { margin-top: 8px; display: grid; gap: 8px; }
.pending-item {
  display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 10px; min-width: 0;
}
.pi-main { flex: 1; min-width: 0; }
.pi-name { font-size: 14px; font-weight: 600; color: var(--text, #1f2937); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pi-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.pi-up {
  flex: 0 0 auto; border: 1px solid var(--primary); background: var(--primary); color: #fff;
  font: inherit; font-size: 13px; padding: 7px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.pi-up:hover { filter: brightness(1.05); }
.pending-foot { display: flex; align-items: center; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.pending-hint { font-size: 12px; color: var(--muted); }
/* 常驻空态：无待上传数据时也显示一行说明，让用户确认该机制存在 */
.pending-empty { font-size: 12.5px; color: var(--muted); line-height: 1.6; padding: 2px 0; }
.pending-empty.warn { color: #b45309; background: color-mix(in srgb, #f59e0b 12%, transparent); border-radius: 8px; padding: 8px 10px; }
/* 最近已上传台账（WLAN 下打卡立即上传后仍留下痕迹，便于用户确认成功） */
.pending-sent { margin-top: 8px; border-top: 1px dashed var(--border); padding-top: 8px; display: grid; gap: 6px; }
.ps-hd { font-size: 12px; color: var(--muted); font-weight: 600; }
.pending-item.done { background: color-mix(in srgb, #10b981 8%, var(--bg)); border-color: color-mix(in srgb, #10b981 32%, var(--border)); }
.pi-ok { flex: 0 0 auto; font-size: 12.5px; font-weight: 600; color: #047857; white-space: nowrap; }
/* 网络状态徽标（右对齐，替换 .cat-n 的 auto 占位） */
.pending-hd .cat-n { margin-left: 0; }
.net-badge { margin-left: auto; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
/* 待上传条目整条可点（查看/修改）——2026-09-23：单条「上传」按钮取消，仅保留下方「手动上传全部」 */
.pending-item.tap { cursor: pointer; transition: background .15s ease, border-color .15s ease; }
.pending-item.tap:hover { border-color: var(--primary); }
.pending-item.tap:active { background: color-mix(in srgb, var(--primary) 8%, var(--bg)); }
.pi-edit { flex: 0 0 auto; font-size: 12.5px; font-weight: 600; color: var(--primary); white-space: nowrap; }
/* ⛔ 被服务端永久拒绝（blocked）的待上传条目：橙色警示，仍可点开查看/删除（2026-09-26） */
.pending-item.blocked { background: color-mix(in srgb, #f59e0b 8%, var(--bg)); border-color: color-mix(in srgb, #f59e0b 40%, var(--border)); }
/* 上传进度文字提醒（2026-09-26）：「待上传数据」区块顶部一行，上传全程有文字可看，不再静默 */
.pending-progress {
  margin-bottom: 8px; font-size: 12.5px; font-weight: 600; line-height: 1.5;
  color: var(--primary, #0284c7); background: color-mix(in srgb, #0ea5e9 10%, var(--bg));
  border: 1px solid color-mix(in srgb, #0ea5e9 30%, var(--border));
  border-radius: 9px; padding: 6px 10px; word-break: break-all;
}
.pending-progress.ok { color: #047857; background: color-mix(in srgb, #10b981 10%, var(--bg)); border-color: color-mix(in srgb, #10b981 32%, var(--border)); }
.pending-progress.err { color: #b45309; background: color-mix(in srgb, #f59e0b 12%, var(--bg)); border-color: color-mix(in srgb, #f59e0b 32%, var(--border)); }

/* 草稿「查看 / 修改」面板（点待上传条目打开） */
#draftSheet .sheet { max-height: 88vh; display: flex; flex-direction: column; }
#draftSheet .sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.ds-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 2px 0 4px; }
.ds-ph { position: relative; aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden; background: var(--bg-soft); border: 1px solid var(--border); }
.ds-ph img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.ds-noph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--muted); }
.ds-del { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: rgba(15, 23, 42, .62); color: #fff; font-size: 12px; line-height: 22px; text-align: center; cursor: pointer; }
.ds-del:hover { background: rgba(220, 38, 38, .92); }
.ds-field { margin-top: 10px; }
.ds-label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.ds-desc { width: 100%; box-sizing: border-box; border: 1px solid var(--border); border-radius: 10px; padding: 9px 10px; font-size: 14px; font-family: inherit; line-height: 1.5; resize: vertical; color: var(--text, #1f2937); background: var(--bg, #fff); }
.ds-desc:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent); }
.ds-hint { margin-top: 8px; font-size: 12px; color: var(--muted); line-height: 1.55; }
.ds-hint.bad { color: #dc2626; }
.btn-ghost.danger { color: #dc2626; border-color: color-mix(in srgb, #dc2626 34%, var(--border)); }
.img-view { position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, .88); display: flex; align-items: center; justify-content: center; padding: 16px; }
.img-view img { max-width: 100%; max-height: 100%; border-radius: 8px; }


/* 底部轻提示条（如「任务已更新 · 当前任务 3 项 · 18:22」） */
.home-toast {
  position: fixed; left: 50%; bottom: 86px; transform: translate(-50%, 12px);
  max-width: 86vw; padding: 10px 18px; border-radius: 999px;
  background: rgba(24, 24, 28, .88); color: #fff; font-size: 13.5px; line-height: 1.45;
  text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; pointer-events: none; z-index: 9999;
  transition: opacity .22s ease, transform .22s ease;
}
.home-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 电子围栏（后台） ---------- */
.fence-lead { margin: -4px 0 14px; line-height: 1.7; }
.fence-layout { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 16px; align-items: start; }
.fence-form .map-box { height: 300px; margin-bottom: 10px; }
.soft-sep { border: none; border-top: 1px dashed var(--border); margin: 16px 0 12px; }
.wm-fields { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin-top: 8px; }
.wm-fields .check { margin: 0; }
/* 水印「显示大小」（2026-09-23）：滑块 + 百分比 + 快捷档位 + 实时预览 */
.wm-size { display: flex; align-items: center; gap: 12px; margin: 12px 0 8px; }
.wm-size input[type="range"] { flex: 1 1 auto; min-width: 0; height: 26px; accent-color: var(--brand, #6d5efc); cursor: pointer; }
.wm-size-val { flex: 0 0 auto; min-width: 56px; text-align: right; font-size: 15px; font-weight: 600;
  color: var(--brand, #6d5efc); font-variant-numeric: tabular-nums; }
.wm-presets { display: flex; flex-wrap: wrap; gap: 8px; }
/* 水印设置改版（2026-09-23）：左「设置」右「实时预览」两栏，整页一屏 —— 不再需要上下滑动 */
.wm-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); gap: 20px; align-items: stretch; }
.wm-set { display: flex; flex-direction: column; min-width: 0; }
.wm-set .soft-sep { margin: 14px 0 10px; }
.wm-set .form-actions { margin-top: auto; padding-top: 14px; }
.wm-side { display: flex; flex-direction: column; min-width: 0; }
.wm-side-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.wm-preview { flex: 1 1 auto; min-height: 210px; max-height: 560px; position: relative; border-radius: 12px; overflow: hidden;
  background: #0f172a; line-height: 0; box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .12); }
/* 2026-09-30：预览画布改为 810×1080 竖构图（与巡逻员竖拍照片同比例）——
   故由 cover 改 contain 居中显示，避免竖图被横向裁掉上下、水印反而看不见。 */
.wm-preview img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: 50% 50%; }
.wm-preview-loading { position: absolute; right: 10px; bottom: 10px; padding: 3px 10px; border-radius: 999px;
  background: rgba(15, 23, 42, .66); color: #fff; font-size: 12px; line-height: 1.6; }
.fence-events .toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fence-pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.fence-pager .muted { white-space: nowrap; }
.grow { flex: 1 1 auto; }
@media (max-width: 900px) { .fence-layout { grid-template-columns: 1fr; } }

/* ---------- 任务详情（点任何任务卡片都能看信息） ---------- */
.sheet-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 120;
  display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; background: #fff; border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 28px rgba(0, 0, 0, .18); overflow: hidden; animation: sheetUp .18s ease-out; }
@keyframes sheetUp { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-hd { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--line, #eef0f3); }
.sheet-title { font-size: 16px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-x { border: 0; background: transparent; font-size: 18px; color: var(--muted); cursor: pointer; padding: 2px 6px; }
.sheet-body { padding: 6px 16px 12px; }
.sheet-row { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line, #f1f3f5); font-size: 14px; }
.sheet-row:last-child { border-bottom: 0; }
.sheet-row .k { flex: 0 0 72px; color: var(--muted); }
.sheet-row .v { flex: 1 1 auto; min-width: 0; word-break: break-all; }
.sheet-warn { color: var(--err); }
.sheet-ok { color: var(--ok); }
.sheet-ft { padding: 10px 16px 18px; }
.sheet-note { text-align: center; color: var(--muted); font-size: 13px; padding: 8px 0 2px; }
.btn-primary.disabled { opacity: .55; pointer-events: auto; }
.on { color: var(--ok); }
.off { color: var(--muted); }
.badge-err { color: var(--err); font-weight: 600; }

/* ---------- 概览 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 16px; padding: 18px; text-align: center; box-shadow: var(--shadow-sm); }
.stat .num { font-size: 28px; font-weight: 800; }
.stat.day .num { color: #b45309; }
.stat.night .num { color: #4338ca; }
.stat.warn .num { color: var(--err); }
.stat .lab { color: var(--muted); font-size: 13px; margin-top: 4px; }
.recent-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }   /* 09-28晚：3 列卡片排布 */
.recent-item { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
@media (max-width: 900px) {
  .recent-list { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .recent-list { grid-template-columns: 1fr; }
}

/* ---------- 点位管理 ---------- */
.points-layout { display: grid; grid-template-columns: 380px 1fr; gap: 16px; align-items: start; }
.points-form { display: flex; flex-direction: column; gap: 12px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.form-row input, .form-row select { font-weight: 400; border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; font-size: 14px; }
.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- 记录筛选 / 灯箱 ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters select, .filters input { border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; font-size: 14px; }
/* 任务/记录页的「查询日期」条（历史调取） */
.datebar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.datebar select, .datebar input { border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; font-size: 14px;
  background: var(--bg-soft); color: var(--text); font-family: inherit; }
.datebar .dfield { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.datebar select { max-width: 210px; }
/* 历史日期下不允许的写操作按钮 */
.toolbar button:disabled, .datebar button:disabled { opacity: .45; cursor: not-allowed; }
.pager { margin-top: 14px; display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 14px; }
.lightbox { position: fixed; inset: 0; background: rgba(15, 17, 30, .82); display: flex; align-items: center; justify-content: center; z-index: 100; }
.lightbox img { max-width: 92vw; max-height: 86vh; border-radius: 12px; }
#lbClose { position: absolute; top: 18px; right: 24px; color: #fff; font-size: 30px; cursor: pointer; line-height: 1; }
/* 放大查看状态提示（2026-09-30 晚）：中图先到、原图随后替换，得让用户知道当前看的是哪一档 */
.lb-hint { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); background: rgba(0, 0, 0, .6); color: #fff; font-size: 13px; line-height: 1; padding: 9px 15px; border-radius: 999px; letter-spacing: .3px; pointer-events: none; white-space: nowrap; max-width: 80vw; overflow: hidden; text-overflow: ellipsis; }
.thumb { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; cursor: pointer; }
.col-photos { display: flex; flex-wrap: wrap; gap: 4px; }
/* 记录表照片的类型标签（人员督勤 4 张固定类型，2026-09-22） */
.ph-cell { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; min-width: 0; position: relative; }
.ph-cell .ph-kind { font-size: 10px; color: var(--muted); line-height: 1.2; white-space: nowrap; }
/* AI 识别角标 + 单张识别按钮（2026-09-24） */
.ph-cell .ph-ai { position: absolute; top: 3px; left: 3px; font-size: 11px; line-height: 1.3; padding: 0 4px; border-radius: 6px; background: rgba(255,255,255,.94); box-shadow: 0 1px 3px rgba(0,0,0,.12); cursor: default; z-index: 2; }
.ph-cell .ph-ai.v-ok { color: #047857; border: 1px solid #6ee7b7; }
.ph-cell .ph-ai.v-warn { color: #b45309; border: 1px solid #fcd34d; }
.ph-cell .ph-ai.v-bad { color: #b91c1c; border: 1px solid #fca5a5; }
.ph-cell .ph-airun { position: absolute; top: 3px; right: 3px; border: 1px solid #d1d5db; border-radius: 6px; background: rgba(255,255,255,.94); font-size: 11px; line-height: 1.3; padding: 0 4px; cursor: pointer; z-index: 2; }
.ph-cell .ph-airun:disabled { opacity: .5; cursor: wait; }
.col-desc { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 照片校验码 + 校验结果面板 */
.stamp-btn { font: 600 11.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .3px;
  color: var(--primary); background: color-mix(in srgb, var(--primary) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 26%, transparent); border-radius: 7px;
  padding: 3px 7px; cursor: pointer; white-space: nowrap; }
.stamp-btn:hover { background: color-mix(in srgb, var(--primary) 18%, transparent); }
.col-stamp { white-space: nowrap; }
.verify-box { position: fixed; right: 22px; bottom: 22px; width: 380px; max-width: calc(100vw - 32px);
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 14px; z-index: 120;
  box-shadow: 0 18px 50px rgba(15, 17, 30, .2); overflow: hidden; }
.vb-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.vb-head b { font-size: 14px; }
.vb-head .vb-code { font: 600 11.5px ui-monospace, Menlo, Consolas, monospace; color: var(--muted); }
.vb-head #vbClose { margin-left: auto; cursor: pointer; color: var(--muted); font-size: 17px; line-height: 1; }
.vb-body { padding: 8px 14px 14px; }
.vb-row { display: flex; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.vb-row:last-of-type { border-bottom: none; }
.vb-row .i { flex: 0 0 auto; }
.vb-row .d { color: var(--muted); font-size: 12px; word-break: break-all; }
.vb-sum { margin-top: 8px; padding: 9px 11px; border-radius: 9px; font-weight: 700; font-size: 13px; }
.vb-sum.ok { color: #067647; background: #e8f7ef; }
.vb-sum.no { color: var(--err); background: color-mix(in srgb, var(--err) 10%, #fff); }
.empty { padding: 46px 20px; text-align: center; color: var(--muted); }
.empty .ico { font-size: 40px; margin-bottom: 10px; }
.empty .t { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty .s { font-size: 13px; line-height: 1.7; }
.empty .s b { color: var(--text); }
.err-box { padding: 20px; text-align: center; color: var(--err); }

/* ===================== 日志管理（2026-09-22） ===================== */
.log-filters select, .log-filters input {
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; font-size: 13.5px;
  background: #fff; color: var(--text); font-family: inherit;
}
.lg-time { white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.lg-ip { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.lg-detail { min-width: 260px; overflow-wrap: anywhere; }
.lg-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.lg-c-green  { background: #e8f7ef; color: #067647; }
.lg-c-purple { background: #f1edff; color: #6d28d9; }
.lg-c-blue   { background: #e8f1fe; color: #1d4ed8; }
.lg-c-amber  { background: #fdf3e0; color: #b45309; }
.lg-c-red    { background: color-mix(in srgb, var(--err) 12%, #fff); color: var(--err); }
.lg-c-gray   { background: var(--bg); color: var(--muted); }


/* ---------- 二维码 ---------- */
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.qr-card { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 16px; padding: 16px; text-align: center; box-shadow: var(--shadow-sm); }
.qr-name { font-weight: 700; margin-bottom: 4px; }
.qr-flag { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.qr-img { width: 160px; height: 160px; }
.qr-url { font-size: 11px; color: var(--muted); word-break: break-all; margin-top: 8px; line-height: 1.5; }

/* ---------- 随机巡逻任务 ---------- */
.task-list { display: grid; gap: 10px; min-width: 0; }
.task-card {
  display: flex; align-items: center; gap: 12px; background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow-sm);
  /* ⚠️ 必须显式 min-width:0：grid 项默认 min-width:auto，会被内部「不换行」的长文本
     （如 .task-sub 的完整地址）撑到内容宽度 → 手机上整页横向溢出、右侧按钮/数量被顶出屏幕。 */
  min-width: 0;
}
.task-card.missed {
  border-color: color-mix(in srgb, var(--err) 42%, transparent);
  background: color-mix(in srgb, var(--err) 6%, transparent);
}
.task-time { font-weight: 800; font-size: 16px; min-width: 52px; color: var(--text); }
.task-card.missed .task-time { color: var(--err); }
.task-main { flex: 1 1 auto; min-width: 0; }
.task-name { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.task-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 「当前任务」卡片上的「距我 N 米」：只在当前任务显示，用来解释「最近优先」的排序 */
.task-dist { color: #6d28d9; font-weight: 600; }
.task-left { font-size: 12px; color: var(--muted); margin-top: 2px; }
/* 「只显示今日任务」的说明行 */
.daynote { margin: -2px 0 10px; line-height: 1.5; }
/* 分类标题后的补充说明（如「过期任务 · 不可补打卡」） */
.cat-sub { font-weight: 400; font-size: 11.5px; color: var(--muted); margin-left: 6px; }
.task-left.cur { color: #6d28d9; font-weight: 700; }
.task-left.warn { color: var(--err); font-weight: 600; }
/* 已完成任务的「完成时间」（2026-09-22 用户要求） */
.task-left.done { color: #047857; font-weight: 600; }
.done-at { font-size: 12px; color: #047857; background: color-mix(in srgb, var(--ok) 13%, transparent);
  padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.task-card.s-current .task-go { box-shadow: var(--shadow-lift); }
.task-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; min-width: 0; }
.task-go {
  text-decoration: none; font-size: 13px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  padding: 6px 12px; border-radius: 999px;
}
.task-status { font-size: 13px; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.t-pending { background: color-mix(in srgb, var(--muted) 14%, transparent); color: var(--muted); }
.t-done { background: color-mix(in srgb, var(--ok) 16%, transparent); color: #047857; }
.t-missed { background: color-mix(in srgb, var(--err) 16%, transparent); color: var(--err); font-weight: 600; }

/* 4 类任务分区 */
.task-cats { display: grid; gap: 14px; margin-top: 4px; min-width: 0; }
/* 后台任务页：4 个状态分类卡横排一行（2026-09-22）；窄屏自动换行/堆叠 */
.task-cats.admin { margin-top: 4px; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: start; }
@media (max-width: 1080px) { .task-cats.admin { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.task-cat { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px; box-shadow: var(--shadow-sm); min-width: 0; }
.task-cat[data-cat="current"] { border-color: color-mix(in srgb, #8b5cf6 42%, transparent); }
.task-cat[data-cat="expired"] { border-color: color-mix(in srgb, var(--err) 40%, transparent); }

.cat-hd { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 14px; margin-bottom: 8px; min-width: 0; }
.cat-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-ico { font-size: 15px; }
.cat-n { margin-left: auto; min-width: 24px; text-align: center; background: var(--bg); border-radius: 999px; padding: 1px 9px; font-size: 13px; color: var(--muted); }
.cat-empty { color: var(--muted); font-size: 13px; padding: 8px 2px; }

/* 分类可折叠：标题按钮化 + 箭头旋转 + 收起时去掉下间距 */
button.cat-hd { width: 100%; background: none; border: 0; padding: 2px 0; margin: 0;
  font-family: inherit; color: inherit; cursor: pointer; text-align: left; -webkit-tap-highlight-color: transparent; }
button.cat-hd:hover { color: var(--primary); }
button.cat-hd:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 8px; }
.cat-arrow { font-size: 12px; color: var(--muted); transition: transform .18s ease; flex: 0 0 auto; }
.task-cat.open .cat-arrow { transform: rotate(90deg); }
.task-cat.open button.cat-hd { margin-bottom: 8px; }
.task-cat:not(.open) { padding-bottom: 8px; }
.task-cat:not(.open) button.cat-hd .cat-n { font-weight: 700; color: var(--text, #1f2937); }
.task-cat[data-cat="expired"]:not(.open) button.cat-hd .cat-n { color: var(--err); }

/* 任务卡片状态色 */
.task-card.s-current { border-color: color-mix(in srgb, #8b5cf6 42%, transparent); background: color-mix(in srgb, #8b5cf6 7%, transparent); }
.task-card.s-expired { border-color: color-mix(in srgb, var(--err) 42%, transparent); background: color-mix(in srgb, var(--err) 6%, transparent); }
.task-card.s-upcoming { opacity: .92; }
.task-card.s-done { opacity: .85; }
.task-card.is-handled { opacity: .55; }
.task-status.t-current { background: color-mix(in srgb, #8b5cf6 16%, transparent); color: #6d28d9; font-weight: 600; }
.task-status.t-expired { background: color-mix(in srgb, var(--err) 16%, transparent); color: var(--err); font-weight: 600; }
.task-status.t-upcoming { background: color-mix(in srgb, #3b82f6 14%, transparent); color: #1d4ed8; }
.task-status.t-ignored { background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--muted); font-weight: 600; }
/* 过期任务的打卡按钮改成「补打卡」（虚线描边、非主色），与当场「去打卡」区分开 */
/* 过期任务：只作提醒，不提供任何打卡入口（过期＝漏打，应如实保留，不做补打卡） */
.task-card.s-expired .task-name { color: color-mix(in srgb, var(--err) 72%, var(--text)); }
/* 「手动」标记：后台立即派单生成的任务（不受时间窗限制），与随机排程任务区分 */
.tag-manual { font-size: 12px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; font-weight: 600;
  background: color-mix(in srgb, #f59e0b 18%, transparent); color: #b45309; }
/* 延期徽标（2026-09-22 申请延期） */
.tag-delay { font-size: 12px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; font-weight: 600;
  background: color-mix(in srgb, #6d5efc 16%, transparent); color: #4f46e5; }

/* 任务详情里的「申请延期」表单 */
.delay-form .df-field { margin: 12px 0 0; }
.delay-form .df-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.delay-form .df-opt { display: flex; align-items: center; gap: 8px; padding: 9px 12px; margin-bottom: 6px;
  border: 1px solid var(--border); border-radius: 10px; font-size: 14px; cursor: pointer; }
.delay-form .df-opt:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, transparent); }
.delay-form .df-opt input { accent-color: var(--primary); }
.delay-form .df-opt input:disabled + span { color: var(--muted); }
.delay-form .df-reason { width: 100%; box-sizing: border-box; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 14px; font-family: inherit; resize: vertical; }
.delay-form .df-tip { margin-top: 10px; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.delay-form .df-msg { margin-top: 10px; font-size: 13px; padding: 8px 10px; border-radius: 8px; }
.delay-form .df-msg.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.delay-form .df-msg.bad { color: var(--err); background: color-mix(in srgb, var(--err) 10%, transparent); }
.df-btns { display: flex; gap: 10px; }
.df-btns .btn-ghost, .df-btns .btn-primary { flex: 1; }

/* 后台任务行（带复选框） */
.task-list.admin { gap: 6px; }
.task-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; background: var(--bg); cursor: pointer; }
.task-row:hover { background: color-mix(in srgb, var(--primary) 6%, transparent); }
.task-row .task-time { font-weight: 700; min-width: 46px; }
.task-row .task-main { flex: 1; min-width: 0; font-size: 14px; }

/* 概览卡片强调色 */
.stat.cur .num { color: #6d28d9; }
.stat.up .num { color: #1d4ed8; }

/* APP 安装页步骤 */
.steps { margin: 8px 0 14px; padding-left: 22px; line-height: 1.9; font-size: 14px; }
.steps li { margin-bottom: 2px; }
.app-qr { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* 后台任务明细行 */
.detail-row td { background: color-mix(in srgb, var(--primary) 4%, transparent); padding: 10px 14px !important; }
.task-line { display: flex; align-items: center; gap: 10px; padding: 4px 0; font-size: 14px; }
.task-line b { min-width: 48px; }

/* 打印：只留二维码卡片 */
@media print {
  .admin-side, .admin-top, .no-print { display: none !important; }
  body { background: #fff !important; }
  .admin-layout { display: block !important; }
  .admin-main { padding: 0 !important; max-width: none !important; }
  .qr-grid { grid-template-columns: repeat(2, 1fr); }
  .qr-card { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
}

/* 后台提示条（例：今日任务与当前时间窗不一致，需要重排） */
.warn-box {
  background: color-mix(in srgb, var(--warn) 11%, var(--bg-soft));
  border: 1px solid color-mix(in srgb, var(--warn) 46%, transparent);
  border-radius: 12px; padding: 12px 14px; font-size: 13.5px; line-height: 1.7;
  color: #8a5a06; margin: 4px 0 14px;
}
.warn-box .wb-list { margin: 6px 0 4px; }
.warn-box .wb-list > div { margin-top: 2px; }
.warn-box .wb-act { margin-top: 9px; }

/* ---------- 移动端 ---------- */
@media (max-width: 720px) {
  .task-cats.admin { grid-template-columns: 1fr; }
  .admin-side {
    position: fixed; left: 0; top: 53px; bottom: 0; width: 200px; background: var(--bg-soft);
    transform: translateX(-100%); transition: transform .2s; z-index: 15; box-shadow: var(--shadow); padding: 16px 10px;
  }
  .admin-side.open { transform: translateX(0); }
  .menu-toggle { display: block; }
  .points-layout { grid-template-columns: 1fr; }
  .admin-main { padding: 14px; }
  .form-row { grid-template-columns: 1fr; }
  /* 水印设置：窄屏改为上下堆叠，预览给固定高度免得贴边 */
  .wm-layout { grid-template-columns: 1fr; gap: 16px; }
  /* 2026-09-30：预览图为竖构图，240px 高度下 contain 后水印过小看不清，抬到 380px */
  .wm-preview { flex: none; height: 380px; min-height: 0; }
}

/* 手机端任务卡：状态与按钮换到第二行，地址最多两行，整页不再横向滚动 */
@media (max-width: 560px) {
  .home { padding: 12px 12px 24px; }
  .task-cats { gap: 10px; }
  .task-cat { padding: 9px 10px; border-radius: 13px; }
  .task-list { gap: 8px; }

  .task-card { flex-wrap: wrap; gap: 8px 10px; padding: 11px 12px; align-items: flex-start; }
  .task-time { font-size: 15px; min-width: 42px; line-height: 1.5; }
  .task-name { font-size: 14.5px; line-height: 1.45; }
  .task-sub {
    white-space: normal; overflow-wrap: anywhere; line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  }
  .task-left { font-size: 11.5px; }
  .task-main { flex: 1 1 60%; }
  /* 右侧「状态 + 动作」独占一行，右对齐，避免把中间文字挤成一条 */
  .task-right { flex: 1 1 100%; justify-content: flex-end; gap: 6px; margin-top: 1px; }
  .task-status, .tag-manual { font-size: 12px; padding: 3px 9px; }
  .task-go { font-size: 13px; padding: 6px 14px; }

  /* 分类标题行 + 顶部栏同理收紧 */
  .cat-hd { font-size: 13.5px; }
  .sec-title { font-size: 15px; }
  .topbar { padding: 10px 12px; }
  .brand { font-size: 15px; }
  .who { max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .map-box { height: 220px; }

  /* 后台数据表：手机上不再横向挤压，改成「一卡一条」的堆叠布局（td[data-label] 提供字段名） */
  .stack-table thead { display: none; }
  .stack-table, .stack-table tbody, .stack-table tr, .stack-table td { display: block; width: 100%; }
  .stack-table tr {
    border: 1px solid var(--border); border-radius: 12px; background: var(--bg-soft);
    padding: 6px 10px 8px; margin: 0 0 8px;
  }
  .stack-table tr:last-child { margin-bottom: 0; }
  .stack-table td {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
    padding: 4px 0 !important; border-bottom: 1px dashed var(--border); text-align: right;
    white-space: normal; max-width: none;
  }
  .stack-table td:last-child { border-bottom: none; }
  .stack-table td::before {
    content: attr(data-label); flex: 0 0 76px; text-align: left;
    color: var(--muted); font-size: 12px; font-weight: 600;
  }
  .stack-table td[data-label="点位"] { flex-direction: column; gap: 2px; }
  .stack-table td[data-label="点位"]::before { flex: none; }
  .stack-table td[data-label="点位"] .pname { font-weight: 700; }
  .stack-table td[data-label="点位"] .paddr { white-space: normal; overflow-wrap: anywhere; text-align: left; }
  .stack-table td.op-bar { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
  .stack-table td.op-bar::before { flex: 1 1 auto; line-height: 30px; }
  .table-wrap { border: none; background: none; box-shadow: none; border-radius: 0; }
}

/* ===================== 点位分类：人员督勤 / 园区巡查 / 地库巡查（2026-09-22 起，09-23 加第三类） ===================== */
/* 类别徽标：巡逻端（任务卡 / 弹窗 / 点位信息 / 打卡页）与后台统一复用 */
.cat-badge {
  display: inline-block; vertical-align: middle; white-space: nowrap;
  padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 18px;
}
.cat-badge.cat-staff { color: #5b4bdd; background: rgba(109, 94, 252, .13); border: 1px solid rgba(109, 94, 252, .3); }
.cat-badge.cat-area { color: #0b7a55; background: rgba(16, 185, 129, .13); border: 1px solid rgba(16, 185, 129, .3); }
.cat-badge.cat-garage { color: #0369a1; background: rgba(14, 165, 233, .13); border: 1px solid rgba(14, 165, 233, .32); }

/* 巡逻端首页地图图例（叠在地图上，只列出实际存在的类别） */
.map-wrap { position: relative; }
.map-legend {
  position: absolute; left: 10px; top: 10px; z-index: 6;
  display: flex; flex-direction: column; gap: 4px;
  padding: 7px 10px; border-radius: 10px; font-size: 12px; color: var(--text);
  background: rgba(255, 255, 255, .93); border: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(15, 23, 42, .14);
}
.map-legend .ml-item { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.map-legend .ml-item i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* 后台点位表单：类别选择（可点卡片，radio 隐藏、靠 :checked + label 高亮；3 类按 2 列自动换行） */
#p_cat > input { position: absolute; opacity: 0; width: 0; height: 0; }
.field-label { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.cat-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cat-opt {
  display: flex; flex-direction: column; gap: 3px; cursor: pointer;
  padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 13px;
  background: var(--bg-soft); transition: border-color .15s, background .15s, box-shadow .15s;
}
.cat-opt .cat-txt { font-size: 14px; font-weight: 700; }
.cat-opt .cat-desc { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.cat-opt:hover { border-color: #cfd3ea; }
#p_cat > input:checked + .cat-opt.staff {
  border-color: var(--primary); background: rgba(109, 94, 252, .08);
  box-shadow: 0 0 0 3px rgba(109, 94, 252, .12);
}
#p_cat > input:checked + .cat-opt.area {
  border-color: var(--ok); background: rgba(16, 185, 129, .08);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .12);
}
#p_cat > input:checked + .cat-opt.garage {
  border-color: #0ea5e9; background: rgba(14, 165, 233, .08);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, .12);
}

/* 后台点位列表：分类筛选标签 + 行内类别下拉 */
.cat-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.cat-tab {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 6px 13px; border-radius: 999px; font-size: 13px; font-weight: 600;
  border: 1.5px solid var(--border); background: var(--bg-soft); color: var(--text);
  transition: border-color .15s, background .15s, color .15s;
}
.cat-tab b { font-weight: 700; color: var(--muted); }
.cat-tab.on { border-color: var(--primary); color: #5b4bdd; background: rgba(109, 94, 252, .09); }
.cat-tab.on b { color: #5b4bdd; }
.cat-tab.area.on { border-color: var(--ok); color: #0b7a55; background: rgba(16, 185, 129, .1); }
.cat-tab.area.on b { color: #0b7a55; }
.cat-tab.garage.on { border-color: #0ea5e9; color: #0369a1; background: rgba(14, 165, 233, .1); }
.cat-tab.garage.on b { color: #0369a1; }
select.cat-sel {
  padding: 5px 9px; border-radius: 9px; font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1.5px solid var(--border); background: var(--bg-soft); color: var(--text);
}
select.cat-sel.cat-staff { border-color: rgba(109, 94, 252, .5); color: #5b4bdd; }
select.cat-sel.cat-area { border-color: rgba(16, 185, 129, .5); color: #0b7a55; }
select.cat-sel.cat-garage { border-color: rgba(14, 165, 233, .5); color: #0369a1; }
.pt-item .cat-badge { margin-left: 6px; }

@media (max-width: 560px) {
  .cat-pick { grid-template-columns: 1fr; }
  .cat-badge { font-size: 11px; padding: 1px 6px; }
  .map-legend { font-size: 11px; padding: 6px 8px; }
}

/* 侧栏未读角标（2026-09-25 聊天室未读提醒） */
.side-item { position: relative; }
.side-badge { position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px; box-sizing: border-box;
  border-radius: 9px; background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; text-align: center; }
.side-item.has-unread { font-weight: 600; }

/* 当前所属单位徽标（2026-09-25 多租户，防止两个单位混用同一台设备/APP 认错单位） */
.tenant-badge {
  display: inline-block; max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12px; font-weight: 600; color: #0b7a55; background: #ecfdf5;
  border: 1px solid #a7f3d0; border-radius: 999px; padding: 2px 9px; vertical-align: middle;
}
/* 后台侧栏底部的「平台总管理」入口（2026-09-25 二） */
.side-plat { margin-top: 10px; border-top: 1px dashed #e5e7eb; padding-top: 10px; font-weight: 600; color: #4338ca; }

/* 后台侧栏顶部的单位名（2026-09-25 二） */
.side-tenant {
  font-size: 12px; font-weight: 600; color: #0b7a55; background: #ecfdf5; border: 1px solid #a7f3d0;
  border-radius: 8px; padding: 6px 9px; margin: 2px 0 8px; word-break: break-all;
}

/* 功能未开通提示（2026-09-25 二：平台关掉某功能后，直接进页面看到的卡片） */
.feat-off { max-width: 520px; margin: 36px auto; text-align: center; padding: 26px 22px; }
.feat-off .big { font-size: 42px; line-height: 1; }
.feat-off h2 { margin: 12px 0 8px; font-size: 18px; }
.feat-off p { margin: 6px 0; color: #6b7280; font-size: 13px; line-height: 1.7; }

/* ---- 监督员权限勾选网格（2026-09-28，账号管理授权面板） ---- */
.sup-perm-grid { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 8px 10px; border: 1px dashed var(--border, #e5e7eb); border-radius: 10px; background: color-mix(in srgb, var(--primary, #6d5efc) 4%, transparent); }
.sup-perm-grid .check { font-size: 13px; }

/* ---- 概览最近打卡翻页（2026-09-28） ---- */
.pager-row { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 10px 0 2px; }
.pager-row .btn-ghost:disabled { opacity: .4; cursor: not-allowed; }

/* ---- 聊天室管理员删消息按钮（2026-09-28） ---- */
.msg-del { font-size: 11px; padding: 1px 6px; opacity: .55; border: 1px solid transparent; background: transparent; cursor: pointer; }
.msg-del:hover { opacity: 1; border-color: #fca5a5; background: #fef2f2; border-radius: 8px; }

/* ---- 导出前必须先选日期（2026-09-30 晚） ---- */
/* 未选日期：导出按钮灰化不可点（href 已置空，右键复制也拿不到整库导出链接） */
a.need-date { opacity: .5; cursor: not-allowed; filter: grayscale(.35); }
/* 点了导出却没选日期：日期输入框闪三下提示 */
input.need-date { border-color: #e0533d !important; box-shadow: 0 0 0 3px rgba(224, 83, 61, .15); animation: needDateFlash .55s ease-in-out 3; }
@keyframes needDateFlash { 50% { background: rgba(224, 83, 61, .16); } }

