#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Luciferase A4 彩页 B 版（数据看板 + 完整对比表）"""
import base64

def b64(p): return base64.b64encode(open(p,'rb').read()).decode()
LOGO=b64('/tmp/luc_logo.png'); REACT=b64('/tmp/luc_reaction.jpg'); QR=b64('/Users/liuxinyuan/work/公司资料/试用装申请.png')
OUT='/Users/liuxinyuan/Desktop/Hermes输出-工作类/对外物料/Luciferase_A4_优化版B_数据看板_20261027.html'

html=f'''<!DOCTYPE html><html lang="zh-CN"><head><meta charset="utf-8"><style>
@page{{size:A4;margin:0}}
*{{box-sizing:border-box;margin:0;padding:0}}
html,body{{width:210mm;height:297mm;overflow:hidden}}
body{{font-family:"PingFang SC","Microsoft YaHei",-apple-system,sans-serif;color:#17324d;background:#fff;-webkit-print-color-adjust:exact;print-color-adjust:exact}}
.page{{width:210mm;height:297mm;padding:8mm 10mm 7mm;display:flex;flex-direction:column;position:relative;
background:radial-gradient(circle at 96% 3%,rgba(26,115,232,.09),transparent 18%),radial-gradient(circle at 3% 97%,rgba(30,142,90,.07),transparent 16%),#fff}}
.top{{display:flex;align-items:center;gap:3mm;border-bottom:.6pt solid #dbe6f0;padding-bottom:1.4mm;flex:0 0 auto}}
.top img{{height:8mm}}.top .sl{{margin-left:auto;font-size:6.8pt;color:#1565c0;letter-spacing:.9pt}}
h1{{font-size:26pt;line-height:1.05;letter-spacing:.2pt;color:#0b3f7a}}
h2{{font-size:9.4pt;color:#0b3f7a;margin:0 0 1mm;display:flex;align-items:center;gap:2mm}}
h2:before{{content:"";width:1.2mm;height:3.6mm;background:#1a73e8;border-radius:.6mm}}
.small{{font-size:6.3pt;color:#5f7183;line-height:1.42}}
.hero{{margin-top:1.6mm;height:29mm;display:flex;align-items:flex-end;gap:4mm;border-bottom:2.5pt solid #1a73e8;padding-bottom:1.8mm;flex:0 0 auto}}
.hero .tag2{{font-size:6.3pt;color:#1a73e8;letter-spacing:.9pt;font-weight:600}}
.hero h1{{margin-top:.3mm}}
.hero h1 span{{font-size:12pt;font-weight:400;color:#415a70}}
.hero .sub{{font-size:8.1pt;color:#5f7183;margin-top:.6mm}}
.hero .code{{margin-left:auto;text-align:right;font-size:6.8pt;color:#415a70;line-height:1.5}}
.main{{display:grid;grid-template-columns:1.02fr .98fr;gap:3.2mm;height:158mm;margin-top:2.4mm;flex:0 0 auto}}
.left{{display:flex;flex-direction:column;gap:2mm;height:100%}}
.box{{border:.6pt solid #dbe6f0;border-radius:2mm;padding:2mm 2.6mm;background:#fff}}
.reaction img{{width:100%;display:block}}
.reaction .eq{{font-size:6.1pt;color:#415a70;margin-top:.8mm;line-height:1.4}}
.apps{{display:grid;grid-template-columns:repeat(3,1fr);gap:1.4mm}}
.app{{background:#f3f8fe;border-radius:1.2mm;padding:2.1mm 1.2mm;text-align:center;font-size:6.1pt;color:#5f7183;line-height:1.3}}
.app b{{display:block;color:#1a73e8;font-size:7pt;margin-bottom:.2mm}}
.app em{{display:block;font-style:normal;color:#17456e;font-size:6.3pt}}
table{{width:100%;border-collapse:collapse;font-size:6.6pt}}
th{{background:#eaf3fd;color:#17456e;text-align:left;padding:.9mm 1.3mm;border:.5pt solid #cfe0ef;font-weight:600}}
td{{padding:.9mm 1.3mm;border:.5pt solid #dbe6f0;vertical-align:top}}
.forms2{{display:flex;gap:1.6mm}}
.forms2 .f{{flex:1;background:#f3f8fe;border-radius:1.2mm;padding:1.6mm;text-align:center;font-size:6.1pt;color:#5f7183}}
.forms2 .f b{{display:block;font-size:7.2pt;color:#17456e;margin-bottom:.2mm}}
.dash{{background:linear-gradient(160deg,#0b2f57,#0e4d8a 55%,#1264b8);border-radius:2.4mm;color:#fff;padding:3mm 3.2mm;display:flex;flex-direction:column;gap:1.8mm;height:100%}}
.dash .ttl{{font-size:8.6pt;letter-spacing:.6pt;opacity:.96}}
.dash .row{{display:flex;gap:2mm}}
.metric{{flex:1;background:rgba(255,255,255,.11);border:1px solid rgba(255,255,255,.2);border-radius:1.5mm;padding:1.8mm 1.8mm}}
.metric b{{display:block;font-size:18pt;line-height:1.02}}
.metric span{{font-size:6pt;opacity:.9;line-height:1.3;display:block;margin-top:.2mm}}
.metric .cmp{{font-size:5.7pt;opacity:.72;margin-top:.5mm}}
.chartbox{{background:rgba(255,255,255,.97);border-radius:1.5mm;padding:1.6mm 2mm}}
.chartbox .ct{{font-size:6.6pt;color:#17456e;font-weight:600;margin-bottom:.4mm}}
.chartbox svg{{width:100%;height:auto;display:block}}
.chartbox.sig svg{{max-height:24mm}}
.chartbox.ret svg{{max-height:54mm}}
.twoforms{{display:flex;gap:1.8mm;align-items:center;background:rgba(255,255,255,.11);border-radius:1.5mm;padding:1.6mm 2mm}}
.twoforms .f{{flex:1;font-size:6.1pt;opacity:.9;text-align:center}}
.twoforms .f b{{display:block;font-size:7.8pt;margin-top:.2mm}}
.note{{font-size:5.9pt;opacity:.8;line-height:1.35}}
.compare{{margin-top:2mm;flex:0 0 auto}}
.compare table{{font-size:6.7pt}}
.compare th{{padding:1.1mm 1.6mm}}
.compare td{{padding:1.1mm 1.6mm}}
.compare .note{{color:#5f7183;font-size:6.1pt;margin-top:1mm}}
.footer{{margin-top:auto;border-top:.6pt solid #dbe6f0;padding-top:1.2mm;display:flex;align-items:center;gap:3.5mm;flex:0 0 auto}}
.footer .qr{{width:12mm;height:12mm;flex:0 0 12mm}}.footer .qr img{{width:100%;height:100%;object-fit:contain;display:block}}
.footer .info{{font-size:6.2pt;line-height:1.5;color:#415a70}}.footer .info b{{color:#0b3f7a;font-size:6.9pt}}
.footer .slogan{{margin-left:auto;text-align:right;font-size:6.1pt;color:#1565c0;letter-spacing:.5pt}}
</style></head><body><div class="page">
<div class="top"><img src="data:image/png;base64,{LOGO}"><span class="sl">守护生命健康，缔造美好生活</span></div>

<div class="hero"><div><div class="tag2">MOLECULAR DIAGNOSTICS RAW MATERIAL</div>
<h1>Luciferase <span>萤火虫荧光素酶</span></h1>
<div class="sub">基因工程改造 · 高信号 · 耐温稳 · 可冻干</div></div>
<div class="code">E800系列<br>1 mg/mL<br>甘油液体 / 冻干粉</div></div>

<div class="main">
  <div class="left">
    <div class="box"><h2>反应原理</h2><div class="reaction"><img src="data:image/jpeg;base64,{REACT}"><div class="eq">D-Luciferin + ATP + O₂ → Oxyluciferin + AMP + CO₂ + PPi + 光（Mg²⁺ 参与）</div></div></div>
    <div class="box"><h2>应用方向</h2><div class="apps">
      <div class="app"><b>ATP</b><em>检测与定量</em>细胞、微生物</div>
      <div class="app"><b>REPORT</b><em>报告基因</em>启动子活性</div>
      <div class="app"><b>CELL</b><em>活力/代谢</em>增殖与毒性</div>
      <div class="app"><b>KIT</b><em>试剂盒开发</em>核心酶原料</div>
      <div class="app"><b>IVD</b><em>体外诊断原料</em>发光体系</div>
      <div class="app"><b>RESEARCH</b><em>分子生物学</em>基因表达</div>
    </div></div>
    <div class="box"><h2>产品形式</h2><div class="forms2"><div class="f"><b>甘油液体</b>1 mg/mL</div><div class="f"><b>冻干粉</b>稳定 / 定制</div><div class="f"><b>定制</b>浓度/缓冲/规格</div></div></div>
    <div class="box"><h2>货号与规格</h2><table>
      <tr><th>产品</th><th>货号</th><th>规格</th><th>形式</th></tr>
      <tr><td>Luciferase</td><td><b>E800系列</b></td><td>1 mg/mL</td><td>液体/冻干粉</td></tr>
    </table><p class="small" style="margin-top:.8mm">保存：−20℃ 长期保存，避免反复冻融；冻干粉按说明书复溶。</p></div>
  </div>

  <div class="dash">
    <div class="ttl">核心性能 · 同酶量对比</div>
    <div class="row">
      <div class="metric"><b>3×</b><span>荧光信号</span><div class="cmp">Luciferase vs Supplier N</div></div>
      <div class="metric"><b>74%</b><span>37℃ 7 天活力</span><div class="cmp">竞品 40%</div></div>
      <div class="metric"><b>77%</b><span>25℃ 7 天活力</span><div class="cmp">竞品 55%</div></div>
    </div>
    <div class="chartbox sig"><div class="ct">相对信号（同酶量）</div>
      <svg viewBox="0 0 300 90">
        <rect x="0" y="10" width="230" height="24" rx="4" fill="#1a73e8"/><text x="240" y="28" font-size="14" fill="#0b3f7a" font-weight="700">100</text>
        <rect x="0" y="50" width="76" height="24" rx="4" fill="#c7d3df"/><text x="86" y="68" font-size="14" fill="#7b8ea2">33</text>
        <text x="0" y="88" font-size="8" fill="#415a70">Luciferase</text><text x="160" y="88" font-size="8" fill="#7b8ea2">Supplier N</text>
      </svg></div>
    <div class="chartbox ret"><div class="ct">7 天活力保留（%）</div>
      <svg viewBox="0 0 300 210">
        <line x1="22" y1="175" x2="292" y2="175" stroke="#dbe6f0"/>
        <line x1="22" y1="60" x2="292" y2="60" stroke="#eef3f8"/>
        <rect x="42" y="66" width="30" height="109" rx="3" fill="#1a73e8"/><text x="45" y="59" font-size="11" fill="#0b3f7a" font-weight="700">74</text>
        <rect x="76" y="116" width="30" height="59" rx="3" fill="#c7d3df"/><text x="79" y="109" font-size="11" fill="#7b8ea2">40</text>
        <rect x="138" y="60" width="30" height="115" rx="3" fill="#1a73e8"/><text x="141" y="53" font-size="11" fill="#0b3f7a" font-weight="700">77</text>
        <rect x="172" y="93" width="30" height="82" rx="3" fill="#c7d3df"/><text x="175" y="86" font-size="11" fill="#7b8ea2">55</text>
        <rect x="234" y="43" width="30" height="132" rx="3" fill="#1a73e8"/><text x="237" y="36" font-size="11" fill="#0b3f7a" font-weight="700">90</text>
        <rect x="268" y="48" width="24" height="127" rx="3" fill="#c7d3df"/><text x="268" y="41" font-size="11" fill="#7b8ea2">88</text>
        <text x="45" y="195" font-size="8" fill="#415a70">37℃</text><text x="141" y="195" font-size="8" fill="#415a70">25℃</text><text x="237" y="195" font-size="8" fill="#415a70">4℃</text>
        <text x="104" y="208" font-size="7" fill="#7b8ea2">本品</text><text x="184" y="208" font-size="7" fill="#7b8ea2">竞品</text>
      </svg></div>
    <div class="twoforms"><div class="f">甘油液体<b>1 mg/mL</b></div><div class="f">冻干粉<b>定制</b></div></div>
    <div class="note">加速稳定性：4℃/25℃/37℃、0/2/4/7 天；信号为化学发光 RLU，活力以 0 天为 100%。竞品为 Supplier N。</div>
  </div>
</div>

<div class="compare"><h2>完整对比数据</h2>
<table>
<tr><th style="width:26%">指标</th><th style="width:27%">Luciferase</th><th style="width:22%">Supplier N</th><th>说明</th></tr>
<tr><td>相对信号（同酶量）</td><td><b>100（≈3×）</b></td><td>33</td><td>同酶量、同检测体系，化学发光 RLU</td></tr>
<tr><td>37℃ 7 天活力</td><td><b>74%</b></td><td>40%</td><td>加速稳定性</td></tr>
<tr><td>25℃ 7 天活力</td><td><b>77%</b></td><td>55%</td><td>加速稳定性</td></tr>
<tr><td>4℃ 7 天活力</td><td><b>90%</b></td><td>88%</td><td>加速稳定性</td></tr>
<tr><td>产品形式</td><td>甘油液体 / 冻干粉</td><td>—</td><td>浓度、缓冲体系、规格可定制</td></tr>
</table>
<div class="note">数据来源：Luciferase 与 Supplier N 加速稳定性对比；0 天活力记为 100%。</div></div>

<div class="footer"><div class="qr"><img src="data:image/png;base64,{QR}"></div>
<div class="info"><b>珠海宝锐生物科技有限公司</b><br>0756-8699969 ｜ marketing@biori.com ｜ www.biori.com<br>广东省珠海市香洲区水岸一路 88 号</div>
<div class="slogan">BIORI BIOTECH<br>守护生命健康，缔造美好生活</div></div>
</div></body></html>'''
open(OUT,'w',encoding='utf-8').write(html); print('saved',OUT,len(html))
