/* 管理端「实时门禁」样式（全部以 af- 前缀，避免污染现有管理端样式） */

#access-feed-root { padding: 4px 2px 40px; }

.af-head { display: flex; align-items: flex-start; gap: 14px; margin: 4px 0 16px; }
.af-head h1 { margin: 0; font-size: 20px; letter-spacing: .3px; }
.af-head p { margin: 4px 0 0; color: #7080a6; font-size: 12.5px; }

.af-conn {
  margin-left: auto; display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: #7080a6; background: #fff;
  border: 1px solid #e6ebf6; border-radius: 999px; padding: 6px 13px;
}
.af-dot { width: 8px; height: 8px; border-radius: 50%; background: #17b26a; box-shadow: 0 0 0 3px rgba(23,178,106,.14); }
.af-dot.warn { background: #ffb347; box-shadow: 0 0 0 3px rgba(255,179,71,.18); }
.af-dot.bad { background: #e5484d; box-shadow: 0 0 0 3px rgba(229,72,77,.16); }

.af-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 14px; }
.af-stat { background: #fff; border: 1px solid #e6ebf6; border-radius: 14px; padding: 13px 16px; }
.af-label { font-size: 12.5px; color: #7080a6; }
.af-value { font-size: 25px; font-weight: 700; margin-top: 4px; letter-spacing: .4px; font-variant-numeric: tabular-nums; }
.af-value small { font-size: 12px; font-weight: 500; color: #7080a6; margin-left: 4px; }
.af-stat.ok .af-value { color: #17b26a; }
.af-stat.no .af-value { color: #e5484d; }
.af-stat.warn .af-value { color: #d9822b; }

.af-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: #fff; border: 1px solid #e6ebf6; border-bottom: none;
  border-radius: 14px 14px 0 0; padding: 11px 14px;
}
.af-btn {
  border: 1px solid #e6ebf6; background: #fff; color: #1b2340; border-radius: 9px;
  padding: 6px 12px; font-size: 12.5px; cursor: pointer; font-family: inherit; white-space: nowrap;
}
.af-btn:hover { border-color: #cfd9f2; background: #fbfcff; }
.af-btn.on { background: #5f79ff; border-color: #5f79ff; color: #fff; font-weight: 600; }
.af-search {
  margin-left: auto; width: 230px; border: 1px solid #e6ebf6; border-radius: 9px;
  padding: 6px 11px; font-size: 12.5px; font-family: inherit; color: #1b2340;
  background: #f7f9ff; outline: none;
}
.af-search:focus { border-color: #b9c6ee; background: #fff; }
/* 高亮时间范围选择：窗口内所有事件都高亮（1 分钟太短时前台可以调大） */
.af-win {
  border: 1px solid #e6ebf6; background: #f7f9ff; color: #1b2340; border-radius: 9px;
  padding: 5px 8px; font-size: 12.5px; font-family: inherit; cursor: pointer; outline: none;
}
.af-win:hover { border-color: #cfd9f2; }
.af-win:focus { border-color: #b9c6ee; background: #fff; }
.af-count { font-size: 12px; color: #9aa7c6; white-space: nowrap; }

/* ── 「最近 1 分钟」吸顶小结条：纯文本，不进列表 DOM，更新成本几乎为 0 ── */
.af-band {
  display: flex; align-items: center; gap: 8px;
  background: #fbfcff; border: 1px solid #e6ebf6; border-top: none; border-bottom: none;
  padding: 9px 16px; font-size: 12.5px; color: #7b89a8;
}
.af-band.hot {
  background: linear-gradient(90deg, #eef2ff, #fbfcff 62%);
  color: #3c4a75;
}
.af-band b { color: #5f79ff; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.af-band i { font-style: normal; color: #8d9ab8; }
.af-band em { font-style: normal; margin-left: auto; font-size: 11.5px; color: #b0b9cf; }
.af-band-dot { width: 7px; height: 7px; border-radius: 50%; background: #c3cbe0; flex: none; }
.af-band.hot .af-band-dot { background: #5f79ff; }
@keyframes afPulse {
  0% { box-shadow: 0 0 0 0 rgba(95,121,255,.45); }
  70% { box-shadow: 0 0 0 7px rgba(95,121,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(95,121,255,0); }
}
@media (prefers-reduced-motion: no-preference) {
  .af-band.hot .af-band-dot { animation: afPulse 1.9s ease-out infinite; }
}

.af-feed-wrap { background: #fff; border: 1px solid #e6ebf6; border-radius: 0 0 14px 14px; overflow: hidden; }
.af-feed { max-height: 600px; overflow-y: auto; }
.af-feed::-webkit-scrollbar { width: 8px; }
.af-feed::-webkit-scrollbar-thumb { background: #dfe6f6; border-radius: 4px; }

.af-ev {
  display: grid;
  grid-template-columns: 100px 58px 1fr 118px 70px;
  align-items: center; gap: 13px;
  padding: 10px 16px; border-bottom: 1px solid #f1f4fb; position: relative;
}
.af-feed.no-photo .af-ev { grid-template-columns: 100px 1fr 118px 70px; }
.af-ev:last-child { border-bottom: none; }
.af-ev.is-new { animation: afSlide .4s cubic-bezier(.2,.8,.3,1); }
@keyframes afSlide {
  from { opacity: 0; transform: translateY(-9px); background: rgba(95,121,255,.10); }
  to { opacity: 1; transform: none; }
}
/* 入场时闪一下：必须用**一次性动画**（播完自动回到常态）。
   这里绝不能用常驻 background —— .flash 类一旦残留在行上就是永久浅蓝底，
   和「窗口内高亮」在视觉上分不出来，会被误认为"只有置顶那条一直亮"。 */
.af-ev.flash { animation: afFlash 1.1s ease-out; }
@keyframes afFlash {
  0% { background: rgba(95,121,255,.22); }
  55% { background: rgba(95,121,255,.11); }
  100% { background: rgba(95,121,255,0); }
}
.af-ev.no { background: linear-gradient(90deg, rgba(229,72,77,.10), transparent 55%); }
.af-ev.no::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: #e5484d; }

/* ── 时间窗口内（默认最近 1 分钟，可切 3/5 分钟）的行：蓝底 + 右侧蓝条 + 名字前脉冲点。
   窗口内**所有**行都这样，不只是最新那条。
   左侧竖条被「被拒」红色占用，所以蓝条放右侧，两者不抢同一条视觉通道。 ── */
.af-ev { transition: background .38s ease, box-shadow .38s ease; }
.af-ev.is-hot:not(.no) {
  background: linear-gradient(90deg, rgba(95,121,255,.145), rgba(95,121,255,.045) 60%, transparent);
  box-shadow: inset -3px 0 0 rgba(95,121,255,.55);
}
.af-ev.no.is-hot {
  background: linear-gradient(90deg, rgba(229,72,77,.16), rgba(95,121,255,.06) 55%, transparent);
  box-shadow: inset -3px 0 0 rgba(229,72,77,.5);
}
.af-ev.is-hot .af-t b { color: #2f47c9; }
.af-ev.is-hot .af-name::before {
  content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: #5f79ff; margin-right: 6px; vertical-align: 1px;
}
.af-ev.no.is-hot .af-name::before { background: #e5484d; }
@keyframes afHotBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .45; transform: scale(.82); }
}
@media (prefers-reduced-motion: no-preference) {
  .af-ev.is-hot .af-name::before { animation: afHotBlink 1.6s ease-in-out infinite; }
}
/* 滑出窗口：摘掉高亮后走 0.38s 过渡到常态，不能瞬间变样（否则前台以为数据丢了） */
.af-ev.just-cooled { background: transparent; box-shadow: none; }

/* 时间：秒高亮 */
.af-t { font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.af-t b { font-size: 15px; font-weight: 700; color: #1b2340; letter-spacing: -.2px; }
.af-t i { font-style: normal; font-size: 15px; font-weight: 700; color: #5f79ff; letter-spacing: -.2px; }
.af-ev.no .af-t i { color: #e5484d; }
.af-t span { display: block; font-size: 10.5px; color: #a8b4d0; letter-spacing: .4px; margin-top: 1px; }

/* 头像 */
.af-ph {
  width: 50px; height: 50px; border-radius: 50%; position: relative;
  background: #eef2fb; overflow: hidden; cursor: pointer; flex: none;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #e6ebf6;
  transition: box-shadow .18s, transform .18s;
}
.af-ph:hover { transform: scale(1.06); box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #5f79ff; }
.af-ev.no .af-ph { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px rgba(229,72,77,.55); }
.af-ph img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .26s; }
/* 陌生访客抓拍是 432x768 竖幅门口画面，圆形缩略图 cover 裁切默认居中会切到脸，重心上移 */
.af-ph.af-cap img { object-position: center 35%; }
.af-ph img.ready { opacity: 1; }
.af-ev.no .af-ph img { filter: grayscale(.18) contrast(1.02); }
.af-ph .af-fb {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-weight: 700; font-size: 17px; color: #5f79ff;
  background: linear-gradient(135deg, #eef2ff, #e3eaff);
}
.af-ev.no .af-ph .af-fb { color: #e5484d; background: linear-gradient(135deg, #fff0f0, #ffe3e4); }
.af-ph .af-skel {
  position: absolute; inset: 0; border-radius: 50%;
  background: linear-gradient(100deg, #eef2fb 25%, #e2e9f7 37%, #eef2fb 63%);
  background-size: 300% 100%; animation: afShimmer 1.15s ease-in-out infinite;
}
.af-ph.done .af-skel { display: none; }
@keyframes afShimmer { 0% { background-position: 120% 0 } 100% { background-position: -60% 0 } }

/* 姓名 / 手机号 */
.af-who { min-width: 0; }
.af-name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.af-meta { color: #7080a6; font-size: 12px; margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.af-meta i { font-style: normal; color: #ccd5ea; }
.af-phone {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; color: #3b4a76;
  font-variant-numeric: tabular-nums; letter-spacing: .2px; background: #f1f4fd;
  border-radius: 6px; padding: 1px 7px; cursor: pointer; transition: .15s; white-space: nowrap;
}
.af-phone:hover { background: rgba(95,121,255,.12); color: #5f79ff; }
.af-phone.copied { background: rgba(23,178,106,.12); color: #17b26a; }
.af-phone.copied::after { content: "已复制"; margin-left: 5px; font-family: -apple-system, sans-serif; font-size: 10.5px; }

.af-cnt { font-size: 11px; font-weight: 700; background: #eef1fa; color: #7080a6; border-radius: 6px; padding: 1px 6px; }
.af-flag { font-size: 11px; color: #b26b00; background: rgba(255,179,71,.18); border-radius: 6px; padding: 1px 7px; font-weight: 600; }
.af-flag.red { color: #e5484d; background: rgba(229,72,77,.10); }

.af-expire { font-size: 12.5px; color: #7080a6; text-align: right; }
.af-expire b { display: block; color: #1b2340; font-weight: 600; font-size: 12.5px; }
.af-expire.danger b { color: #e5484d; }

.af-badge { justify-self: end; font-size: 12px; font-weight: 700; border-radius: 9px; padding: 5px 10px; white-space: nowrap; }
.af-badge.ok { color: #17b26a; background: rgba(23,178,106,.12); }
.af-badge.bad { color: #e5484d; background: rgba(229,72,77,.10); }

.af-empty { padding: 52px 20px; text-align: center; color: #7080a6; font-size: 13px; }
.af-empty .af-big { font-size: 15px; color: #1b2340; font-weight: 600; margin-bottom: 6px; }

/* 被拒提醒条 */
.af-alert {
  position: fixed; right: 26px; bottom: 26px; max-width: 420px;
  display: flex; align-items: center; gap: 9px;
  background: #fff; border: 1px solid rgba(229,72,77,.35); border-left: 4px solid #e5484d;
  border-radius: 12px; padding: 12px 16px; font-size: 13px; color: #1b2340;
  box-shadow: 0 16px 36px rgba(58,77,145,.16);
  transform: translateY(18px); opacity: 0; pointer-events: none; transition: .22s; z-index: 60;
}
.af-alert.show { transform: none; opacity: 1; }

/* 灯箱 */
.af-lightbox {
  position: fixed; inset: 0; background: rgba(18,24,45,.62); display: none;
  align-items: center; justify-content: center; z-index: 70; padding: 24px;
}
.af-lightbox.show { display: flex; }
.af-lb-card {
  background: #fff; border-radius: 16px; padding: 16px; width: 380px; max-width: 92vw;
  box-shadow: 0 30px 70px rgba(12,18,40,.35); text-align: center; position: relative;
}
/* 高清 640px 预览：卡片宽 380 − 左右内边距 32 = 348 显示宽，dpr2 下需 696 ⇒ 640 已接近原生清晰度 */
.af-lb-img { width: 100%; max-height: 420px; object-fit: contain; border-radius: 10px; background: #f4f7ff; }
.af-lb-close {
  position: absolute; right: 12px; top: 12px; border: none; background: #f1f4fd; color: #3b4a76;
  border-radius: 8px; padding: 5px 9px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.af-lb-name { font-weight: 700; font-size: 16px; margin-top: 10px; }
.af-lb-sub { font-size: 12px; color: #7080a6; margin-top: 3px; }
.af-lb-row { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 9px; font-size: 12px; color: #3b4a76; }
.af-lb-row span { background: #f1f4fd; border-radius: 7px; padding: 2px 8px; }

/* ══════════ 日期选择条 + 历史模式（10/22 新增）══════════
 * 颜色沿用 styles.css 的同一套值（line #e6ebf6 / text #1b2340 / muted #7080a6 /
 * primary #5f79ff / panel-soft #f7f9ff），保证和面板其它部分完全一致。 */
.af-dates {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: #fff; border: 1px solid #e6ebf6; border-radius: 14px;
  padding: 10px 14px; margin-bottom: 12px;
}
.af-dates-label { font-size: 12.5px; color: #7080a6; margin-right: 2px; }
.af-date {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  border: 1px solid #e6ebf6; background: #fff; border-radius: 11px;
  padding: 7px 13px; font-family: inherit; cursor: pointer;
  transition: background .16s, border-color .16s, box-shadow .16s;
  min-width: 100px;
}
.af-date:hover { border-color: #cfd9f2; background: #fbfcff; }
.af-date .d1 { font-size: 13px; font-weight: 600; color: #1b2340; display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.af-date .d2 { font-size: 11.5px; color: #9aa7c6; font-variant-numeric: tabular-nums; white-space: nowrap; }
.af-date.on { background: #5f79ff; border-color: #5f79ff; box-shadow: 0 6px 14px rgba(95,121,255,.28); }
.af-date.on .d1 { color: #fff; }
.af-date.on .d2 { color: rgba(255,255,255,.82); }
/* 「超出 N 天」的灰块：只做边界提示，不可点 */
.af-date.off { cursor: not-allowed; opacity: .55; background: #f7f9ff; border-style: dashed; min-width: 110px; }
.af-date.off .d1 { color: #9aa7c6; }
.af-live-dot { width: 6px; height: 6px; border-radius: 50%; background: #17b26a; flex: none; }
.af-date.on .af-live-dot { background: #fff; }
.af-dates-hint { margin-left: auto; font-size: 11.5px; color: #b0b9cf; white-space: nowrap; }

/* 历史模式提示条：只在看过去某天时出现 */
.af-histnote {
  display: none; align-items: center; gap: 9px;
  background: #fffaf0; border: 1px solid #f3dfbe; border-left: 3px solid #ffb347;
  border-radius: 11px; padding: 9px 14px; font-size: 12.5px; color: #7a5a1e; margin-bottom: 12px;
}
.af-histnote.show { display: flex; }
.af-histnote b { color: #4a3410; }
.af-histnote .af-btn { margin-left: auto; color: #7a5a1e; border-color: #e8d3ab; }
.af-histnote .af-btn:hover { background: #fff; border-color: #ffb347; }

/* 历史模式下的吸顶小结条：不再是「最近 N 分钟」，改成当天整体摘要 */
.af-band.hist { background: #fffaf0; color: #7a5a1e; }
.af-band.hist b { color: #b26a00; }
.af-band.hist i { color: #a98a5a; }
.af-band.hist .af-band-dot { background: #ffb347; }

/* 历史模式下暂停 / 高亮范围置灰：它们只对实时流有意义 */
.af-btn:disabled, .af-win:disabled { opacity: .45; cursor: not-allowed; }
.af-btn:disabled:hover { border-color: #e6ebf6; background: #fff; }

@media (max-width: 900px) {
  .af-stats { grid-template-columns: repeat(2, 1fr); }
  .af-ev { grid-template-columns: 92px 46px 1fr 62px; }
  .af-expire { display: none; }
  /* 新增：窄屏收起「仅保留最近 N 天」提示、日期块压缩，避免横向溢出 */
  .af-dates-hint { display: none; }
  .af-date { min-width: 86px; padding: 6px 10px; }
}
