/* ─── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #FAFAF8;
  color: #18181B;
  min-height: 100vh;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
textarea { font-family: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

/* ─── Layout ─────────────────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* ─── Header ─────────────────────────────────────────────────── */
.site-header {
  border-bottom: 1px solid #E4E4E7;
  background: #FAFAF8;
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo svg { flex-shrink: 0; }
.logo-text { font-size: 18px; font-weight: 600; letter-spacing: -0.3px; }
.logo-text strong { font-weight: 800; }
.header-nav { display: flex; align-items: center; gap: 10px; }
.header-nav .nav-link {
  font-size: 13px; font-weight: 500; color: #6B7280;
  border: 1px solid #E4E4E7; border-radius: 8px;
  padding: 6px 14px;
  transition: border-color .15s, color .15s;
}
.header-nav .nav-link:hover { color: #18181B; border-color: #18181B; text-decoration: none; }

@media (max-width: 640px) {
  .header-inner { gap: 8px; }
  .header-nav { gap: 6px; }
  .header-nav .nav-link { display: none; }
  .logo-text { font-size: 16px; }
}

/* ─── Hero ───────────────────────────────────────────────────── */
.hero { padding: 72px 0 48px; text-align: center; }
.hero-badge {
  display: inline-block;
  font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: #2563EB; background: #EFF6FF;
  border-radius: 999px; padding: 4px 14px; margin-bottom: 20px;
}
.hero-title {
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 800; letter-spacing: -1.5px; line-height: 1.12;
  margin-bottom: 20px;
}
.hero-sub {
  font-size: 18px; font-weight: 400; color: #52525B;
  max-width: 600px; margin: 0 auto 16px;
}
.hero-privacy {
  font-size: 14px; color: #6B7280;
}

/* ─── Upload Section ─────────────────────────────────────────── */
.upload-section { padding: 0 0 48px; }
.upload-card {
  background: #fff;
  border: 1px solid #E4E4E7;
  border-radius: 20px;
  padding: 32px;
  max-width: 680px; margin: 0 auto;
  box-shadow: 0 1px 8px rgba(0,0,0,.04);
}
.drop-zone {
  border: 2px dashed #D4D4D8;
  border-radius: 14px;
  padding: 40px 24px;
  text-align: center;
  transition: border-color .2s, background .2s;
  cursor: pointer;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: #18181B;
  background: #F4F4F5;
}
.drop-icon { margin-bottom: 16px; }
.drop-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.drop-sub { font-size: 14px; color: #6B7280; margin-bottom: 8px; }
.file-label { color: #2563EB; font-weight: 600; cursor: pointer; }
.file-label:hover { text-decoration: underline; }
.drop-formats { font-size: 12px; color: #9CA3AF; }
.drop-offline { font-size: 11px; color: #6B7280; margin-top: 6px; }

.paste-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 24px 0 16px;
  color: #9CA3AF; font-size: 13px;
}
.paste-divider::before, .paste-divider::after {
  content: ''; flex: 1; height: 1px; background: #E4E4E7;
}
.paste-area {
  width: 100%; resize: vertical; min-height: 100px;
  border: 1px solid #E4E4E7; border-radius: 10px;
  padding: 12px 14px; font-size: 14px; color: #18181B;
  outline: none; transition: border-color .2s;
  background: #FAFAF8;
}
.paste-area:focus { border-color: #18181B; }

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border-radius: 10px;
  font-size: 15px; font-weight: 600;
  transition: background .15s, opacity .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn-full { width: 100%; }
.btn-primary { background: #18181B; color: #fff; }
.btn-primary:hover { background: #27272A; }
.btn-secondary { background: #F4F4F5; color: #18181B; border: 1px solid #E4E4E7; }
.btn-secondary:hover { background: #E4E4E7; }
.btn-ghost { background: transparent; color: #6B7280; }
.btn-ghost:hover { color: #18181B; }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 8px; }
.btn + .btn { margin-top: 10px; }

/* ─── Processing ─────────────────────────────────────────────── */
.processing-section { padding: 48px 0; }
.processing-card {
  max-width: 480px; margin: 0 auto; text-align: center;
  background: #fff; border: 1px solid #E4E4E7; border-radius: 20px;
  padding: 40px 32px;
}
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid #E4E4E7; border-top-color: #18181B;
  animation: spin .7s linear infinite; margin: 0 auto 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.processing-status { font-size: 16px; font-weight: 500; color: #18181B; margin-bottom: 20px; }
.progress-bar-wrap { height: 6px; background: #F4F4F5; border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; background: #18181B; width: 0%; transition: width .3s ease; border-radius: 999px; }

/* ─── Result Layout ──────────────────────────────────────────── */
.result-section { padding: 0 0 64px; }
.result-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 800px) {
  .result-layout { grid-template-columns: 1fr; }
}

/* ─── Detections Panel ───────────────────────────────────────── */
.detections-panel {
  background: #fff; border: 1px solid #E4E4E7; border-radius: 16px;
  padding: 24px; position: sticky; top: 76px;
}
.detections-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.detections-title { font-size: 16px; font-weight: 700; }
.detections-actions { display: flex; gap: 6px; }
.detections-list { max-height: 420px; overflow-y: auto; margin-bottom: 20px; }
.detection-group { margin-bottom: 10px; border: 1px solid #E4E4E7; border-radius: 10px; overflow: hidden; background: #fff; }
.detection-group[open] { background: #FAFAF8; }
.detection-group-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: #6B7280; padding: 10px 12px;
  cursor: pointer; list-style: none; user-select: none;
  transition: background .12s;
}
.detection-group-label:hover { background: #F4F4F5; }
.detection-group-label::-webkit-details-marker { display: none; }
.group-chevron { font-size: 14px; line-height: 1; color: #9CA3AF; transition: transform .15s; flex-shrink: 0; }
.detection-group[open] .group-chevron { transform: rotate(0deg); color: #18181B; }
.detection-group:not([open]) .group-chevron { transform: rotate(-90deg); }
.group-name { flex: 1; }
.detection-group-body { padding: 4px 6px 8px; background: #fff; }
.group-count {
  font-size: 11px; font-weight: 700; letter-spacing: 0;
  background: #F4F4F5; color: #52525B;
  padding: 1px 8px; border-radius: 999px;
  text-transform: none;
}
.detections-total {
  display: inline-block;
  font-size: 12px; font-weight: 700;
  background: #18181B; color: #fff;
  padding: 2px 9px; border-radius: 999px;
  margin-left: 6px; vertical-align: 2px;
}
.detections-total:empty { display: none; }
.instance-count {
  display: inline-block;
  font-size: 11px; font-weight: 600;
  color: #9CA3AF;
  margin-left: 6px;
}
.detection-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  cursor: pointer; transition: background .12s;
  font-size: 14px;
}
.detection-item:hover { background: #F4F4F5; }
.detection-item input[type=checkbox] { flex-shrink: 0; width: 16px; height: 16px; cursor: pointer; accent-color: #18181B; }
.detection-value { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.detection-type {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  flex-shrink: 0;
}
/* type colour coding */
.type-email    { background: #DBEAFE; color: #1D4ED8; }
.type-phone    { background: #D1FAE5; color: #065F46; }
.type-address  { background: #FEF9C3; color: #92400E; }
.type-financial{ background: #FCE7F3; color: #9D174D; }
.type-name     { background: #F3F4F6; color: #374151; }
.type-key      { background: #FEE2E2; color: #991B1B; }
.type-date     { background: #EDE9FE; color: #5B21B6; }
.type-money    { background: #FFEDD5; color: #9A3412; }
.type-org      { background: #E0E7FF; color: #3730A3; }
.type-custom   { background: #F4F4F5; color: #52525B; }
.redact-actions { display: flex; flex-direction: column; gap: 0; }

.detections-disclaimer {
  font-size: 11px;
  line-height: 1.45;
  color: #92400E;
  background: #FEF3C7;
  border: 1px solid #FDE68A;
  border-radius: 8px;
  padding: 8px 10px;
  margin: 12px 0 8px;
}

/* Smart detection toggle */
.smart-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin: 8px 0 12px;
  background: linear-gradient(135deg, #F5F3FF, #EEF2FF);
  border: 1px solid #DDD6FE;
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, border-color 0.15s;
}
.smart-toggle:hover { border-color: #C4B5FD; }
.smart-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.smart-toggle-track {
  width: 32px; height: 18px;
  background: #D4D4D8;
  border-radius: 999px;
  position: relative;
  transition: background 0.18s;
  flex-shrink: 0;
}
.smart-toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  transition: transform 0.18s;
}
.smart-toggle input:checked ~ .smart-toggle-track { background: #7C3AED; }
.smart-toggle input:checked ~ .smart-toggle-track .smart-toggle-thumb { transform: translateX(14px); }
.smart-toggle-text { display: flex; flex-direction: column; font-size: 12px; line-height: 1.35; }
.smart-toggle-text strong { color: #5B21B6; font-weight: 600; font-size: 13px; }
.smart-toggle-sub { color: #6D28D9; opacity: 0.85; font-size: 11px; }
.smart-toggle.is-loading { background: #EEF2FF; border-color: #A5B4FC; animation: smart-pulse 1.5s ease-in-out infinite; }
.smart-toggle.is-loading .smart-toggle-track { background: #A5B4FC; }
.smart-toggle.is-error .smart-toggle-sub { color: #B91C1C; }
@keyframes smart-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.0); }
  50%      { box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.18); }
}
.smart-spinner {
  width: 16px; height: 16px;
  border: 2px solid #DDD6FE;
  border-top-color: #7C3AED;
  border-radius: 50%;
  margin-left: auto;
  animation: smart-spin 0.75s linear infinite;
  flex-shrink: 0;
}
@keyframes smart-spin { to { transform: rotate(360deg); } }
.smart-toggle-progress {
  display: block;
  width: 100%;
  height: 3px;
  margin-top: 4px;
  background: #DDD6FE;
  border-radius: 2px;
  overflow: hidden;
}
.smart-toggle-progress-bar {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #7C3AED, #A78BFA);
  transition: width 0.2s ease-out;
}
.smart-privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 12px 0;
  padding: 10px 12px;
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  border-left: 3px solid #10B981;
  border-radius: 6px;
  color: #065F46;
  font-size: 12px;
  line-height: 1.45;
}
.smart-privacy-note svg { color: #10B981; margin-top: 1px; }
.smart-privacy-note strong { color: #064E3B; font-weight: 600; }

/* ─── Preview Panel ──────────────────────────────────────────── */
.preview-panel {
  background: #fff; border: 1px solid #E4E4E7; border-radius: 16px;
  overflow: hidden;
  position: sticky;
  top: 76px;
}
.preview-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid #E4E4E7;
  background: #FAFAF8;
}
.preview-label { font-size: 13px; font-weight: 700; }
.preview-hint { font-size: 12px; color: #9CA3AF; }
.preview-content {
  padding: 24px;
  font-size: 14px; line-height: 1.8; white-space: pre-wrap; word-break: break-word;
  font-family: 'Inter', monospace;
  overflow-y: auto;
  height: calc(100vh - 140px);
}
/* highlighted detections in preview */
.highlight-pending {
  background: #FEF08A; border-radius: 3px; padding: 0 2px;
  cursor: pointer; transition: background .15s;
}
.highlight-pending:hover { background: #FDE047; }
.highlight-checked {
  background: #18181B; color: #18181B; border-radius: 3px; padding: 0 2px;
  user-select: none;
}

/* ─── Features ───────────────────────────────────────────────── */
.features-section { padding: 64px 0; border-top: 1px solid #E4E4E7; }
.features-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px;
}
.feature-card {
  background: #fff; border: 1px solid #E4E4E7; border-radius: 16px; padding: 28px 24px;
}
.feature-icon { margin-bottom: 14px; line-height: 0; }
.feature-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.feature-card p { font-size: 14px; color: #52525B; line-height: 1.6; }

/* ─── FAQ ────────────────────────────────────────────────────── */
.faq-section { padding: 64px 0; border-top: 1px solid #E4E4E7; }
.faq-section .container { max-width: 680px; }
.faq-header { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 32px; }
.faq-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  background: #EFF6FF; color: #2563EB; padding: 4px 12px; border-radius: 999px;
}
.faq-header h2 { font-size: 24px; font-weight: 700; }
.faq-list { display: flex; flex-direction: column; gap: 8px; }
.faq-item {
  border: 1px solid #E4E4E7; border-radius: 12px; overflow: hidden;
  background: #fff;
}
.faq-question {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; cursor: pointer; list-style: none;
  font-weight: 600; font-size: 15px; gap: 12px;
  user-select: none;
}
.faq-question::-webkit-details-marker { display: none; }
details[open] .faq-question { color: #2563EB; }
.faq-chevron { font-size: 18px; flex-shrink: 0; transition: transform .2s; }
details[open] .faq-chevron { transform: rotate(180deg); color: #2563EB; }
.faq-answer {
  padding: 0 20px 18px 20px; font-size: 14px; color: #52525B;
  border-left: 3px solid #E5E7EB; margin-left: 20px; padding-left: 14px;
}

/* ─── Footer ─────────────────────────────────────────────────── */
.site-footer { border-top: 1px solid #E4E4E7; padding: 32px 0 56px; }
.footer-copy { font-size: 12px; text-align: center; color: #9CA3AF; }
.footer-copy a { color: #6B7280; }
.footer-copy a:hover { color: #18181B; }
.footer-support-link {
  background: none; border: none; font-family: inherit; font-size: inherit;
  color: #6B7280; cursor: pointer; padding: 0;
  text-decoration: underline; text-decoration-color: transparent;
  transition: color .15s, text-decoration-color .15s;
}
.footer-support-link:hover { color: #18181B; text-decoration-color: currentColor; }

/* ─── Support button (header) ────────────────────────────────── */
.btn-support {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  background: #29ABE0; color: #fff;
  border: none; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.btn-support:hover { background: #22A0D5; }

/* ─── Donation Modal ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: cfa-fadeIn 200ms ease;
}
.modal-overlay.hidden { display: none !important; }
.modal-tab-panel.hidden,
[role="tabpanel"].hidden { display: none !important; }
@keyframes cfa-fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
  width: 100%; max-width: 420px;
  position: relative;
  animation: cfa-slideUp 250ms ease;
}
@keyframes cfa-slideUp {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.modal-close {
  width: 32px; height: 32px; flex-shrink: 0;
  border: none; background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; color: #9CA3AF;
  transition: background .15s, color .15s;
}
.modal-close:hover { background: #F4F4F5; color: #18181B; }
.modal-body { padding: 36px 32px 28px; text-align: center; }
.modal-coffee { font-size: 36px; margin-bottom: 12px; display: block; }
.modal-body h3 { font-size: 20px; font-weight: 600; letter-spacing: -.02em; margin-bottom: 8px; }
.modal-desc { font-size: 14px; color: #6B7280; line-height: 1.6; margin-bottom: 24px; }
.amount-grid {
  display: grid; grid-template-columns: repeat(4,1fr);
  gap: 8px; margin-bottom: 16px;
}
.amount-btn {
  padding: 10px 0;
  border: 1.5px solid #E4E4E7; border-radius: 8px;
  background: #fff; font-family: inherit;
  font-size: 14px; font-weight: 500; color: #18181B;
  cursor: pointer; transition: all .15s;
}
.amount-btn:hover { border-color: #18181B; color: #18181B; background: #F4F4F5; }
.amount-btn.selected { border-color: #18181B; background: #18181B; color: #fff; }
.custom-input {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid #E4E4E7; border-radius: 8px;
  font-family: inherit; font-size: 14px; color: #18181B; background: #fff;
  margin-bottom: 16px; outline: none;
  transition: border-color .15s;
}
.custom-input:focus { border-color: #18181B; }
.custom-input.hidden { display: none !important; }
.btn-kofi {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 13px 20px;
  background: #29ABE0; color: #fff;
  border: none; border-radius: 8px;
  font-family: inherit; font-size: 15px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: background .15s, transform .15s;
  margin-top: 8px; margin-bottom: 12px;
}
.btn-kofi:hover { background: #22A0D5; transform: translateY(-1px); text-decoration: none; }
.btn-kofi:active { transform: translateY(0); }
.modal-note { font-size: 12px; color: #9CA3AF; }

/* ─── Modal header (tabs + close in one row) ────────────────── */
.modal-header {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #E4E4E7;
  border-radius: 16px 16px 0 0;
  overflow: hidden;
  padding-right: 6px;
}
.modal-tabs {
  display: flex;
  flex: 1;
}
.modal-tab {
  flex: 1;
  padding: 13px 0;
  font-size: 14px;
  font-weight: 500;
  color: #6B7280;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.modal-tab:hover  { color: #18181B; }
.modal-tab.active { color: #7C3AED; border-bottom-color: #7C3AED; }
.tab-eth-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #627EEA 0%, #9B73F8 100%);
  color: #fff;
  font-size: 11px;
  vertical-align: middle;
  margin-right: 4px;
  position: relative;
  top: -1px;
}

/* ─── Crypto panel ────────────────────────────────────────── */
.crypto-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #F9F9FB;
  border: 1px solid #E4E4E7;
  border-radius: 10px;
  padding: 14px;
  margin: 16px 0 14px;
  text-align: left;
}
.crypto-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #627EEA 0%, #9B73F8 100%);
  color: #fff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.crypto-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.crypto-addr {
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 11px;
  color: #374151;
  word-break: break-all;
}
.btn-copy {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 500;
  color: #374151;
  background: #fff;
  border: 1px solid #D1D5DB;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, color .12s;
  flex-shrink: 0;
}
.btn-copy:hover  { background: #F3F4F6; }
.btn-copy.copied { color: #059669; border-color: #6EE7B7; background: #ECFDF5; }
.crypto-qr {
  display: block;
  width: 180px;
  height: 180px;
  margin: 4px auto 10px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
  image-rendering: crisp-edges;
}
.crypto-note { margin-top: 4px; }

/* ─── Supported networks collapsible ─────────────────────── */
.crypto-networks {
  font-size: 12px;
  color: #6B7280;
  margin: 12px 0 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.crypto-networks summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: #6B7280;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #F4F4F5;
  border: 1px solid #E4E4E7;
  border-radius: 20px;
  padding: 4px 12px 4px 10px;
  user-select: none;
  transition: background .12s, border-color .12s;
}
.crypto-networks summary:hover {
  background: #EBEBED;
  border-color: #D1D5DB;
}
.crypto-networks summary::before {
  content: '▶';
  font-size: 8px;
  color: #9CA3AF;
  transition: transform .15s;
}
.crypto-networks[open] summary::before { transform: rotate(90deg); }
.crypto-networks ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 8px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}
.crypto-networks ul li {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #F4F4F5;
  border: 1px solid #E4E4E7;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 11px;
  color: #374151;
}
.crypto-networks ul li img {
  flex-shrink: 0;
  border-radius: 50%;
}

/* ─── PDF canvas preview ──────────────────────────────────── */
.preview-content.pdf-preview {
  padding: 16px;
  background: #E5E7EB;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  white-space: normal;
}

/* ─── Image preview ───────────────────────────────────────── */
.preview-content.image-preview {
  padding: 0;
  background: #E5E7EB;
  white-space: normal;
}
.image-preview-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
}
.image-canvas-holder {
  background: #fff;
  border-radius: 4px;
  padding: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
  text-align: center;
}
.image-canvas-holder canvas {
  max-width: 100%;
  height: auto;
  display: inline-block;
}
.image-text-holder {
  background: #fff;
  border-radius: 4px;
  padding: 14px 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 360px;
  overflow-y: auto;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
}
.image-text-holder mark.highlight-pending {
  background: #FEF08A;
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
  cursor: pointer;
}

/* ─── DOCX preview (mammoth-rendered) ─────────────────────── */
.preview-content.docx-preview {
  padding: 16px;
  background: #E5E7EB;
  white-space: normal;
  display: flex;
  justify-content: center;
}
.docx-page {
  background: #fff;
  width: 100%;
  max-width: 820px;
  padding: 48px 56px;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
  border-radius: 2px;
  font-family: "Calibri", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: #18181B;
  word-wrap: break-word;
}
.docx-page p          { margin: 0 0 10px; }
.docx-page h1         { font-size: 26px; margin: 18px 0 10px; }
.docx-page h2         { font-size: 21px; margin: 16px 0 8px; }
.docx-page h3         { font-size: 17px; margin: 14px 0 6px; }
.docx-page ul,
.docx-page ol         { margin: 0 0 10px 24px; }
.docx-page table      { border-collapse: collapse; margin: 8px 0; }
.docx-page table td,
.docx-page table th   { border: 1px solid #D4D4D8; padding: 4px 8px; }
.docx-page img        { max-width: 100%; height: auto; display: block; margin: 8px 0; }
mark.docx-mark {
  background: #FEF08A;
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(202,138,4,.5);
}

/* ─── XLSX preview (SheetJS HTML grid) ────────────────────── */
.preview-content.xlsx-preview {
  padding: 12px;
  background: #F4F4F5;
  white-space: normal;
}
.xlsx-wrap { display: flex; flex-direction: column; gap: 24px; }
.xlsx-sheet {
  background: #fff;
  border: 1px solid #D4D4D8;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.xlsx-sheet-title {
  margin: 0;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  background: #107C41;
  color: #fff;
  border-bottom: 1px solid #0B5C30;
}
.xlsx-table-wrap { overflow-x: auto; max-height: 600px; }
.xlsx-table-wrap table {
  border-collapse: collapse;
  font-family: "Calibri", "Helvetica Neue", Arial, sans-serif;
  font-size: 12px;
  width: 100%;
}
.xlsx-table-wrap td,
.xlsx-table-wrap th {
  border: 1px solid #E4E4E7;
  padding: 4px 8px;
  min-width: 60px;
  white-space: nowrap;
  vertical-align: top;
}
.xlsx-table-wrap tr:nth-child(even) td { background: #FAFAFA; }

/* ─── PPTX preview (slide cards) ──────────────────────────── */
.preview-content.pptx-preview {
  padding: 16px;
  background: #E5E7EB;
  white-space: normal;
}
.pptx-wrap { display: flex; flex-direction: column; gap: 18px; }
.pptx-slide {
  background: #fff;
  border-radius: 4px;
  padding: 28px 32px;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
  font-family: "Calibri", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #18181B;
  aspect-ratio: 16 / 9;
  min-height: 220px;
  overflow: auto;
}
.pptx-slide-num {
  font-size: 11px;
  font-weight: 600;
  color: #71717A;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 12px;
}
.pptx-block { margin-bottom: 12px; }
.pptx-block p { margin: 0 0 6px; }
.pptx-block:first-of-type p:first-child { font-size: 20px; font-weight: 600; }
.pptx-empty { color: #A1A1AA; }

/* ─── Markdown preview ────────────────────────────────────── */
.preview-content.md-preview {
  padding: 16px;
  background: #F4F4F5;
  white-space: normal;
  display: flex;
  justify-content: center;
}
.md-page {
  background: #fff;
  width: 100%;
  max-width: 820px;
  padding: 32px 48px;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: #18181B;
}
.md-page h1 { font-size: 28px; margin: 0 0 14px; border-bottom: 1px solid #E4E4E7; padding-bottom: 6px; }
.md-page h2 { font-size: 22px; margin: 22px 0 10px; border-bottom: 1px solid #E4E4E7; padding-bottom: 4px; }
.md-page h3 { font-size: 18px; margin: 18px 0 8px; }
.md-page p  { margin: 0 0 12px; }
.md-page ul, .md-page ol { margin: 0 0 12px 24px; }
.md-page code {
  background: #F4F4F5;
  padding: 1px 5px;
  border-radius: 3px;
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 13px;
}
.md-page pre {
  background: #18181B;
  color: #FAFAFA;
  padding: 12px 16px;
  border-radius: 4px;
  overflow-x: auto;
  margin: 0 0 12px;
}
.md-page pre code { background: transparent; color: inherit; padding: 0; }
.md-page blockquote {
  margin: 0 0 12px;
  padding: 4px 14px;
  border-left: 3px solid #D4D4D8;
  color: #52525B;
}
.md-page table { border-collapse: collapse; margin: 0 0 12px; }
.md-page table th, .md-page table td { border: 1px solid #D4D4D8; padding: 6px 10px; }
.md-page img { max-width: 100%; height: auto; }
.pdf-page-wrap {
  position: relative;
  width: 100%;
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
  border-radius: 2px;
  background: #fff;
  overflow: hidden;
  user-select: none;
}
.pdf-page-canvas {
  display: block;
  width: 100%;
  height: auto;
}
.pdf-page-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: auto;     /* same as the canvas \u2014 derive height from its own aspect ratio */
  cursor: crosshair;
}

/* ─── Empty state ────────────────────────────────────────────── */
.empty-detections { text-align: center; padding: 32px 16px; color: #9CA3AF; font-size: 14px; }
/* ─── Delete button on detection items ───────────────────────── */
.delete-detection {
  background: none; border: none; color: #D1D5DB;
  font-size: 17px; line-height: 1; padding: 0 3px;
  cursor: pointer; border-radius: 4px; flex-shrink: 0;
  opacity: 0; transition: opacity .12s, color .12s;
}
.detection-item:hover .delete-detection { opacity: 1; }
.delete-detection:hover { color: #EF4444; }

/* ─── Manual selection tooltip ──────────────────────────────── */
.selection-tooltip {
  position: fixed;
  z-index: 9999;
  transform: translateX(-50%);
  background: #18181B;
  color: #fff;
  border-radius: 8px;
  padding: 4px;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
  pointer-events: auto;
  animation: tooltip-in .1s ease;
}
@keyframes tooltip-in {
  from { opacity: 0; transform: translateX(-50%) translateY(4px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.selection-tooltip::before {
  content: '';
  position: absolute;
  bottom: 100%; left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: #18181B;
}
.sel-add-btn {
  background: none; border: none;
  color: #fff; font-family: inherit;
  font-size: 13px; font-weight: 500;
  padding: 6px 14px;
  cursor: pointer; border-radius: 6px; display: block;
}
.sel-add-btn:hover { background: rgba(255,255,255,.12); }
.sel-add-btn em { font-style: normal; opacity: .65; }

/* ─── Highlight popup (click on PDF overlay) ─────────────────── */
.highlight-popup {
  position: fixed;
  z-index: 9999;
  transform: translateX(-50%);
  background: #18181B;
  color: #fff;
  border-radius: 10px;
  padding: 10px 12px 8px;
  min-width: 180px;
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
  animation: tooltip-in .1s ease;
}
.hp-label {
  font-size: 12px; color: #9CA3AF;
  margin-bottom: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 260px;
}
.hp-actions { display: flex; gap: 6px; }
.hp-btn {
  flex: 1; background: rgba(255,255,255,.08);
  color: #fff; font-family: inherit;
  font-size: 12px; font-weight: 500;
  padding: 6px 10px; border-radius: 6px;
  cursor: pointer; border: none;
  transition: background .12s;
}
.hp-btn:hover { background: rgba(255,255,255,.16); }
.hp-remove { background: #7F1D1D; }
.hp-remove:hover { background: #991B1B; }