/* ============================================================
   管理后台 — Design System v2.0
   侧边栏 + 内容区 布局
   ============================================================ */

:root {
  --brand-600: #4338CA;
  --brand-500: #4F46E5;
  --brand-400: #6366F1;
  --brand-300: #818CF8;
  --brand-100: #E0E7FF;
  --brand-50:  #EEF2FF;

  --success-500: #10B981;
  --success-100: #D1FAE5;
  --success-50:  #ECFDF5;
  --warning-500: #F59E0B;
  --warning-100: #FEF3C7;
  --warning-50:  #FFFBEB;
  --danger-500:  #EF4444;
  --danger-100:  #FEE2E2;
  --danger-50:   #FEF2F2;

  --text-900: #111827;
  --text-800: #1F2937;
  --text-700: #374151;
  --text-600: #4B5563;
  --text-500: #6B7280;
  --text-400: #9CA3AF;
  --text-300: #D1D5DB;
  --text-200: #E5E7EB;

  --bg-page: #F0F2F5;
  --bg-card: #FFFFFF;
  --bg-hover: #F8FAFC;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;
  --radius-2xl: 16px;

  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.03), 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -2px rgba(0,0,0,0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.06), 0 4px 6px -4px rgba(0,0,0,0.03);
  --shadow-nav: 0 1px 3px rgba(0,0,0,0.05), inset 0 -1px 0 rgba(0,0,0,0.05);

  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

body {
  font-family: 'Inter', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  background: var(--bg-page);
  min-height: 100vh;
  color: var(--text-700);
  line-height: 1.6;
  /* 后台没有顶部固定导航，抵消 style.css 为首页导航预留的 body padding-top */
  padding-top: 0 !important;
}

/* ============================================================
   Top Bar (56px)
   ============================================================ */
.admin-topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: 56px;
  background: var(--bg-card);
  box-shadow: var(--shadow-nav);
  border-bottom: 1px solid var(--text-200);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
}
.admin-topbar-left {
  display: flex; align-items: center; gap: 12px;
}
.admin-topbar-logo {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-400));
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px; font-weight: 700;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}
.admin-topbar-title {
  font-size: 15px; font-weight: 600; color: var(--text-800);
}
.admin-topbar-right {
  display: flex; align-items: center; gap: 10px;
}
.admin-topbar-user {
  font-size: 12px; color: var(--text-500);
}

/* Hamburger (mobile) */
.hamburger-btn {
  display: none;
  width: 36px; height: 36px;
  border: none; border-radius: var(--radius-md);
  background: transparent;
  cursor: pointer;
  font-size: 20px;
  color: var(--text-600);
  align-items: center; justify-content: center;
}
.hamburger-btn:hover { background: var(--bg-hover); }

/* ============================================================
   Sidebar (220px)
   ============================================================ */
.admin-sidebar {
  position: fixed; left: 0; top: 56px;
  width: 220px; height: calc(100vh - 56px);
  background: var(--bg-card);
  border-right: 1px solid var(--text-200);
  padding: 16px 12px;
  overflow-y: auto;
  z-index: 40;
  transition: transform var(--transition-base);
}
.admin-sidebar nav { display: flex; flex-direction: column; gap: 4px; }

.sidebar-item {
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px; height: 44px;
  border-radius: var(--radius-lg);
  font-size: 14px; font-weight: 500;
  color: var(--text-600);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none; background: transparent;
  font-family: inherit;
}
.sidebar-item:hover {
  background: var(--bg-hover);
  color: var(--text-700);
}
.sidebar-item.active {
  background: var(--brand-50);
  color: var(--brand-500);
  font-weight: 600;
  border-left: 3px solid var(--brand-500);
  padding-left: 13px;
}
.sidebar-icon { font-size: 18px; width: 20px; text-align: center; flex-shrink: 0; }

/* ============================================================
   Main Content Area
   ============================================================ */
.admin-main {
  margin-left: 220px;
  margin-top: 56px;
  padding: 24px;
  min-height: calc(100vh - 56px);
}
.admin-main.full-width {
  margin-left: 0;
}

/* Page header */
.admin-page-header {
  margin-bottom: 24px;
}
.admin-page-header h2 {
  font-size: 22px; font-weight: 700; color: var(--text-900);
  letter-spacing: -0.01em;
}
.admin-page-header p {
  font-size: 13px; color: var(--text-500); margin-top: 4px;
}

/* ============================================================
   Stats Grid
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--text-200);
  transition: all var(--transition-base);
}
.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.stat-card-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-bottom: 12px;
}
.stat-card-icon svg { width: 20px; height: 20px; }
.sidebar-icon svg { width: 18px; height: 18px; }
.stat-card-icon.brand { background: var(--brand-50); color: var(--brand-500); }
.stat-card-icon.success { background: var(--success-50); color: var(--success-500); }
.stat-card-icon.warning { background: var(--warning-50); color: var(--warning-500); }
.stat-card-icon.danger { background: var(--danger-50); color: var(--danger-500); }

.stat-value {
  font-size: 32px; font-weight: 700; color: var(--brand-500);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.stat-value.ok { color: var(--success-500); }
.stat-value.error { color: var(--danger-500); }

.stat-label {
  font-size: 12px; color: var(--text-500); margin-top: 4px;
}

/* Status dot indicator */
.status-indicator {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; color: var(--text-700);
}
.status-indicator::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
}
.status-indicator.ok::before {
  background: var(--success-500);
  animation: pulse-dot 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
.status-indicator.error::before { background: var(--danger-500); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ============================================================
   Content Sections
   ============================================================ */
.admin-section {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--text-200);
}
.admin-section h3 {
  font-size: 18px; font-weight: 600; color: var(--text-800);
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 8px;
}

/* ============================================================
   Settings Items
   ============================================================ */
.setting-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid #F3F4F6;
  flex-wrap: wrap; gap: 12px;
  transition: background var(--transition-fast);
}
.setting-item:hover { background: var(--bg-hover); margin: 0 -12px; padding-left: 12px; padding-right: 12px; border-radius: var(--radius-md); }
.setting-item:last-child { border-bottom: none; }
.setting-item:last-child:hover { margin-bottom: -12px; }

.setting-item-info h4 {
  font-size: 14px; font-weight: 600; color: var(--text-700);
  margin-bottom: 4px;
}
.setting-item-info p {
  font-size: 12px; color: var(--text-500);
}

/* ============================================================
   Info Grid (System Info)
   ============================================================ */
.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.info-item {
  background: var(--bg-hover);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--text-200);
}
.info-item-label {
  font-size: 12px; color: var(--text-500); display: block; margin-bottom: 6px;
}
.info-item-value {
  font-size: 15px; color: var(--text-700); font-weight: 600;
}

/* Cache progress */
.cache-progress {
  margin-top: 8px;
}
.cache-progress-bar {
  height: 8px; background: var(--text-200);
  border-radius: 4px; overflow: hidden;
}
.cache-progress-fill {
  height: 100%; background: var(--brand-500);
  border-radius: 4px;
  transition: width 500ms cubic-bezier(0.4, 0, 0.2, 1);
}
.cache-progress-text {
  font-size: 11px; color: var(--text-500); margin-top: 6px;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px;
  border: none; border-radius: var(--radius-lg);
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.btn-primary {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-400));
  color: #fff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--text-200);
  color: var(--text-700);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--text-300);
}

.btn-outline {
  background: transparent;
  color: var(--text-600);
  border: 1px solid var(--text-200);
  font-size: 13px;
  padding: 6px 14px;
}
.btn-outline:hover { background: var(--bg-hover); }

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; padding: 14px; font-size: 15px; margin-top: 6px; }

/* Danger button */
.btn-danger {
  background: var(--bg-card);
  border: 1px solid #FECACA;
  color: var(--danger-500);
}
.btn-danger:hover:not(:disabled) {
  background: var(--danger-50);
  border-color: var(--danger-500);
}

/* ============================================================
   Alerts
   ============================================================ */
.alert {
  padding: 12px 14px; border-radius: var(--radius-md);
  font-size: 13px; margin-bottom: 16px;
}
.alert-warning {
  background: var(--warning-50); color: #92400e;
  border: 1px solid var(--warning-100);
}

/* ============================================================
   Forms
   ============================================================ */
.admin-form { text-align: left; }

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px; font-weight: 600;
  color: var(--text-600);
  margin-bottom: 6px;
}

.form-input {
  width: 100%; height: 44px;
  padding: 0 16px;
  border: 1px solid var(--text-200);
  border-radius: var(--radius-md);
  font-size: 14px; font-family: inherit;
  transition: all var(--transition-fast);
  background: var(--bg-card);
  color: var(--text-700);
}
.form-input::placeholder { color: var(--text-400); }
.form-input:hover { border-color: var(--text-300); }
.form-input:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-message { font-size: 13px; margin-top: 8px; min-height: 20px; }
.form-message.error { color: var(--danger-500); }
.form-message.success { color: var(--success-500); }

/* ============================================================
   Login Page
   ============================================================ */
.admin-login-container {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: var(--bg-page);
}

.admin-login-card {
  background: var(--bg-card);
  border-radius: var(--radius-2xl);
  padding: 40px 36px;
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--text-200);
  text-align: center;
  animation: fadeUp 0.4s ease-out;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.admin-login-card h1 { font-size: 22px; font-weight: 700; color: var(--text-800); margin-bottom: 4px; }
.subtitle { color: var(--text-500); font-size: 14px; margin-bottom: 28px; }

.back-link {
  display: inline-block; margin-top: 18px;
  color: var(--text-500); font-size: 13px; text-decoration: none;
}
.back-link:hover { color: var(--brand-500); }

/* ============================================================
   Modals
   ============================================================ */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  background: var(--bg-card); border-radius: var(--radius-2xl);
  padding: 28px; width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.25s ease;
}
@keyframes scaleIn { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: scale(1); } }

.modal-card h3 {
  font-size: 17px; font-weight: 600; margin-bottom: 4px; color: var(--text-800);
}
.modal-desc { font-size: 13px; color: var(--text-500); margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; margin-top: 10px; }
.modal-actions .btn { flex: 1; }

/* ============================================================
   Log Viewer
   ============================================================ */

/* Log file stat card smaller value */
.stat-value-sm {
  font-size: 22px; font-weight: 700; color: var(--brand-500);
  font-variant-numeric: tabular-nums; line-height: 1.2;
}

/* Log level segmented bar */
.log-level-bar-wrap { margin: 8px 0 16px; }
.log-level-bar {
  display: flex; height: 20px;
  border-radius: 6px; overflow: hidden;
  background: var(--bg-hover);
}
.log-level-seg {
  height: 100%; transition: width 400ms ease;
  min-width: 2px;
}
.log-level-seg.info { background: #3B82F6; }
.log-level-seg.warning { background: var(--warning-500); }
.log-level-seg.error { background: var(--danger-500); }
.log-level-seg.debug { background: var(--text-400); }

/* Legend */
.log-level-legend {
  display: flex; gap: 20px; flex-wrap: wrap;
  font-size: 13px; color: var(--text-500);
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend-item.info .legend-dot { background: #3B82F6; }
.legend-item.warning .legend-dot { background: var(--warning-500); }
.legend-item.error .legend-dot { background: var(--danger-500); }
.legend-item.debug .legend-dot { background: var(--text-400); }

/* Log viewer section */
.log-viewer-section { overflow: hidden; }

.log-security-notice {
  background: var(--warning-50); border: 1px solid var(--warning-100);
  color: #92400e; font-size: 12px;
  padding: 8px 14px; border-radius: var(--radius-md);
  margin-bottom: 12px;
}

.log-viewer-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap; gap: 12px;
}
.log-viewer-header h3 { margin-bottom: 0 !important; }

/* Log tabs */
.log-tabs { display: flex; gap: 4px; }
.log-tab {
  padding: 6px 16px; border: 1px solid var(--text-200);
  border-radius: var(--radius-md);
  background: var(--bg-card); color: var(--text-600);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}
.log-tab:hover { background: var(--bg-hover); }
.log-tab.active {
  background: var(--brand-50); color: var(--brand-500);
  border-color: var(--brand-300);
}
.log-tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--danger-100); color: var(--danger-500);
  font-size: 11px; font-weight: 700; margin-left: 4px;
}

/* Log viewer - 浅色高亮风格 */
.log-viewer {
  background: var(--bg-card); border: 1px solid var(--text-200);
  border-radius: var(--radius-md);
  padding: 4px 0; max-height: 400px; overflow-y: auto;
  font-size: 12px; line-height: 1.8;
}
.log-viewer::-webkit-scrollbar { width: 6px; }
.log-viewer::-webkit-scrollbar-track { background: transparent; }
.log-viewer::-webkit-scrollbar-thumb { background: var(--text-200); border-radius: 3px; }

.log-loading { color: var(--text-400); text-align: center; padding: 24px; }
.log-empty { color: var(--text-400); text-align: center; padding: 24px; }

/* Log entry row */
.log-entry {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 12px;
  border-bottom: 1px solid #F3F4F6;
  transition: background 0.1s;
}
.log-entry:last-child { border-bottom: none; }
.log-entry:hover { background: var(--bg-hover); }

.log-time {
  color: #9CA3AF; white-space: nowrap; flex-shrink: 0;
  font-size: 11px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

/* 日志级别：彩色圆点 + 文字标签 */
.log-level {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; white-space: nowrap; flex-shrink: 0;
  min-width: 52px;
}
.log-level::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}
.log-level.info { color: #3B82F6; }
.log-level.warning { color: #D97706; }
.log-level.error { color: #DC2626; }
.log-level.debug { color: #9CA3AF; }
.log-level.unknown { color: #9CA3AF; }

.log-meta { color: var(--text-400); font-size: 10px; white-space: nowrap; flex-shrink: 0; }
.log-msg { color: var(--text-700); word-break: break-all; flex: 1; }
.log-extra { color: var(--text-400); font-size: 11px; white-space: nowrap; }

.log-reqid {
  display: inline-block; padding: 0 4px; border-radius: 3px;
  background: var(--brand-50); color: var(--brand-500);
  font-size: 10px; font-family: 'SF Mono', 'Fira Code', monospace;
}
.log-ip { color: var(--text-400); font-size: 10px; }
.log-user { color: #059669; font-size: 10px; }
.log-action { color: #D97706; font-size: 10px; }

/* 日志筛选工具 */
.log-filters { display: flex; align-items: center; gap: 8px; }
.select-sm {
  height: 32px; padding: 0 8px;
  border: 1px solid var(--text-200); border-radius: var(--radius-md);
  font-size: 13px; font-family: inherit;
  background: var(--bg-card); color: var(--text-600);
  cursor: pointer;
}
.select-sm:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1); }
.btn-ghost {
  background: transparent; border: 1px solid transparent;
  color: var(--text-600);
}
.btn-ghost:hover { background: var(--bg-hover); }

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1024px) {
  .admin-sidebar { width: 220px; }
  .admin-main { margin-left: 220px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .hamburger-btn { display: flex; }
  .admin-sidebar {
    transform: translateX(-100%);
    width: 260px; box-shadow: var(--shadow-lg);
  }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0 !important; }
  .admin-topbar { padding: 0 14px; }
  .admin-topbar-title { font-size: 14px; }

  .admin-main { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat-card { padding: 16px; }
  .stat-value { font-size: 24px; }

  /* 日志行：窄屏改为两行（头部信息 + 正文），避免整行横向溢出 */
  .log-entry { flex-wrap: wrap; row-gap: 2px; }
  .log-msg { flex: 1 1 100%; min-width: 0; }
  .log-meta, .log-extra { white-space: normal; word-break: break-all; }
  .log-viewer { font-size: 12px; }

  /* 概览数值（人脸库名等）窄屏允许折行，避免被省略号截断 */
  .overview-item .overview-value { white-space: normal; overflow: visible; word-break: break-all; line-height: 1.35; }

  .setting-item { flex-direction: column; align-items: flex-start; }
  .info-grid { grid-template-columns: 1fr; }

  .modal-card { padding: 22px; margin: 12px; }
}

@media (max-width: 480px) {
  .admin-login-card { padding: 24px 16px; }
  .admin-login-card h1 { font-size: 20px; }
  .admin-main { padding: 12px 10px; }
  .admin-section { padding: 16px; border-radius: var(--radius-xl); }
  .admin-section h3 { font-size: 16px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card-icon { width: 32px; height: 32px; font-size: 16px; }
  .stat-value { font-size: 20px; }
  .stat-label { font-size: 11px; }
  .setting-item { padding: 12px 0; }
  .admin-topbar { padding: 0 10px; }
  .admin-topbar-title { font-size: 13px; }
  .admin-topbar-user { font-size: 11px; }
  .info-grid { grid-template-columns: 1fr; }
  .modal-card { padding: 18px; }
  .modal-card h3 { font-size: 15px; }
  .btn { padding: 8px 14px; font-size: 13px; }
}

@media (max-width: 360px) {
  .stats-grid { grid-template-columns: 1fr; }
  .log-num { display: none; }
  .admin-login-card { padding: 20px 12px; }
  .admin-login-card h1 { font-size: 18px; }
}

/* Touch devices */
@media (hover: none) and (pointer: coarse) {
  .btn { min-height: 44px; }
  .form-input { min-height: 44px; font-size: 16px; }
}

/* Landscape */
@media (max-height: 500px) and (orientation: landscape) {
  .admin-login-card { padding: 16px 20px; max-width: 480px; }
  .admin-login-card h1 { font-size: 18px; margin-bottom: 0; }
  .subtitle { margin-bottom: 14px; }
}

/* ============================================================
   侧边栏抽屉遮罩（移动端）
   ============================================================ */
.sidebar-mask {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 35;
}
@media (max-width: 768px) {
  .sidebar-mask.show { display: block; animation: fadeIn 0.2s ease; }
}

/* ============================================================
   缓存命中率环形图
   ============================================================ */
.donut-wrap {
  position: relative; width: 64px; height: 64px; margin: 0 auto;
}
.donut { width: 64px; height: 64px; display: block; }
.donut-value {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: var(--success-500);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   日志查看器：行号 + 实时模式
   ============================================================ */
.log-viewer-tools {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.log-num {
  min-width: 28px; text-align: right;
  color: #475569; font-size: 10px;
  flex-shrink: 0; user-select: none;
}
#liveToggle.active {
  background: var(--danger-50); color: var(--danger-500);
  border-color: var(--danger-100);
  animation: livePulse 1.6s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

/* ============================================================
   密码强度指示
   ============================================================ */
.pwd-strength {
  display: flex; align-items: center; gap: 8px; margin-top: 6px;
}
.pwd-strength-bar {
  flex: 1; height: 4px;
  background: var(--text-200); border-radius: 2px; overflow: hidden;
}
.pwd-strength-fill {
  display: block; height: 100%; width: 0;
  border-radius: 2px;
  background: var(--danger-500);
  transition: width 0.25s ease, background 0.25s ease;
}
.pwd-strength-fill.medium { background: var(--warning-500); }
.pwd-strength-fill.strong { background: var(--success-500); }
.pwd-strength-text {
  font-size: 11px; color: var(--text-500); min-width: 14px;
}

/* ============================================================
   移动端弹窗：底部滑入
   ============================================================ */
@media (max-width: 768px) {
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-card {
    max-width: none; margin: 0;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    animation: modalSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  @keyframes modalSlideUp {
    from { transform: translateY(48px); opacity: 0.5; }
    to { transform: translateY(0); opacity: 1; }
  }
}

/* ============================================================
   仪表盘：运行概览条 / 统计副行 / 识别动态 / 配置卡
   ============================================================ */
.overview-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--bg-card);
  border: 1px solid var(--text-200);
  border-radius: var(--radius-xl);
  margin-bottom: 20px;
  overflow: hidden;
}
.overview-item {
  padding: 14px 18px;
  min-width: 0;
}
.overview-item + .overview-item { border-left: 1px solid #F3F4F6; }
.overview-label {
  display: block; font-size: 11px; color: var(--text-400);
  margin-bottom: 4px;
}
.overview-value {
  display: block; font-size: 14px; font-weight: 600; color: var(--text-800);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.overview-value.ok { color: var(--success-500); }

.stat-sub {
  font-size: 11px; color: var(--text-400); margin-top: 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 最近识别动态 */
.recent-events { max-height: 300px; overflow-y: auto; }
.event-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid #F3F4F6;
  font-size: 13px;
}
.event-row:last-child { border-bottom: none; }
.event-time {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 11px; color: var(--text-400);
  flex-shrink: 0;
}
.event-source {
  font-size: 11px; font-weight: 600;
  background: var(--brand-50); color: var(--brand-500);
  padding: 1px 8px; border-radius: 9999px;
  flex-shrink: 0;
}
.event-badge {
  font-size: 11px; font-weight: 600;
  padding: 1px 8px; border-radius: 9999px;
  flex-shrink: 0;
}
.event-badge.ok { background: var(--success-50); color: #059669; }
.event-badge.warn { background: var(--warning-50); color: #D97706; }
.event-badge.err { background: var(--danger-50); color: #DC2626; }
.event-ip {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 11px; color: var(--text-500);
  background: var(--bg-hover);
  border: 1px solid #F3F4F6;
  padding: 1px 8px; border-radius: 9999px;
  flex-shrink: 0;
}
.event-duration {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 11px; color: var(--text-400);
  flex-shrink: 0;
}
.event-msg {
  flex: 1; color: var(--text-600);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.event-ago {
  font-size: 11px; color: var(--text-400); flex-shrink: 0;
}

/* 识别配置卡 */
.config-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.config-item {
  background: var(--bg-hover);
  border: 1px solid #F3F4F6;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  min-width: 0;
}
.config-key {
  display: block; font-size: 11px; color: var(--text-400);
  margin-bottom: 2px;
}
.config-val {
  display: block; font-size: 13px; font-weight: 600; color: var(--text-800);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

@media (max-width: 1024px) {
  .overview-bar { grid-template-columns: repeat(2, 1fr); }
  .overview-item:nth-child(3) { border-left: none; }
  .overview-item:nth-child(n+3) { border-top: 1px solid #F3F4F6; }
  .config-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .config-grid { grid-template-columns: 1fr; }
  .event-row { flex-wrap: wrap; }
  .event-msg { flex-basis: 100%; order: 5; }
}
