/* ============================================================.
   DocValidar — styles.css
   Diseño institucional-moderno, mobile-first
   Syne (display) + IBM Plex Mono (datos)
   Modo oscuro por defecto, toggle a claro
   ============================================================ */

/* ===================== VARIABLES ===================== */
:root {
  /* Oscuro (default) */
  --bg:          #0d0f14;
  --bg-2:        #141720;
  --bg-3:        #1c2030;
  --bg-4:        #242840;
  --border:      #2a2f48;
  --border-2:    #363c5a;
  --text:        #e8ecf4;
  --text-2:      #9aa3bf;
  --text-3:      #636b8a;
  --accent:      #4f7eff;
  --accent-2:    #3364e0;
  --accent-glow: rgba(79,126,255,0.18);
  --success:     #22d18b;
  --success-bg:  rgba(34,209,139,0.1);
  --danger:      #ff4d6d;
  --danger-bg:   rgba(255,77,109,0.1);
  --warn:        #ffb84d;
  --warn-bg:     rgba(255,184,77,0.1);
  --info:        #5bceff;
  --info-bg:     rgba(91,206,255,0.1);
  --mono:        'IBM Plex Mono', 'Courier New', monospace;
  --sans:        'Syne', 'Trebuchet MS', sans-serif;
  --radius:      12px;
  --radius-sm:   8px;
  --radius-lg:   16px;
  --shadow:      0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.3);
  --transition:  0.2s cubic-bezier(0.4,0,0.2,1);
}

[data-theme="light"] {
  --bg:          #f4f6fb;
  --bg-2:        #ffffff;
  --bg-3:        #eef0f8;
  --bg-4:        #e4e8f5;
  --border:      #d0d6e8;
  --border-2:    #b8c0d8;
  --text:        #1a1e2e;
  --text-2:      #4a5268;
  --text-3:      #8a92a8;
  --accent:      #2255e8;
  --accent-2:    #1a44c8;
  --accent-glow: rgba(34,85,232,0.12);
  --success:     #10b56a;
  --success-bg:  rgba(16,181,106,0.1);
  --danger:      #e02040;
  --danger-bg:   rgba(224,32,64,0.08);
  --warn:        #d98000;
  --warn-bg:     rgba(217,128,0,0.1);
  --info:        #0a7eb0;
  --info-bg:     rgba(10,126,176,0.1);
  --shadow:      0 4px 24px rgba(0,0,0,0.1);
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.07);
}

/* ===================== RESET & BASE ===================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
}

/* Fondo sutil con patrón de cuadrícula institucional */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
}

/* ===================== SKIP NAV ===================== */
.skip-nav {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--accent);
  color: white;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  z-index: 9999;
  transition: top 0.2s;
  text-decoration: none;
}
.skip-nav:focus { top: 16px; }

/* ===================== HEADER ===================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background var(--transition);
}

.header-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  color: var(--accent);
  flex-shrink: 0;
  line-height: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.brand-name {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
}

.brand-sub {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--text-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-icon {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}
.btn-icon:hover {
  background: var(--bg-4);
  color: var(--text);
  border-color: var(--border-2);
}

/* Ocultar ícono según tema */
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: none; }

.privacy-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--success-bg);
  border: 1px solid rgba(34,209,139,0.3);
  color: var(--success);
  padding: 4px 10px;
  border-radius: 20px;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ===================== TAB NAV ===================== */
.tab-nav {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 61px;
  z-index: 90;
  transition: background var(--transition);
}

.tab-nav-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 8px;
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.tab-nav-inner::-webkit-scrollbar { display: none; }

.tab-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-3);
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
  letter-spacing: 0.01em;
  position: relative;
}
.tab-btn:hover { color: var(--text-2); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ===================== MAIN CONTENT ===================== */
.main-content {
  flex: 1;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px 48px;
  position: relative;
  z-index: 1;
}

/* ===================== TAB PANELS ===================== */
.tab-panel {
  display: none;
  animation: fadeIn 0.25s ease;
}
.tab-panel.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===================== SECTION HEADER ===================== */
.section-header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.section-header h2 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 6px;
}

.section-desc {
  color: var(--text-2);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* ===================== INPUT GROUP ===================== */
.input-group {
  margin-bottom: 16px;
}

.input-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.input-wrapper {
  position: relative;
}

.url-input {
  width: 100%;
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.82rem;
  padding: 12px 14px 28px;
  border-radius: var(--radius);
  resize: vertical;
  min-height: 80px;
  transition: border-color var(--transition), box-shadow var(--transition);
  line-height: 1.5;
  -webkit-appearance: none;
}
.url-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.url-input::placeholder { color: var(--text-3); }

.input-counter {
  position: absolute;
  bottom: 8px;
  right: 10px;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--text-3);
}

.input-help {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 6px;
}

/* ===================== ACTION ROW ===================== */
.action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

/* ===================== BUTTONS ===================== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.01em;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-2);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-3);
  color: var(--text);
  border: 1.5px solid var(--border-2);
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-4);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: none;
  color: var(--text-2);
  border: none;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.btn-ghost:hover { color: var(--text); background: var(--bg-3); }

/* ===================== RATE LIMIT INDICATOR ===================== */
.rate-limit-indicator {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--warn);
  flex: 1;
  text-align: right;
}

/* ===================== RESULTS CONTAINER ===================== */
.results-container {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn 0.3s ease;
}
.results-container.hidden { display: none; }

/* ===================== SCORE ROW ===================== */
.score-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.score-row.triple .score-card { flex: 1; min-width: 100px; }

.score-card {
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 140px;
  transition: border-color var(--transition);
}

.score-gauge {
  position: relative;
  width: 120px;
  height: 72px;
}
.score-gauge.mini {
  width: 90px;
  height: 54px;
}

.gauge-svg { width: 100%; height: 100%; }

.score-value {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text);
}
.score-value.sm { font-size: 1rem; }

.score-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
}

.score-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
  flex: 2;
}

/* ===================== BADGES ===================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
}

.badge.success  { background: var(--success-bg); color: var(--success);  border-color: rgba(34,209,139,0.3); }
.badge.danger   { background: var(--danger-bg);  color: var(--danger);   border-color: rgba(255,77,109,0.3); }
.badge.warn     { background: var(--warn-bg);    color: var(--warn);     border-color: rgba(255,184,77,0.3); }
.badge.info     { background: var(--info-bg);    color: var(--info);     border-color: rgba(91,206,255,0.3); }
.badge.neutral  { background: var(--bg-3);       color: var(--text-2);   border-color: var(--border); }

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ===================== DATA PANEL ===================== */
.data-panel {
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.data-panel-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-3);
}

.data-panel-header h3 {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
}

.data-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

@media (max-width: 500px) {
  .data-grid { grid-template-columns: 1fr; }
}

.data-item {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.data-item:nth-child(even) { border-right: none; }
.data-item:last-child,
.data-item:nth-last-child(2):nth-child(odd) { border-bottom: none; }

.data-item-key {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
}

.data-item-val {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text);
  word-break: break-all;
  line-height: 1.4;
}

.data-item-val.highlight {
  color: var(--accent);
  font-weight: 600;
}

.data-item-val.mono-sm {
  font-size: 0.72rem;
  color: var(--text-2);
}

/* ===================== VALIDATION TIMELINE ===================== */
.validation-timeline {
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.validation-timeline h3 {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
  margin-bottom: 14px;
}

.timeline-items {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}
.timeline-items::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 12px;
  bottom: 12px;
  width: 1px;
  background: var(--border);
}

.timeline-item {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  align-items: flex-start;
  position: relative;
  z-index: 1;
}

.timeline-dot {
  width: 23px;
  height: 23px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 11px;
  border: 2px solid;
  background: var(--bg-2);
}
.timeline-dot.success { border-color: var(--success); color: var(--success); }
.timeline-dot.danger  { border-color: var(--danger);  color: var(--danger); }
.timeline-dot.warn    { border-color: var(--warn);    color: var(--warn); }
.timeline-dot.info    { border-color: var(--info);    color: var(--info); }

.timeline-content {
  flex: 1;
  padding-top: 1px;
}

.timeline-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.timeline-detail {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-3);
  margin-top: 2px;
  line-height: 1.4;
}

/* ===================== TECH PANEL ===================== */
.tech-panel {
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.tech-panel-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
  list-style: none;
  background: var(--bg-3);
  transition: background var(--transition);
  user-select: none;
  -webkit-user-select: none;
}
.tech-panel-summary:hover { background: var(--bg-4); }
.tech-panel-summary::-webkit-details-marker { display: none; }

.tech-panel-body {
  padding: 16px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-2);
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ===================== QR SCANNER ===================== */
.qr-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.qr-viewport {
  position: relative;
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Overrides html5-qrcode default styles */
#qrReader { width: 100% !important; }
#qrReader video { border-radius: var(--radius-sm) !important; }
#qrReader img { display: none !important; }
#qrReader__scan_region { border-radius: var(--radius-sm) !important; }
#qrReader__dashboard { display: none !important; }
#qrReader__status_span { display: none !important; }

.qr-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.qr-overlay.scanning { display: none; }

.qr-frame {
  width: 200px;
  height: 200px;
  position: relative;
}
.qr-frame::before,
.qr-frame::after {
  content: '';
  position: absolute;
  width: 30px;
  height: 30px;
  border-color: var(--accent);
  border-style: solid;
}
.qr-frame::before {
  top: 0; left: 0;
  border-width: 3px 0 0 3px;
  border-radius: 4px 0 0 0;
}
.qr-frame::after {
  bottom: 0; right: 0;
  border-width: 0 3px 3px 0;
  border-radius: 0 0 4px 0;
}

/* Pseudo elementos de las otras esquinas via box-shadow en el contenedor */
.qr-frame {
  box-shadow:
    inset 30px 30px 0 -27px var(--accent),
    inset -30px 30px 0 -27px var(--accent),
    inset -30px -30px 0 -27px var(--accent),
    inset 30px -30px 0 -27px var(--accent);
  border: none;
}

.qr-hint {
  font-size: 0.82rem;
  color: var(--text-3);
  margin-top: 20px;
  font-weight: 600;
}

.qr-status {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-2);
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 20px;
  white-space: nowrap;
}

.qr-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.qr-rate-info {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-3);
  text-align: center;
}

.qr-detected-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--success-bg);
  border: 1.5px solid rgba(34,209,139,0.4);
  color: var(--success);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.9rem;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===================== PDF DROP ZONE ===================== */
.drop-zone {
  background: var(--bg-2);
  border: 2px dashed var(--border-2);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition);
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.drop-zone:hover,
.drop-zone:focus,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--bg-3);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.drop-zone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 8px;
  text-align: center;
}

.drop-icon {
  color: var(--text-3);
  margin-bottom: 4px;
  transition: color var(--transition);
}
.drop-zone:hover .drop-icon { color: var(--accent); }

.drop-text {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.drop-subtext {
  font-size: 0.82rem;
  color: var(--text-3);
}

.drop-limits {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-3);
  margin-top: 8px;
  letter-spacing: 0.02em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}

/* ===================== PDF PROGRESS ===================== */
.pdf-progress {
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.pdf-progress.hidden { display: none; }

.progress-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
}

.progress-step-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 9px;
}
.progress-step-dot.pending  { border-color: var(--border-2); color: var(--text-3); }
.progress-step-dot.running  { border-color: var(--accent); color: var(--accent); animation: spin 1s linear infinite; }
.progress-step-dot.done     { border-color: var(--success); color: var(--success); }
.progress-step-dot.error    { border-color: var(--danger);  color: var(--danger); }

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.progress-step-label {
  color: var(--text-2);
  font-size: 0.82rem;
}
.progress-step-label.active { color: var(--text); font-weight: 600; }

/* ===================== SIGNATURES PANEL ===================== */
.signatures-panel { display: flex; flex-direction: column; gap: 12px; }
.signatures-panel.hidden { display: none; }

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
  margin-bottom: 4px;
}

.signature-card {
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.signature-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-3);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.signature-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.88rem;
}

.signature-card-body {
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

@media (max-width: 480px) {
  .signature-card-body { grid-template-columns: 1fr; }
}

.sig-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sig-field-key {
  font-family: var(--mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
}
.sig-field-val {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text);
  word-break: break-all;
  line-height: 1.4;
}
.sig-field-val.valid   { color: var(--success); }
.sig-field-val.invalid { color: var(--danger); }
.sig-field-val.warn    { color: var(--warn); }

/* ===================== COMPARE ===================== */
.compare-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

@media (max-width: 600px) {
  .compare-grid { grid-template-columns: 1fr; }
}

.compare-source-card {
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.compare-source-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-3);
  border-bottom: 1px solid var(--border);
}

.compare-source-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
}
.url-icon { background: var(--info-bg);    color: var(--info);    border: 1px solid rgba(91,206,255,0.3); }
.qr-icon  { background: var(--success-bg); color: var(--success); border: 1px solid rgba(34,209,139,0.3); }
.pdf-icon { background: var(--warn-bg);    color: var(--warn);    border: 1px solid rgba(255,184,77,0.3); }

.compare-source-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.compare-source-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
}

.compare-source-status {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--text-3);
}

.compare-source-body {
  padding: 12px 14px;
  min-height: 60px;
}

.no-data-hint {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-3);
  font-style: italic;
}

.compare-actions { margin-bottom: 8px; }

.compare-result-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.compare-result-icon { flex-shrink: 0; margin-top: 1px; }
.compare-result-label { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.compare-result-detail { font-family: var(--mono); font-size: 0.72rem; color: var(--text-3); margin-top: 3px; }

.compare-result-item.match  { border-left: 3px solid var(--success); }
.compare-result-item.mismatch { border-left: 3px solid var(--danger); }
.compare-result-item.warn   { border-left: 3px solid var(--warn); }
.compare-result-item.info   { border-left: 3px solid var(--info); }

/* ===================== CRYPTO DISCLAIMER ===================== */
.crypto-disclaimer {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 14px 16px;
  background: var(--info-bg);
  border: 1px solid rgba(91,206,255,0.25);
  border-radius: var(--radius);
  color: var(--text-2);
}
.crypto-disclaimer svg { flex-shrink: 0; color: var(--info); margin-top: 1px; }
.crypto-disclaimer p { font-size: 0.78rem; line-height: 1.55; }
.crypto-disclaimer strong { color: var(--info); }

/* ===================== TOAST ===================== */
.toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 400px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-3);
  border: 1.5px solid var(--border-2);
  color: var(--text);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.84rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  pointer-events: auto;
  animation: toastIn 0.3s ease;
  transition: opacity 0.3s;
}
.toast.success { border-color: rgba(34,209,139,0.5); }
.toast.danger  { border-color: rgba(255,77,109,0.5); }
.toast.warn    { border-color: rgba(255,184,77,0.5); }
.toast.out     { opacity: 0; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===================== RATE LIMIT OVERLAY ===================== */
.rate-limit-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  padding: 20px;
}
.rate-limit-overlay.hidden { display: none; }

.rate-limit-dialog {
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  text-align: center;
  max-width: 360px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
  animation: fadeIn 0.25s ease;
}

.rate-limit-dialog h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--warn);
}

.rate-limit-dialog p {
  font-size: 0.88rem;
  color: var(--text-2);
  line-height: 1.5;
}

.rate-limit-progress {
  width: 100%;
  height: 4px;
  background: var(--bg-4);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}

.rate-limit-bar {
  height: 100%;
  background: var(--warn);
  border-radius: 2px;
  width: 100%;
  transition: width 1s linear;
}

/* ===================== FOOTER ===================== */
.app-footer {
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  position: relative;
  z-index: 1;
}

.footer-inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--text-3);
}

.footer-brand { font-weight: 700; color: var(--text-2); }
.footer-sep   { color: var(--border-2); }
.footer-note  { flex: 1; }

/* ===================== UTILITIES ===================== */
.hidden { display: none !important; }

.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warn    { color: var(--warn); }
.text-info    { color: var(--info); }

/* ===================== SCROLLBAR CUSTOM ===================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ===================== SELECTION ===================== */
::selection { background: var(--accent-glow); color: var(--text); }

/* ===================== FOCUS VISIBLE ===================== */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ===================== MOBILE SPECIFIC ===================== */
@media (max-width: 600px) {
  .section-header h2 { font-size: 1.2rem; }
  .score-row { flex-direction: column; }
  .score-card { min-width: auto; }
  .score-badges { flex: none; width: 100%; }

  .header-inner { padding: 10px 12px; }
  .main-content { padding: 16px 12px 40px; }

  .brand-sub { display: none; }
  .tab-btn { padding: 11px 12px; font-size: 0.8rem; }
}

/* ===================== ANIMATIONS ===================== */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.loading-pulse { animation: pulse 1.5s ease-in-out infinite; }

/* Scanning line animation for QR */
@keyframes scanLine {
  0%   { top: 10%; }
  100% { top: 90%; }
}

.qr-scan-line {
  position: absolute;
  left: 10%;
  width: 80%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: scanLine 2s ease-in-out infinite alternate;
  pointer-events: none;
  opacity: 0.7;
}
