/* ============================================================
   FACECHECK · 身份核验控制台
   暗色安全控制台 · 琥珀主色 · Chakra Petch + IBM Plex Mono
   ============================================================ */

@font-face {
  font-family: 'Chakra Petch';
  src: url('/fonts/chakra-petch-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Chakra Petch';
  src: url('/fonts/chakra-petch-500.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Chakra Petch';
  src: url('/fonts/chakra-petch-600.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Chakra Petch';
  src: url('/fonts/chakra-petch-700.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/fonts/ibm-plex-mono-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/fonts/ibm-plex-mono-500.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}

:root {
  --bg: #080c10;
  --bg-2: #0b1117;
  --surface: #111820;
  --surface-2: #151e27;
  --surface-3: #1a2530;
  --line: #1f2c38;
  --line-soft: #17212b;
  --text: #e7edf1;
  --text-dim: #8fa0ab;
  --text-faint: #5a6b77;
  --amber: #ffb454;
  --amber-soft: rgba(255, 180, 84, 0.12);
  --cyan: #43d0d8;
  --ok: #4ade80;
  --err: #ff6b6b;
  --font-display: 'Chakra Petch', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'IBM Plex Mono', 'Consolas', monospace;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* hidden 属性必须始终生效——组件里的 display:grid/flex 会覆盖 UA 默认的 display:none */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  font-family: var(--font-display);
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(255, 180, 84, 0.05), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(67, 208, 216, 0.04), transparent 60%),
    var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* 背景网格纹理 */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(67, 208, 216, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(67, 208, 216, 0.03) 1px, transparent 1px);
  background-size: 44px 44px;
  pointer-events: none;
  z-index: 0;
}
/* 轻微噪点 */
body::after {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.04 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

.mono { font-family: var(--font-mono); }

/* ============ 布局骨架 ============ */
.shell {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: 248px 1fr;
  height: 100vh;
}

/* ============ 侧边栏 ============ */
.sidebar {
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(13, 18, 24, 0.95), rgba(9, 13, 18, 0.98));
  border-right: 1px solid var(--line);
  padding: 22px 16px 18px;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 2px 6px 20px; border-bottom: 1px solid var(--line-soft); }
.brand-mark { width: 42px; height: 42px; flex: none; }
.brand-name { font-size: 20px; font-weight: 700; letter-spacing: 0.5px; color: var(--text); }
.brand-name em { color: var(--amber); font-style: normal; }
.brand-sub { font-size: 10.5px; letter-spacing: 2.5px; color: var(--text-faint); text-transform: uppercase; margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 6px; margin-top: 22px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: color 0.18s, background 0.18s, border-color 0.18s, transform 0.12s;
}
.nav-item svg { width: 19px; height: 19px; flex: none; }
.nav-item:hover { color: var(--text); background: var(--surface); }
.nav-item:active { transform: scale(0.985); }
.nav-item.active {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: rgba(255, 180, 84, 0.28);
}
.nav-badge {
  margin-left: auto;
  min-width: 22px; height: 20px;
  display: grid; place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11.5px;
}
.nav-item.active .nav-badge { background: rgba(255, 180, 84, 0.16); color: var(--amber); }

.sidebar-foot { margin-top: auto; padding: 16px 6px 0; border-top: 1px solid var(--line-soft); }
.sys-status { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 1.2px; color: var(--ok); }
.sys-version { margin-top: 7px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 1px; color: var(--text-faint); }
.sys-version em { color: var(--text-dim); font-style: normal; }

.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; position: relative; flex: none; }
.pulse-dot::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  border: 1px solid currentColor; opacity: 0.6;
  animation: pulse 2s ease-out infinite;
}
@keyframes pulse { 0% { transform: scale(0.5); opacity: 0.8; } 100% { transform: scale(1.5); opacity: 0; } }

/* ============ 主区 ============ */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 30px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(11, 17, 23, 0.7), rgba(8, 12, 16, 0.4));
  backdrop-filter: blur(6px);
}
.topbar-title { font-size: 21px; font-weight: 600; letter-spacing: 0.5px; }
.title-caret { color: var(--amber); animation: caret 1.1s step-end infinite; }
@keyframes caret { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.topbar-meta { display: flex; align-items: center; gap: 12px; }
.status-chip {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 1px;
  color: var(--text-dim);
}
.status-chip.online { color: var(--ok); border-color: rgba(74, 222, 128, 0.3); }
.status-chip.offline { color: var(--err); border-color: rgba(255, 107, 107, 0.3); }
.clock { font-size: 13px; color: var(--text-dim); letter-spacing: 0.5px; }

/* ============ 视图容器 ============ */
.view {
  flex: 1;
  padding: 26px 30px 34px;
  overflow-y: auto;
  animation: viewIn 0.35s ease both;
}
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============ 人员库 ============ */
.view-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }

.search {
  flex: 1; max-width: 380px;
  padding: 11px 16px 11px 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235a6b77' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 14px center;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search::placeholder { color: var(--text-faint); }
.search:focus { border-color: rgba(255, 180, 84, 0.5); box-shadow: 0 0 0 3px rgba(255, 180, 84, 0.08); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.12s, box-shadow 0.2s, background 0.2s, border-color 0.2s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--amber); color: #17100a; }
.btn-primary:hover { box-shadow: 0 6px 24px rgba(255, 180, 84, 0.35); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-faint); }
.btn-danger { background: transparent; border-color: rgba(255, 107, 107, 0.4); color: var(--err); }
.btn-danger:hover { background: rgba(255, 107, 107, 0.1); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* 人员卡片 */
.person-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
  gap: 14px;
}
.person-card {
  position: relative;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
  animation: cardIn 0.4s ease both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.person-card:hover { transform: translateY(-3px); border-color: rgba(255, 180, 84, 0.4); box-shadow: var(--shadow); }

/* 卡片角标（角落括号装饰） */
.person-card::before {
  content: '';
  position: absolute; top: 7px; right: 7px;
  width: 12px; height: 12px;
  border-top: 2px solid var(--amber); border-right: 2px solid var(--amber);
  opacity: 0; transition: opacity 0.2s;
}
.person-card:hover::before { opacity: 1; }

.pc-top { display: flex; align-items: center; gap: 12px; }
.pc-thumb {
  width: 52px; height: 52px; flex: none;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-3);
  border: 1px solid var(--line);
  position: relative;
}
.pc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pc-thumb .pc-ph { width: 100%; height: 100%; display: grid; place-items: center; font-weight: 700; font-size: 20px; color: var(--text-faint); }
.pc-count {
  position: absolute; right: -5px; bottom: -5px;
  min-width: 18px; height: 18px; padding: 0 5px;
  display: grid; place-items: center;
  border-radius: 999px;
  background: var(--amber); color: #17100a;
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  box-shadow: 0 0 0 2px var(--surface);
}
.pc-info { min-width: 0; }
.pc-name { font-size: 15.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-no { margin-top: 3px; font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); letter-spacing: 0.5px; }
.pc-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; padding-top: 11px; border-top: 1px dashed var(--line-soft); }
.pc-dept { font-size: 12px; color: var(--text-dim); }
.pc-date { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }

.empty { text-align: center; padding: 70px 20px; color: var(--text-faint); }
.empty svg { width: 56px; height: 56px; opacity: 0.6; }
.empty p { margin: 16px 0 4px; font-size: 16px; font-weight: 600; color: var(--text-dim); }
.empty span { font-size: 13px; }

/* ============ 人脸识别 ============ */
.recognize-layout { display: grid; grid-template-columns: 1fr; gap: 22px; max-width: 1120px; }
.recognize-layout.with-result { grid-template-columns: 1fr 1fr; }
@media (max-width: 960px) { .recognize-layout.with-result { grid-template-columns: 1fr; } }

.dropzone {
  position: relative;
  min-height: 320px;
  border: 1.5px dashed var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(21, 30, 39, 0.6), rgba(17, 24, 32, 0.5));
  display: grid; place-items: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  overflow: hidden;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--amber); background: rgba(255, 180, 84, 0.05); }
.dropzone.dragover .dz-inner { transform: scale(1.02); }

.dz-inner { text-align: center; padding: 40px; transition: transform 0.2s; }
.dz-icon { width: 74px; height: 74px; color: var(--amber); margin: 0 auto 20px; }
.dz-title { font-size: 18px; font-weight: 600; color: var(--text); }
.dz-sub { margin-top: 8px; font-size: 13px; color: var(--text-faint); }
.dz-link { color: var(--amber); text-decoration: underline; text-underline-offset: 3px; }
.btn-recognize { margin-top: 24px; }

/* ============ 实时识别（摄像头） ============ */
.live-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; max-width: 1120px; }
@media (max-width: 960px) { .live-layout { grid-template-columns: 1fr; } }

.cam-stage { display: grid; gap: 14px; align-content: start; }
.cam-frame {
  position: relative; aspect-ratio: 16 / 9;
  background: #04070a; border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; box-shadow: var(--shadow);
}
.cam-frame video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.cam-frame canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.cam-placeholder {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
  color: var(--text-faint);
  background:
    radial-gradient(circle at 50% 45%, rgba(67, 208, 216, 0.06), transparent 55%),
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(255, 255, 255, 0.015) 3px 4px);
}
.cam-placeholder svg { width: 58px; height: 58px; opacity: 0.55; }
.cam-placeholder p { margin: 0; color: var(--text-dim); font-family: var(--font-display); font-size: 15px; letter-spacing: 0.05em; }
.cam-placeholder span { font-size: 12px; }

.cam-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cam-status { font-size: 12px; color: var(--text-faint); letter-spacing: 0.12em; }
.cam-status.on { color: var(--ok); }
.cam-status.on::before { content: '● '; animation: blink 1.2s ease-in-out infinite; }
.cam-status.err { color: var(--err); }

.cam-warn {
  font-size: 12px; line-height: 1.6; color: var(--amber);
  background: var(--amber-soft); border: 1px solid rgba(255, 180, 84, 0.25);
  border-radius: 8px; padding: 8px 11px;
}

.live-side { display: grid; gap: 14px; align-content: start; }
.live-meta { display: flex; gap: 10px; flex-wrap: wrap; }
.live-results { display: grid; gap: 10px; align-content: start; max-height: 520px; overflow-y: auto; padding-right: 2px; }

@keyframes blink { 50% { opacity: 0.35; } }

/* 结果区 */
.result { display: grid; gap: 16px; align-content: start; animation: viewIn 0.35s ease both; }
.stage-frame { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #05080b; }
.stage-imgwrap { position: relative; }
.stage-imgwrap img { display: block; width: 100%; height: auto; max-height: 60vh; }

/* 扫描线 */
.scanline {
  position: absolute; left: 0; right: 0; top: 0;
  height: 46px;
  background: linear-gradient(180deg, transparent, rgba(67, 208, 216, 0.22), rgba(67, 208, 216, 0.5), rgba(67, 208, 216, 0.22), transparent);
  box-shadow: 0 0 24px rgba(67, 208, 216, 0.35);
  opacity: 0; pointer-events: none;
}
.scanline.anim { animation: scan 1.5s ease-in-out infinite; }
@keyframes scan { 0% { top: 0; } 100% { top: 100%; } }

/* 检测框叠加 */
.det-overlay { position: absolute; inset: 0; pointer-events: none; }
.det-box { position: absolute; border: 1.5px solid var(--amber); }
.det-box.hit { border-color: var(--ok); }
.det-box::before, .det-box::after {
  content: ''; position: absolute; width: 14px; height: 14px;
}
.det-box::before { top: -1px; left: -1px; border-top: 3px solid; border-left: 3px solid; border-color: inherit; }
.det-box::after { bottom: -1px; right: -1px; border-bottom: 3px solid; border-right: 3px solid; border-color: inherit; }
.det-tag {
  position: absolute; left: -1px; bottom: 100%;
  transform: translateY(-4px);
  display: flex; align-items: center; gap: 8px;
  padding: 4px 9px;
  border-radius: 5px 5px 0 0;
  background: var(--amber);
  color: #17100a;
  font-family: var(--font-mono);
  font-size: 11.5px; font-weight: 500;
  white-space: nowrap;
}
.det-box.hit .det-tag { background: var(--ok); color: #052b12; }
.det-tag .sim { opacity: 0.75; }

.stage-status {
  position: absolute; left: 14px; top: 14px;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 13px;
  border-radius: 6px;
  background: rgba(5, 8, 11, 0.8);
  border: 1px solid rgba(67, 208, 216, 0.4);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 12px; letter-spacing: 1.5px;
}
.stage-caption { margin-top: 10px; font-size: 11px; letter-spacing: 1.5px; color: var(--text-faint); text-align: center; }

.result-meta {
  display: flex; flex-wrap: wrap; gap: 8px;
  font-size: 12px; letter-spacing: 0.5px;
}
.meta-chip { padding: 5px 10px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); color: var(--text-dim); }

.match-list { display: flex; flex-direction: column; gap: 10px; }
.match-card {
  display: flex; align-items: center; gap: 13px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  animation: cardIn 0.4s ease both;
}
.match-card.miss { border-style: dashed; }
.match-avatar {
  width: 42px; height: 42px; flex: none;
  border-radius: 8px;
  display: grid; place-items: center;
  background: var(--surface-3);
  border: 1px solid var(--line);
  font-weight: 700; font-size: 16px;
  color: var(--amber);
}
.match-card.hit .match-avatar { background: rgba(74, 222, 128, 0.14); color: var(--ok); border-color: rgba(74, 222, 128, 0.35); }
.match-info { flex: 1; min-width: 0; }
.match-name { font-size: 15px; font-weight: 600; color: var(--text); }
.match-sub { margin-top: 2px; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-faint); }
.match-score { text-align: right; flex: none; }
.match-pct { font-family: var(--font-mono); font-size: 16px; font-weight: 500; }
.match-card.hit .match-pct { color: var(--ok); }
.match-card.miss .match-pct { color: var(--text-faint); }
.match-bar {
  width: 110px; height: 4px; margin-top: 6px;
  border-radius: 2px;
  background: var(--surface-3);
  overflow: hidden;
}
.match-bar i { display: block; height: 100%; background: var(--amber); border-radius: 2px; }
.match-card.hit .match-bar i { background: var(--ok); }
.match-empty { padding: 26px; text-align: center; border: 1px dashed var(--line); border-radius: 10px; color: var(--text-faint); font-size: 13px; }

/* ============ 识别记录 ============ */
.filters { display: flex; align-items: center; gap: 10px; }
.filters select {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 13.5px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.filters select:hover { color: var(--text); border-color: var(--text-faint); }
.filters select:focus { border-color: rgba(255, 180, 84, 0.5); }
#btn-log-clear { margin-left: auto; }

.log-list { display: flex; flex-direction: column; gap: 9px; }
.log-row {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  animation: cardIn 0.35s ease both;
}
.log-row:hover { transform: translateY(-2px); border-color: rgba(255, 180, 84, 0.35); }
.log-time { width: 150px; flex: none; font-size: 12px; color: var(--text-dim); }
.log-face { width: 46px; flex: none; text-align: center; font-size: 12px; color: var(--text-faint); }
.log-info { flex: 1; min-width: 0; }
.log-name { display: block; font-size: 15px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-name.miss { color: var(--text-dim); }
.log-sub { display: block; margin-top: 2px; font-size: 11px; color: var(--text-faint); }
.log-score { width: 52px; flex: none; text-align: right; font-family: var(--font-mono); font-size: 16px; font-weight: 500; color: var(--ok); }
.log-score .dim { color: var(--text-faint); }
.log-thumb {
  width: 46px; height: 46px; flex: none;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--surface-3);
}
.log-thumb.no { display: grid; place-items: center; color: var(--text-faint); font-size: 15px; }

.chip {
  display: inline-flex; align-items: center; justify-content: center;
  height: 22px; padding: 0 9px;
  border-radius: 999px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  white-space: nowrap;
}
.chip-src.upload { background: rgba(255, 180, 84, 0.14); color: var(--amber); border: 1px solid rgba(255, 180, 84, 0.3); }
.chip-src.live { background: rgba(67, 208, 216, 0.12); color: var(--cyan); border: 1px solid rgba(67, 208, 216, 0.3); }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 20px; }
.pager-info { font-size: 12px; color: var(--text-dim); }

/* 记录详情弹窗 */
.log-loading { padding: 34px; text-align: center; color: var(--text-faint); }
.ld-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ld-thumb-wrap { margin: 16px 0; }
.ld-thumb {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-2);
}
.ld-face { margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2); overflow: hidden; }
.ld-face-head { padding: 9px 12px; font-size: 11.5px; color: var(--text-dim); background: var(--surface); border-bottom: 1px solid var(--line-soft); }
.ld-matches { list-style: none; padding: 6px 12px; }
.ld-matches li { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.ld-matches li + li { border-top: 1px dashed var(--line-soft); }
.ld-m-name { flex: 1; font-size: 14px; font-weight: 600; color: var(--text); }
.ld-m-no { flex: 1; font-size: 11.5px; color: var(--text-faint); }
.ld-m-sim { font-size: 13px; font-weight: 500; color: var(--ok); }
.ld-nomatch { padding: 10px 12px; font-size: 12.5px; color: var(--text-faint); }

/* ============ 模态框 ============ */
.modal-root {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: rgba(4, 6, 9, 0.72);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(520px, calc(100vw - 40px));
  max-height: 86vh;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  animation: modalIn 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(0.97); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line-soft);
}
.modal-title { font-size: 17px; font-weight: 600; }
.modal-title em { color: var(--amber); font-style: normal; }
.modal-close {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 15px;
  transition: color 0.15s, border-color 0.15s;
}
.modal-close:hover { color: var(--text); border-color: var(--text-faint); }
.modal-body { padding: 22px; }

.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 7px; font-size: 12.5px; color: var(--text-dim); letter-spacing: 0.5px; }
.field input, .field select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.field input:focus, .field select:focus { border-color: rgba(255, 180, 84, 0.5); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* 人员详情 - 人脸注册区 */
.detail-grid { display: flex; gap: 20px; align-items: flex-start; }
.detail-main { flex: 1; }
.detail-thumb { width: 92px; height: 92px; flex: none; border-radius: 12px; overflow: hidden; background: var(--surface-3); border: 1px solid var(--line); }
.detail-thumb img { width: 100%; height: 100%; object-fit: cover; }
.detail-thumb .pc-ph { width: 100%; height: 100%; display: grid; place-items: center; font-size: 34px; font-weight: 700; color: var(--text-faint); }
.detail-name { font-size: 20px; font-weight: 700; }
.detail-no { margin-top: 3px; font-family: var(--font-mono); font-size: 13px; color: var(--text-faint); }
.detail-meta { margin-top: 10px; font-size: 13px; color: var(--text-dim); line-height: 1.7; }

.face-upload {
  margin-top: 20px;
  border: 1.5px dashed var(--line);
  border-radius: 10px;
  padding: 18px;
  text-align: center;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 13.5px;
  transition: border-color 0.2s, background 0.2s;
}
.face-upload:hover { border-color: var(--amber); background: var(--amber-soft); }
.face-upload strong { color: var(--amber); }

.face-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.face-item {
  position: relative;
  width: 76px; height: 76px;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.face-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.face-item .face-del {
  position: absolute; inset: auto 0 0 0;
  height: 22px;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.6);
  color: var(--err);
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.face-item .face-replace {
  position: absolute; inset: 0 0 auto 0;
  height: 22px;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.6);
  color: var(--cyan);
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.face-item:hover .face-del,
.face-item:hover .face-replace { opacity: 1; }

/* ============ 登录门 ============ */
.login-root {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center;
  background:
    radial-gradient(1200px 600px at 72% -10%, rgba(67, 208, 216, 0.07), transparent 60%),
    radial-gradient(900px 520px at 8% 112%, rgba(255, 180, 84, 0.06), transparent 55%),
    var(--bg);
}
.login-root::before {
  content: ''; position: absolute; inset: 0;
  background:
    linear-gradient(rgba(31, 44, 56, 0.4) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 44, 56, 0.4) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(circle at center, #000 28%, transparent 78%);
          mask-image: radial-gradient(circle at center, #000 28%, transparent 78%);
  pointer-events: none;
}
.login-panel {
  position: relative;
  width: min(400px, calc(100vw - 40px));
  padding: 40px 40px 30px;
  text-align: center;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  animation: modalIn 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
.brand-mark.lg { width: 56px; height: 56px; margin: 0 auto 16px; display: block; }
.login-brand { font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: 3px; color: var(--text); }
.login-brand em { font-style: normal; color: var(--amber); }
.login-sub { margin-top: 6px; font-size: 13px; color: var(--text-dim); }
.login-caption {
  margin: 18px auto 0; width: fit-content;
  padding: 5px 12px; border-radius: 5px;
  font-size: 11px; letter-spacing: 2px; color: var(--cyan);
  border: 1px solid rgba(67, 208, 216, 0.3);
  background: rgba(67, 208, 216, 0.06);
}
.login-form { margin-top: 26px; display: flex; flex-direction: column; gap: 16px; text-align: left; }
.login-field span { display: block; margin-bottom: 6px; font-size: 12px; color: var(--text-dim); letter-spacing: 1px; }
.login-field input {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg-2); color: var(--text);
  font-family: var(--font-mono); font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.login-field input:focus { border-color: rgba(255, 180, 84, 0.5); box-shadow: 0 0 0 3px rgba(255, 180, 84, 0.08); }
.login-btn { width: 100%; margin-top: 6px; }
.login-btn .arr { transition: transform 0.2s; }
.login-btn:hover .arr { transform: translateX(4px); }
.login-hint { margin-top: 22px; font-size: 11px; letter-spacing: 1.5px; color: var(--text-faint); }

/* 登出 */
.logout-btn {
  display: block; width: 100%;
  padding: 8px 0; margin-bottom: 14px;
  background: transparent; border: 1px dashed var(--line); border-radius: 6px;
  color: var(--text-faint); font-size: 12px; letter-spacing: 1px; cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.logout-btn:hover { color: var(--amber); border-color: rgba(255, 180, 84, 0.4); }

/* ============ Toast ============ */
.toast-root {
  position: fixed; right: 22px; bottom: 22px; z-index: 90;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  min-width: 220px; max-width: 340px;
  padding: 13px 16px;
  border-radius: 9px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 13.5px;
  animation: toastIn 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
.toast .t-icon { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.toast.ok .t-icon { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.toast.err .t-icon { background: var(--err); box-shadow: 0 0 8px var(--err); }
.toast.info .t-icon { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.toast.out { animation: toastOut 0.25s ease both; }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

/* ============ 滚动条 ============ */
.view::-webkit-scrollbar, .modal::-webkit-scrollbar { width: 9px; }
.view::-webkit-scrollbar-thumb, .modal::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 5px; }
.view::-webkit-scrollbar-track, .modal::-webkit-scrollbar-track { background: transparent; }

/* ============ 响应式 ============ */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { flex-direction: row; align-items: center; padding: 12px 16px; border-right: none; border-bottom: 1px solid var(--line); }
  .brand { border-bottom: none; padding: 0; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-sub { display: none; }
  .nav { flex-direction: row; margin: 0 0 0 auto; }
  .nav-badge { display: none; }
  .sidebar-foot { display: none; }
  .topbar { padding: 14px 18px; }
  .view { padding: 18px; }
  .view-head { flex-direction: column; align-items: stretch; }
  .search { max-width: none; }
}
