:root {
  --bg-body: #1e1e2e;
  --bg-sidebar: #181825;
  --bg-panel: #252536;
  --bg-card: #2a2a3d;
  --bg-hover: #313147;
  --bg-input: #1e1e2e;
  --border: #3a3a52;
  --text-primary: #e4e4ed;
  --text-secondary: #9999b3;
  --text-muted: #6b6b85;
  --accent: #7c5cfc;
  --accent-hover: #6a48e8;
  --accent-glow: rgba(124, 92, 252, 0.3);
  --danger: #f05060;
  --success: #3dd68c;
  --warning: #f0a050;
  --sidebar-width: 220px;
  --mobile-header-height: 52px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --transition: 0.2s ease;
}
[data-theme="light"] {
  --bg-body: #f5f5fa;
  --bg-sidebar: #ffffff;
  --bg-panel: #ffffff;
  --bg-card: #f0f0f5;
  --bg-hover: #e8e8f0;
  --bg-input: #f5f5fa;
  --border: #d8d8e4;
  --text-primary: #1a1a2e;
  --text-secondary: #555577;
  --text-muted: #8888aa;
  --accent: #6c4ce8;
  --accent-hover: #5a3ad6;
  --accent-glow: rgba(108, 76, 232, 0.2);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  transition:
    background var(--transition),
    color var(--transition);
}
.theme-toggle-v2 {
  position: relative;
  width: 100%;
  height: 44px;
  border-radius: 22px;
  cursor: pointer;
  background: #2a2a40;
  border: 1px solid #3a3a55;
  overflow: hidden;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  transition:
    background 0.3s,
    border-color 0.3s;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}
.theme-toggle-v2:hover {
  border-color: #6666aa;
}
.ttv2-sun,
.ttv2-moon {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  transition:
    color 0.3s,
    background 0.3s,
    border-radius 0.3s;
  position: relative;
  z-index: 1;
}
.ttv2-sun {
  color: #555570;
  background: transparent;
  border-radius: 0;
}
.ttv2-moon {
  color: #c4a0ff;
  background: rgba(196, 160, 255, 0.12);
  border-radius: 0 22px 22px 0;
}
.tv2-knob {
  display: none;
}
[data-theme="light"] .theme-toggle-v2 {
  background: #eeeef5;
  border-color: #d0d0de;
}
[data-theme="light"] .theme-toggle-v2:hover {
  border-color: #b0b0c8;
}
[data-theme="light"] .ttv2-sun {
  color: #f0a050;
  background: rgba(240, 160, 80, 0.12);
  border-radius: 22px 0 0 22px;
}
[data-theme="light"] .ttv2-moon {
  color: #aaaac0;
  background: transparent;
  border-radius: 0;
}
.consent-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0; /* fallback for older Safari */
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: opacity 0.3s;
}
.consent-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.consent-modal {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
  animation: modalPop 0.35s ease;
}
@keyframes modalPop {
  from {
    transform: scale(0.9) translateY(20px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}
.consent-icon {
  font-size: 2.8rem;
  color: var(--warning);
  margin-bottom: 16px;
}
.consent-modal h2 {
  font-size: 1.3rem;
  margin-bottom: 16px;
}
.consent-modal p {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 8px;
}
.consent-warn {
  color: var(--danger) !important;
  font-weight: 500;
}
.consent-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
  flex-wrap: wrap;
}
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  transition:
    transform var(--transition),
    background var(--transition);
}
.sidebar-close {
  display: none;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
}
.sidebar-logo i {
  font-size: 1.5rem;
}
.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px;
  overflow-y: auto;
}
.nav-group-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 16px 14px 6px;
}
.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 14px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  font-size: 0.92rem;
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.nav-item.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}
.nav-item i {
  width: 20px;
  text-align: center;
  font-size: 1rem;
}
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.server-capsule {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: all 0.4s ease;
}
.server-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition:
    background 0.4s ease,
    box-shadow 0.4s ease;
  flex-shrink: 0;
}
.server-text {
  font-weight: 600;
}
.server-capsule.online {
  border-color: rgba(61, 214, 140, 0.3);
  background: rgba(61, 214, 140, 0.06);
}
.server-capsule.online .server-dot {
  background: var(--success);
  box-shadow:
    0 0 6px var(--success),
    0 0 14px rgba(61, 214, 140, 0.4);
  animation: glowPulse 2.5s ease-in-out infinite;
}
.server-capsule.online .server-text {
  color: var(--success);
}
.server-capsule.offline {
  border-color: rgba(240, 80, 96, 0.3);
  background: rgba(240, 80, 96, 0.06);
}
.server-capsule.offline .server-dot {
  background: var(--danger);
  box-shadow:
    0 0 6px var(--danger),
    0 0 14px rgba(240, 80, 96, 0.4);
  animation: glowPulse 2s ease-in-out infinite;
}
.server-capsule.offline .server-text {
  color: var(--danger);
}
.server-capsule.checking {
  border-color: rgba(150, 150, 170, 0.2);
  background: rgba(150, 150, 170, 0.04);
}
.server-capsule.checking .server-dot {
  background: var(--text-muted);
  box-shadow:
    0 0 4px var(--text-muted),
    0 0 10px rgba(150, 150, 170, 0.3);
  animation: glowPulse 1.5s ease-in-out infinite;
}
@keyframes glowPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}
.online-users-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 8px;
  transition: all 0.4s ease;
}
.online-users-bar i {
  font-size: 0.85rem;
  opacity: 0.7;
}
.online-users-text {
  font-weight: 600;
}
.mobile-header {
  display: none;
}
.sidebar-overlay {
  display: none;
}
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  padding: 24px 28px;
}
.page {
  display: none;
}
.page.active {
  display: block;
}
.page-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-header h1 i {
  color: var(--accent);
}
.page-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
}
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition:
    background var(--transition),
    border var(--transition);
}
.panel-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-title i {
  color: var(--accent);
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}
.btn-warning {
  background: var(--warning);
  color: #fff;
}
.btn-warning:hover {
  background: #e09040;
  box-shadow: 0 4px 16px rgba(240, 160, 80, 0.3);
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: #d93a4a;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}
.stat-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
}
.stat-chip i {
  color: var(--accent);
}
.stat-chip strong {
  color: var(--text-primary);
}
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--bg-card);
  border-radius: 2px;
  margin-top: 14px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #a78bfa);
  width: 0%;
  border-radius: 2px;
  transition: width 0.4s;
}
.result-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.result-empty i {
  font-size: 3rem;
  margin-bottom: 14px;
  opacity: 0.4;
}
.result-empty p {
  font-size: 1rem;
  margin-bottom: 4px;
}
.result-empty span {
  font-size: 0.82rem;
}
.no-detection {
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 8px 0;
}
.detect-split-equal {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: stretch;
}
.detect-split-equal > .panel {
  display: flex;
  flex-direction: column;
}
.detect-split-equal > .panel > :last-child {
  flex: 1;
}
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-card);
}
.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent);
  background: rgba(124, 92, 252, 0.08);
}
.upload-zone i {
  font-size: 2.5rem;
  color: var(--accent);
  margin-bottom: 12px;
  display: block;
}
.upload-zone p {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.upload-zone span {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.upload-zone-sm {
  padding: 28px 20px;
}
.upload-zone-sm i {
  font-size: 2rem;
}
.upload-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  align-items: center;
  justify-content: center;
}
.single-preview {
  position: relative;
  margin-top: 12px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}
.single-preview img {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  display: block;
  background: var(--bg-card);
}
.preview-remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.preview-remove-btn:hover {
  transform: scale(1.1);
}
.single-result-img-wrap {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-card);
}
.single-result-img-wrap img {
  width: 100%;
  max-height: 500px;
  object-fit: contain;
  display: block;
  cursor: pointer;
}
.preview-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 12px 0;
  justify-content: center;
  flex-wrap: wrap;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.preview-item {
  flex: 0 0 90px;
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}
.preview-item:hover {
  border-color: var(--accent);
}
.preview-item img {
  width: 90px;
  height: 90px;
  object-fit: cover;
  display: block;
}
.preview-item .preview-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition);
}
.preview-item:hover .preview-remove {
  opacity: 1;
}
.file-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}
.result-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  justify-content: center;
}
.single-result-stats {
  margin-bottom: 16px;
}
.single-result-stats .result-stats {
  margin-bottom: 0;
  justify-content: center;
}
.annotated-img-wrap {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-card);
  margin-bottom: 16px;
}
.annotated-img-wrap img {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  display: block;
  cursor: pointer;
}
.detection-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-bottom: 12px;
}
.detection-table th {
  text-align: left;
  padding: 8px 10px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.detection-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
.detection-table tr:last-child td {
  border-bottom: none;
}
.det-class-name {
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.det-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.det-bbox {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.detected-chars {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.char-avatar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform var(--transition);
}
.char-avatar:hover {
  transform: translateY(-3px);
}
.char-avatar .avatar-ring {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  padding: 3px;
}
.char-avatar .avatar-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.char-avatar .char-name {
  font-size: 0.72rem;
  color: var(--text-secondary);
  max-width: 72px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.char-avatar .char-conf {
  font-size: 0.68rem;
  color: var(--accent);
  font-weight: 600;
}
.multi-results {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.multi-result-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
}
.multi-result-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.25);
}
.multi-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.multi-card-title {
  font-size: 1rem;
  font-weight: 700;
}
.multi-card-body {
  padding: 16px 18px;
}
.multi-card-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.multi-img-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.multi-img-section .img-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}
.multi-img-section img {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  background: var(--bg-card);
}
.det-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bg-hover);
  border-left: 3px solid var(--accent);
}
.det-tag .conf {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.video-result-layout .detect-split-equal > .panel {
  min-height: 400px;
}
.video-stream-img {
  width: 100%;
  border-radius: 8px;
  background: var(--bg-card);
  min-height: 300px;
}
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: all 0.3s ease;
}
.live-dot-v2 {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition:
    background 0.3s,
    box-shadow 0.3s;
}
.live-indicator.detecting {
  border-color: rgba(61, 214, 140, 0.4);
  background: rgba(61, 214, 140, 0.08);
}
.live-indicator.detecting .live-dot-v2 {
  background: var(--success);
  box-shadow:
    0 0 6px var(--success),
    0 0 14px rgba(61, 214, 140, 0.5);
  animation: liveBlink 1s ease-in-out infinite;
}
.live-indicator.detecting .live-label {
  color: var(--success);
}
.live-indicator.paused {
  border-color: rgba(240, 80, 96, 0.4);
  background: rgba(240, 80, 96, 0.08);
}
.live-indicator.paused .live-dot-v2 {
  background: var(--danger);
  box-shadow:
    0 0 6px var(--danger),
    0 0 12px rgba(240, 80, 96, 0.4);
  animation: none;
}
.live-indicator.paused .live-label {
  color: var(--danger);
}
.live-indicator.idle .live-dot-v2 {
  background: var(--text-muted);
}
.live-indicator.idle .live-label {
  color: var(--text-muted);
}
@keyframes liveBlink {
  0%,
  100% {
    opacity: 1;
    box-shadow:
      0 0 6px var(--success),
      0 0 14px rgba(61, 214, 140, 0.5);
  }
  50% {
    opacity: 0.3;
    box-shadow: 0 0 2px var(--success);
  }
}
.video-frame-table-panel {
  margin-top: 20px;
}
.frame-count-badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.frame-table-scroll {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.frame-detection-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.frame-detection-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  padding: 10px 12px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.frame-detection-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}
.frame-detection-table tr:last-child td {
  border-bottom: none;
}
.frame-detection-table tr:hover td {
  background: var(--bg-hover);
}
.frame-detection-table tr.new-row td {
  animation: rowFlash 0.8s ease-out;
}
@keyframes rowFlash {
  0% {
    background: rgba(124, 92, 252, 0.2);
  }
  100% {
    background: transparent;
  }
}
.frame-td-frame {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.82rem;
  font-family: "SF Mono", "Fira Code", monospace;
}
.frame-td-count {
  font-weight: 600;
  color: var(--text-primary);
}
.frame-td-chars {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.frame-char-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--bg-hover);
  border-left: 3px solid var(--accent);
}
.frame-td-conf {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.78rem;
}
.frame-td-bbox {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.72rem;
  color: var(--text-muted);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.frame-no-detect {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.78rem;
}
.video-info-section {
  margin-bottom: 16px;
}
.video-info-section:last-child {
  margin-bottom: 0;
}
.video-info-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  font-weight: 600;
}
.video-live-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  background: var(--bg-card);
  border-radius: var(--radius);
  font-size: 0.82rem;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  animation: livePulse 1.2s ease-in-out infinite;
}
@keyframes livePulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}
.live-sep {
  color: var(--border);
}
.video-live-bar strong {
  color: var(--text-primary);
}
.detection-table-wrap {
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.chat-container {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 140px);
  overflow: hidden;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.chat-bubble {
  display: flex;
  gap: 10px;
  max-width: 75%;
}
.chat-bubble.bot {
  align-self: flex-start;
}
.chat-bubble.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
  font-size: 0.9rem;
}
.chat-bubble.user .chat-avatar {
  background: var(--accent);
  color: #fff;
}
.chat-text {
  background: var(--bg-card);
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.6;
  border: 1px solid var(--border);
  word-break: break-word;
}
.chat-bubble.user .chat-text {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
/* ===== 聊天模型选择器 ===== */
.chat-model-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}
.chat-model-select {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  color: var(--text-primary);
  font-size: 0.82rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
  max-width: 220px;
}
.chat-model-select:focus {
  border-color: var(--accent);
}
.chat-model-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}
.chat-input-area {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
}
.chat-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.92rem;
  outline: none;
  transition: border-color var(--transition);
}
.chat-input:focus {
  border-color: var(--accent);
}
.chat-input::placeholder {
  color: var(--text-muted);
}
.typing-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 4px 0;
}
.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typingBounce 1.4s ease-in-out infinite;
}
.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}
.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes typingBounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-6px);
    opacity: 1;
  }
}
.history-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}
.history-filter-group {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 4px;
}
.filter-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 5px;
}
.filter-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}
.filter-btn.active {
  background: var(--accent);
  color: #fff;
}
.history-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.history-stats {
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.history-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
}
.history-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}
.history-card.select-mode {
  cursor: pointer;
}
.history-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.history-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.history-time {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.history-badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.history-type-badge {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.history-type-badge.image {
  background: rgba(78, 205, 196, 0.15);
  color: #4ecdc4;
}
.history-type-badge.video {
  background: rgba(255, 107, 107, 0.15);
  color: #ff6b6b;
}
.history-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
}
.history-img-wrap {
  background: var(--bg-card);
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.history-img-wrap .img-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.history-img-wrap img {
  width: 100%;
  max-height: 160px;
  object-fit: contain;
  border-radius: 6px;
  cursor: pointer;
}
.img-click-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  padding: 4px 0 2px;
  opacity: 0.7;
  transition: opacity var(--transition);
}
.img-click-hint i {
  margin-right: 3px;
  font-size: 0.65rem;
}
.history-img-wrap:hover .img-click-hint,
.single-result-img-wrap:hover + .img-click-hint {
  opacity: 1;
  color: var(--accent);
}
.history-card-body-video {
  display: block;
  padding: 16px;
}
.history-video-info {
  margin-bottom: 0;
}
.history-video-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 8px;
}
.history-video-name i {
  color: var(--accent);
  opacity: 0.6;
}
.history-video-play {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-card);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  margin-left: 8px;
}
.history-video-play:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px var(--accent-glow);
}
.history-video-play i {
  font-size: 0.85rem;
  opacity: 1;
}
.history-card-dets {
  padding: 12px 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-top: 1px solid var(--border);
}
.history-det-list {
  padding: 12px 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  align-items: start;
  border-top: 1px solid var(--border);
}
.hist-det-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: all var(--transition);
}
.hist-det-row:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}
.hist-det-avatar {
  flex-shrink: 0;
}
.hist-avatar-ring {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  padding: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hist-avatar-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.hist-avatar-inner img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}
.hist-det-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.hist-det-name {
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hist-det-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.hist-det-bbox {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-family: "SF Mono", "Fira Code", monospace;
  opacity: 0.8;
}
.hist-det-bbox i {
  color: var(--accent);
  opacity: 0.6;
}
.hist-det-conf {
  font-weight: 600;
  color: var(--accent);
  font-size: 0.78rem;
}
.history-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.history-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all var(--transition);
}
.history-delete:hover {
  background: rgba(240, 80, 96, 0.15);
  color: var(--danger);
}
.history-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}
.knowledge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
}
.knowledge-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 14px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}
.knowledge-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.knowledge-card .kc-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  overflow: hidden;
  color: #fff;
}
.knowledge-card .kc-name {
  font-size: 0.8rem;
  font-weight: 600;
}
.settings-content {
  max-width: 600px;
}
.settings-content.admin {
  max-width: 960px;
}
.setting-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-child {
  border-bottom: none;
}
.setting-row label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  min-width: 100px;
}
.setting-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}
.setting-row select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.88rem;
}
.setting-row span {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
  min-width: 40px;
}

/* ===== 管理员设置：双栏网格 ===== */
.admin-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
.admin-settings-grid .panel {
  min-width: 0;
}
.admin-settings-grid .panel.full-width {
  grid-column: 1 / -1;
}

/* ===== 管理员表单字段（复用类） ===== */
.admin-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.admin-field label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.admin-field input,
.admin-field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.admin-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}
.admin-field .field-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  word-break: break-all;
}
.admin-field .field-hint i { margin-right: 3px; }
.admin-field-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.admin-field-row input { flex: 1; }

/* ===== 管理员添加/上传区块 ===== */
.admin-add-section {
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 16px;
}
.admin-add-section .section-label {
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.admin-add-section .section-label i {
  color: var(--accent);
}
.admin-add-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-add-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 8px;
}
.admin-add-status {
  font-size: 0.82rem;
  color: var(--text-muted);
  min-height: 1.2em;
  margin-top: 4px;
}

/* ===== 模型上传拖拽区 ===== */
.model-upload-dropzone {
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.model-upload-dropzone:hover,
.model-upload-dropzone.dragover {
  border-color: var(--accent);
  background: rgba(124, 92, 252, 0.05);
}
.model-upload-dropzone i {
  font-size: 1.5rem;
  color: var(--accent);
  margin-bottom: 6px;
  display: block;
}
.model-upload-dropzone p {
  font-size: 0.88rem;
  font-weight: 600;
  margin: 0 0 2px;
}
.model-upload-dropzone span {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.about-info p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  padding: 6px 0;
}
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
}
.modal-content {
  position: relative;
  max-width: 80vw;
  max-height: 80vh;
  z-index: 2001;
}
.modal-content img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius-lg);
}
.modal-actions {
  position: absolute;
  top: -48px;
  right: 0;
  display: flex;
  gap: 10px;
}
.modal-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--transition);
  background: var(--bg-panel);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.modal-btn:hover {
  background: var(--bg-hover);
  transform: scale(1.1);
}
.modal-btn-close {
  background: var(--danger);
  color: #fff;
  border: none;
}
.modal-btn-close:hover {
  background: #d93a4a;
}
.modal-content-video {
  max-width: 90vw;
  max-height: 85vh;
}
.modal-content-video video {
  display: block;
  max-width: 100%;
  max-height: 80vh;
  border-radius: var(--radius-lg);
  background: #000;
}
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  padding: 12px 18px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s ease;
  max-width: 340px;
  box-shadow: var(--shadow);
  font-size: 0.88rem;
}
.toast.success {
  border-left: 3px solid var(--success);
}
.toast.error {
  border-left: 3px solid var(--danger);
}
.toast.info {
  border-left: 3px solid var(--accent);
}
.toast.warning {
  border-left: 3px solid var(--warning);
}
@keyframes toastIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
  }
  .sidebar.open {
    transform: translateX(0) !important;
    visibility: visible;
    pointer-events: auto;
  }
  .sidebar-close {
    display: flex;
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--bg-hover);
    color: var(--text-primary);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all var(--transition);
  }
  .sidebar-close:hover {
    background: var(--danger);
    color: #fff;
  }
  .sidebar-overlay {
    display: block;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
  }
  .sidebar-overlay.visible {
    opacity: 1;
    pointer-events: auto;
  }
  .mobile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--mobile-header-height);
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
    z-index: 50;
  }
  .hamburger {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius);
    background: var(--bg-hover);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
  }
  .mobile-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .main-wrapper {
    margin-left: 0;
    margin-top: var(--mobile-header-height);
    padding: 20px 24px;
  }
}
@media (max-width: 600px) {
  .main-wrapper {
    padding: 12px;
  }
  .panel {
    padding: 14px;
  }
  .page-header {
    gap: 8px;
    margin-bottom: 16px;
  }
  .page-header h1 {
    font-size: 1.15rem;
  }
  .page-desc {
    font-size: 0.8rem;
    width: 100%;
  }
  .detect-split-equal {
    grid-template-columns: 1fr;
  }
  .multi-card-images {
    grid-template-columns: 1fr;
  }
  .history-card-body {
    grid-template-columns: 1fr;
  }
  .upload-zone {
    padding: 28px 14px;
  }
  .upload-zone i {
    font-size: 2rem;
  }
  .upload-zone p {
    font-size: 0.95rem;
  }
  .upload-zone span {
    font-size: 0.75rem;
  }
  .upload-actions {
    flex-direction: column;
  }
  .upload-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .single-result-img-wrap img {
    max-height: 250px;
  }
  .annotated-img-wrap img {
    max-height: 200px;
  }
  .multi-img-section img {
    max-height: 180px;
  }
  .preview-item {
    flex: 0 0 72px;
  }
  .preview-item img {
    width: 72px;
    height: 72px;
  }
  .file-count {
    font-size: 0.8rem;
    width: 100%;
    justify-content: center;
  }
  .detected-chars {
    justify-content: center;
  }
  .char-avatar .avatar-ring {
    width: 48px;
    height: 48px;
  }
  .char-avatar .avatar-inner {
    /* img adapts to container size */
  }
  .video-stream-img {
    min-height: 200px;
  }
  .video-result-layout .detect-split-equal > .panel {
    min-height: auto;
  }
  .frame-table-scroll {
    max-height: 300px;
  }
  .frame-detection-table th,
  .frame-detection-table td {
    padding: 6px 8px;
    font-size: 0.72rem;
  }
  .frame-td-bbox {
    max-width: 120px;
  }
  .chat-container {
    height: calc(100vh - var(--mobile-header-height) - 80px);
  }
  .chat-bubble {
    max-width: 90%;
  }
  .chat-input-area {
    padding: 10px 12px;
  }
  .history-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .history-filter-group {
    width: 100%;
    justify-content: center;
  }
  .history-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
  }
  .history-card-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 14px;
  }
  .history-card-actions {
    width: 100%;
    justify-content: space-between;
  }
  .history-card-dets {
    padding: 10px 14px;
  }
  .consent-modal {
    padding: 24px 20px;
  }
  .consent-modal h2 {
    font-size: 1.1rem;
  }
  .consent-modal p {
    font-size: 0.85rem;
  }
  .consent-actions {
    flex-direction: column;
  }
  .consent-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .knowledge-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  .knowledge-card {
    padding: 14px 8px;
  }
  .knowledge-card .kc-icon {
    width: 44px;
    height: 44px;
  }
  .knowledge-card .kc-name {
    font-size: 0.78rem;
  }
  .setting-row {
    flex-wrap: wrap;
    gap: 10px;
  }
  .setting-row label {
    min-width: auto;
    width: 100%;
  }
  .modal-content {
    max-width: 95vw;
    max-height: 85vh;
  }
  .modal-actions {
    top: -40px;
  }
  .modal-btn {
    width: 34px;
    height: 34px;
    font-size: 0.9rem;
  }
  .pagination {
    gap: 8px;
    font-size: 0.8rem;
  }
  .pagination .btn {
    padding: 6px 10px;
    font-size: 0.75rem;
  }
  .toast-container {
    top: 12px;
    right: 12px;
    left: 12px;
  }
  .toast {
    max-width: 100%;
  }
}

/* ===== Custom Cursors ===== */
*,
*::before,
*::after {
  cursor:
    url("cursor/cursor.ani"), url("cursor/cursor.png"), default !important;
}

a,
button,
.btn,
.nav-item,
.upload-zone,
.knowledge-card,
.char-avatar,
.preview-item,
.history-card.select-mode,
.history-delete,
.filter-btn,
.modal-btn,
.hamburger,
.sidebar-close,
.consent-actions .btn,
.preview-remove-btn,
.preview-remove,
.history-checkbox,
input[type="range"],
select,
[role="button"],
[onclick],
.summary-details summary,
.toggle-edit-key-btn,
.ai-edit-test-btn,
.ai-edit-cancel-btn,
.ai-edit-save-btn,
.activate-btn,
.delete-btn,
.edit-btn {
  cursor:
    url("cursor/pointer.ani"), url("cursor/pointer.png"), pointer !important;
}

/* Text inputs keep text cursor */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="search"],
textarea,
[contenteditable="true"],
[contenteditable=""] {
  cursor: url("cursor/cursor.ani"), url("cursor/cursor.png"), text !important;
}

/* Disabled elements */
[disabled],
.btn-primary:disabled,
button:disabled,
input:disabled,
select:disabled {
  cursor:
    url("cursor/cursor.ani"), url("cursor/cursor.png"), not-allowed !important;
}

/* ===== 网站底部 Footer ===== */
.site-footer {
  width: 100%;
  padding: 20px 24px 16px;
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--bg-body);
  margin-top: 32px;
  flex-shrink: 0;
}
.site-footer .footer-info {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 18px;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.8;
}
.site-footer .footer-info a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.site-footer .footer-info a:hover {
  color: var(--accent);
  text-decoration: underline;
}
.site-footer .footer-divider {
  color: var(--border);
  user-select: none;
}
.site-footer .footer-copyright {
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--text-muted);
  opacity: 0.7;
}
@media (max-width: 600px) {
  .site-footer {
    padding: 16px 12px 12px;
    margin-top: 24px;
  }
  .site-footer .footer-info {
    font-size: 0.72rem;
    gap: 4px 12px;
  }
  .site-footer .footer-copyright {
    font-size: 0.68rem;
  }
}
