/* ===========================
   FOF 名人堂 — Style
   =========================== */

:root {
  --accent: #f97316;
  --accent-dark: #ea580c;
  --accent-light: #fff7ed;
  --scan-cyan: #06b6d4;
  --scan-glow: rgba(6, 182, 212, 0.4);
  --bg: #f5f4f0;
  --surface: #ffffff;
  --text-primary: #2d2d2d;
  --text-secondary: #666;
  --text-muted: #999;
  --border: #e8e6e1;
  --border-light: #f0eeea;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.03);
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.05);
  --shadow-md: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-header: 0 1px 8px rgba(0,0,0,0.07);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

body {
  font-family: 'Inter', 'Noto Sans TC', system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text-primary);
}

/* --- Accent Utilities --- */
.text-accent { color: var(--accent) !important; }

.btn-accent {
  background-color: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 500;
  transition: all 0.2s ease;
}
.btn-accent:hover {
  background-color: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.2);
}
.btn-accent:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-outline-accent {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 500;
  transition: all 0.2s ease;
}
.btn-outline-accent:hover {
  background-color: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-outline-secondary {
  border-color: #d5d3ce;
  color: var(--text-secondary);
  font-weight: 500;
  transition: all 0.2s ease;
}
.btn-outline-secondary:hover {
  border-color: var(--text-muted);
  background: var(--surface);
  color: var(--text-primary);
}

/* --- Form --- */
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.08);
}

/* ===== Header ===== */
.site-header {
  background: var(--surface);
  box-shadow: var(--shadow-header);
  height: 80px;
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
}
.header-logo-img {
  height: 36px;
  width: auto;
}
.header-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}
.header-divider {
  width: 1px;
  height: 26px;
  background: var(--border);
}

/* ===== Main ===== */
.site-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ===== Home Stage ===== */
.home-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
}
.home-content {
  width: 100%;
  max-width: 880px;
}
.home-title {
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.home-subtitle {
  font-size: 1.3rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* ===== Upload Zone ===== */
.upload-zone {
  background: var(--surface);
  border: 1.5px dashed #d5d3ce;
  border-radius: var(--radius-md);
  padding: 3.5rem 3rem;
  cursor: pointer;
  transition: all 0.25s ease;
}
.upload-zone:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.upload-zone.dragging {
  border-color: var(--accent);
  border-style: solid;
  background: var(--accent-light);
  transform: scale(1.01);
}
.upload-text-primary {
  color: var(--text-primary);
  font-weight: 500;
  font-size: 1.3rem;
}
.upload-text-secondary {
  color: var(--text-muted);
  font-size: 1.1rem;
}
.upload-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.upload-icon svg {
  color: var(--text-muted);
}

/* ===== Gallery ===== */
.gallery-heading {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}
.gallery-subheading {
  font-size: 1.1rem;
  color: var(--text-muted);
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  max-width: 640px;
  margin: 0 auto;
}
.gallery-item {
  /* wrapper for gallery card inside CSS grid */
}
.gallery-card {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: var(--shadow-sm);
}
.gallery-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.gallery-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.gallery-card:hover img {
  transform: scale(1.05);
}
.gallery-card .gallery-label {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
  padding: 1rem 0.75rem 0.6rem;
  color: #fff;
  font-size: 1rem;
  font-weight: 500;
}
.gallery-card .gallery-label span {
  color: #fff;
  font-size: 0.85rem;
  font-weight: 500;
}

/* ===== Scanning Stage ===== */
#stage-scanning {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.scan-body {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
}
.scan-col-image {
  flex: 0 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.scan-container {
  position: relative;
  display: inline-block;
  background: #1e1e1e;
  border-radius: var(--radius-md);
  overflow: hidden;
}
.scan-container img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 180px);
  width: auto;
  height: auto;
}
.scan-col-log {
  width: 280px;
  flex-shrink: 0;
  align-self: stretch;
}
.scan-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--scan-cyan);
  box-shadow: 0 0 15px var(--scan-glow), 0 0 30px var(--scan-glow);
  animation: scanLine 3s linear infinite;
  z-index: 2;
}
@keyframes scanLine {
  0%   { top: 0%; }
  50%  { top: 100%; }
  100% { top: 0%; }
}
.scan-bracket {
  position: absolute;
  inset: 0.75rem;
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: 4px;
  pointer-events: none;
  z-index: 1;
}

/* ===== Progress Log ===== */
.progress-log {
  height: 100%;
  background: #1e1e1e;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  overflow: hidden;
}
.log-header-border {
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.log-dot-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 4px rgba(74, 222, 128, 0.4);
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.log-label {
  color: rgba(255,255,255,0.25);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
}
.log-entry {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  opacity: 0;
  transform: translateX(-10px);
  animation: logFadeIn 0.3s forwards;
}
@keyframes logFadeIn {
  to { opacity: 1; transform: translateX(0); }
}
.log-entry .log-icon { color: var(--scan-cyan); margin-top: 2px; }
.log-entry .log-icon.done { color: #3f3f46; }
.log-entry .log-text { color: #d4d4d8; font-size: 0.8rem; }
.log-entry .log-text.done { color: #52525b; }

/* ===== Results Stage ===== */
#stage-results {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.results-body {
  height: 100%;
  display: flex;
  align-items: stretch;
  padding: 1.25rem 2rem;
}
.results-col-image {
  flex: 1 1 0%;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 2rem;
  overflow: hidden;
}
.result-image-container {
  position: relative;
  display: inline-block;
  max-width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.result-image-container img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 180px);
  width: auto;
  height: auto;
}
.results-col-cards {
  flex: 1 1 0%;
  border-left: 1px solid var(--border);
  padding-left: 2rem;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
/* Subtle scrollbar */
.results-col-cards::-webkit-scrollbar { width: 3px; }
.results-col-cards::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

#result-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.result-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}
.result-card.matched { border: 1px solid #bbf7d0; }
.result-card.unknown { border: 1px solid var(--border); }
.result-card.suggested { border: 1px solid #fed7aa; }
.result-card.highlight {
  background: #eff6ff !important;
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 1px #3b82f6;
}
/* Expanded card spans full width, flex layout for side-by-side image */
.result-card.expanded {
  grid-column: 1 / -1;
  display: flex;
}
.card-main {
  flex: 1;
  min-width: 0;
}
.card-summary {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 1.2rem 0.7rem;
  cursor: pointer;
  user-select: none;
  text-align: center;
  min-height: 90px;
}
.card-summary .summary-text {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dark);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.card-summary .summary-conf {
  font-size: 0.7rem;
  color: var(--text-muted);
}
.card-summary .summary-top-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.card-summary .expand-chevron {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}
.result-card.expanded .card-summary .expand-chevron {
  transform: rotate(180deg);
}
.card-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}
.result-card.expanded .card-detail {
  max-height: 500px;
}
.card-detail-inner {
  padding: 0 0.7rem 0.7rem;
}
.card-detail-content {
  min-width: 0;
}
.btn-collapse-card {
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.btn-collapse-card:hover {
  color: var(--text-secondary);
}
/* Face crop: hidden when collapsed, visible at card level when expanded */
.detail-face-crop {
  display: none;
  flex: 0 0 35%;
  overflow: hidden;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.result-card.expanded .detail-face-crop {
  display: block;
}
.detail-face-crop img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.detail-name {
  font-size: 1.1rem;
  font-weight: 700;
}

/* Face bounding boxes */
.face-box {
  position: absolute;
  border: 2px solid;
  border-radius: 4px;
  pointer-events: auto;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.face-box.matched { border-color: #4ade80; }
.face-box.suggested { border-color: var(--accent); }
.face-box.unknown { border-color: var(--text-muted); }
.face-box.highlight {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3), 0 0 12px rgba(59, 130, 246, 0.4);
  z-index: 10;
}
.face-box .face-num-badge {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e8590c;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.card-num-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e8590c;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.face-box .face-label {
  position: absolute;
  bottom: -22px;
  left: 0;
  background: #15803d;
  color: #fff;
  font-size: 0.7rem;
  padding: 1px 8px;
  border-radius: 4px;
  white-space: nowrap;
  font-weight: 500;
}
.card-face-crop {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background-repeat: no-repeat;
  flex-shrink: 0;
  cursor: pointer;
}
.face-enlarge-popup {
  position: fixed;
  z-index: 1000;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(255,255,255,0.9);
  box-shadow: 0 4px 24px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,0,0,0.08);
  background-color: #1e1e1e;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.face-enlarge-popup.visible {
  opacity: 1;
  transform: scale(1);
}

/* Suggestion cards */
.suggestion-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--surface);
  width: 100%;
  text-align: left;
}
.suggestion-card:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.suggestion-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
}

/* ===== Certificate ===== */
.cert-wrapper {
  max-width: 420px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}
.cert-card {
  background: var(--surface);
  border-color: var(--border) !important;
  box-shadow: var(--shadow-md);
}
.cert-accent-bar {
  width: 4px;
  background: var(--accent);
  flex-shrink: 0;
}
.cert-verified-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(249, 115, 22, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

/* ===== God Sidebar ===== */
.god-sidebar {
  position: fixed;
  top: 80px;
  left: 0;
  bottom: 0;
  width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 40;
  overflow-y: auto;
  padding: 1.25rem 0;
}
.god-sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 1.25rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
}
.god-sidebar-nav .nav-link:hover {
  color: var(--text-primary);
  background: var(--bg);
}
.god-sidebar-nav .nav-link.active {
  color: #4154f1;
  background: rgba(65, 84, 241, 0.04);
  border-left-color: #4154f1;
}
.god-sidebar-nav .nav-link i {
  font-size: 1.15rem;
  width: 22px;
  text-align: center;
}
.god-main {
  margin-left: 260px;
  min-height: calc(100vh - 80px);
}
.god-section-content {
  display: none;
  padding: 2rem 2rem;
}
.god-section-content.active {
  display: block;
}
.god-sidebar-toggle {
  display: none;
  position: fixed;
  top: 90px;
  left: 10px;
  z-index: 45;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.5rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.god-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 39;
}
@media (max-width: 991px) {
  .god-sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 41;
  }
  .god-sidebar.open {
    transform: translateX(0);
  }
  .god-sidebar-toggle {
    display: block;
  }
  .god-sidebar-overlay.open {
    display: block;
  }
  .god-main {
    margin-left: 0;
  }
}

/* ===== God Dashboard Cards ===== */
.god-panel {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.god-panel h5 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}
.god-panel .panel-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* Stat Cards */
.stat-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  height: 100%;
}
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-icon.blue { background: #e8f0fe; color: #4154f1; }
.stat-icon.orange { background: #fff3e0; color: #f97316; }
.stat-icon.green { background: #e8f5e9; color: #22c55e; }
.stat-icon.purple { background: #f3e8ff; color: #8b5cf6; }
.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}
.stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.stat-note {
  position: absolute;
  top: 0.6rem;
  right: 0.8rem;
  color: #bbb;
  font-size: 0.85rem;
  cursor: help;
}
.stat-note:hover { color: #888; }
.stat-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* Face Cards Grid (admin) */
.face-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 0.85rem;
}
.face-card-admin {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: box-shadow 0.15s ease;
}
.face-card-admin:hover {
  box-shadow: var(--shadow-md);
}
.face-card-admin img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: var(--bg);
}
.face-card-admin .fc-body {
  padding: 0.4rem 0.5rem;
}
.face-card-admin .fc-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.face-card-admin .fc-meta {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}
.face-card-admin .fc-actions {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.25rem;
}
.face-card-admin .fc-actions button {
  background: none;
  border: none;
  padding: 0.2rem 0.4rem;
  cursor: pointer;
  font-size: 0.8rem;
  border-radius: 4px;
  transition: background 0.15s;
}
.face-card-admin .fc-actions button:hover {
  background: var(--bg);
}
.face-card-admin .fc-actions .btn-rename { color: #4154f1; }
.face-card-admin .fc-actions .btn-del { color: #dc3545; }
.face-card-new {
  animation: fadeInCard 0.4s ease;
  box-shadow: 0 0 0 2px #4154f1;
}

/* Batch select mode */
.batch-mode .face-card-admin {
  cursor: pointer;
  user-select: none;
}
.batch-mode .face-card-admin:hover {
  box-shadow: 0 0 0 2px rgba(65,84,241,0.3);
}
.face-card-admin.selected {
  box-shadow: 0 0 0 2px #4154f1 !important;
  position: relative;
}
.face-card-admin.selected::after {
  content: '\f26a';
  font-family: 'bootstrap-icons';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  background: #4154f1;
  color: #fff;
  border-radius: 50%;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.batch-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: #e8f0fe;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: #1e40af;
  font-weight: 500;
}
.batch-bar .batch-count {
  flex: 1;
}
@keyframes fadeInCard {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Source badges */
.badge-source {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-source.user { background: #e8f0fe; color: #4154f1; }
.badge-source.gallery { background: #fff3e0; color: #e8590c; }
.badge-source.migrate { background: #f0f0f0; color: #666; }
.badge-source.unknown { background: #f5f5f5; color: #999; }

/* Logs Table */
.logs-table {
  font-size: 0.85rem;
  width: 100%;
  table-layout: fixed;
}
.logs-table th {
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom-width: 2px;
  white-space: nowrap;
}
.logs-table td {
  vertical-align: middle;
  padding: 0.65rem 0.75rem;
}
.logs-table th:nth-child(1) { width: 15%; }
.logs-table th:nth-child(2) { width: 8%; }
.logs-table th:nth-child(3) { width: 30%; }
.logs-table th:nth-child(4) { width: 12%; }
.logs-table th:nth-child(5) { width: 15%; }
.logs-table th:nth-child(6) { width: 20%; }
.logs-table .log-thumb {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
}
.badge-status {
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 500;
}
.badge-status.matched { background: #dcfce7; color: #166534; }
.badge-status.suggested { background: #fff3e0; color: #9a3412; }
.badge-status.unknown { background: #f3f4f6; color: #6b7280; }
.badge-status.registered { background: #e8f0fe; color: #1e40af; }

/* Pagination */
.god-pagination .page-link {
  font-size: 0.82rem;
  color: var(--text-secondary);
  border-color: var(--border);
}
.god-pagination .page-item.active .page-link {
  background: #4154f1;
  border-color: #4154f1;
}

/* New registration banner */
.new-faces-banner {
  display: none;
  background: #e8f0fe;
  color: #4154f1;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  text-align: center;
  margin-bottom: 1rem;
  transition: background 0.15s;
}
.new-faces-banner:hover {
  background: #d4e2fd;
}

/* Chart containers */
.chart-container {
  position: relative;
  height: 280px;
}

/* ===== Footer ===== */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0.875rem 0;
  margin-top: auto;
}
.footer-text {
  color: var(--text-muted);
  font-size: 0.75rem;
}
.footer-accent {
  color: var(--accent);
  font-weight: 600;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .home-stage {
    padding: 1.5rem 1rem;
  }
  .home-title {
    font-size: 1.6rem;
  }
  .upload-zone {
    padding: 2rem 1.25rem;
  }
  .gallery-grid {
    max-width: 100%;
  }

  /* Scanning: stack vertically */
  .scan-body {
    flex-direction: column;
    padding: 0.5rem;
    gap: 0.5rem;
  }
  .scan-col-image {
    flex: 1;
  }
  .scan-col-log {
    width: 100%;
    height: 160px;
    flex-shrink: 0;
  }

  /* Results: stack vertically on mobile */
  #stage-results {
    flex: none;
    overflow: visible;
  }
  .results-body {
    flex-direction: column;
    height: auto;
    padding: 0.75rem;
    gap: 0;
    align-items: stretch;
  }
  .results-col-image {
    flex: none;
    padding-right: 0;
    padding-bottom: 1rem;
    justify-content: center;
  }
  .result-image-container {
    display: block;
  }
  .result-image-container img {
    max-height: 50vh;
    width: 100%;
    object-fit: contain;
  }
  .results-col-cards {
    flex: none;
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
    padding-left: 0;
    padding-top: 1rem;
    justify-content: flex-start;
    overflow-y: visible;
  }
  #result-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .cert-wrapper {
    padding: 1.5rem 1rem;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    gap: 0.5rem;
  }
}
