#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Luciferase A4 彩页 — 两版结构优化 v3（满版）"""
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')
BASE='/Users/liuxinyuan/Desktop/Hermes输出-工作类/对外物料/'

COMMON='''
@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:24pt;line-height:1.08;letter-spacing:.2pt}
h2{font-size:10pt;color:#0b3f7a;margin:2.2mm 0 1.3mm;display:flex;align-items:center;gap:2mm}
h2:before{content:"";width:1.2mm;height:3.8mm;background:#1a73e8;border-radius:.6mm}
p{font-size:7.4pt;line-height:1.5}
.small{font-size:6.4pt;color:#5f7183;line-height:1.45}
.footer{margin-top:auto;border-top:.6pt solid #dbe6f0;padding-top:1.3mm;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.3pt;line-height:1.55;color:#415a70}.footer .info b{color:#0b3f7a;font-size:7pt}
.footer .slogan{margin-left:auto;text-align:right;font-size:6.2pt;color:#1565c0;letter-spacing:.5pt}
'''

# ================= A =================
A=f'''<!DOCTYPE html><html lang="zh-CN"><head><meta charset="utf-8"><style>{COMMON}
.hero{{margin-top:2mm;height:43mm;background:linear-gradient(120deg,#0b3f7a,#1264b8 55%,#1a73e8);border-radius:2.6mm;color:#fff;padding:5mm 6mm;display:flex;align-items:center;gap:5mm;flex:0 0 auto}}
.hero .l{{flex:1}}
.hero .tag{{display:inline-block;font-size:6.4pt;background:rgba(255,255,255,.16);border:1px solid rgba(255,255,255,.35);border-radius:1mm;padding:.5mm 1.6mm;margin-bottom:1.8mm}}
.hero h1 span{{font-size:12pt;font-weight:400;opacity:.95}}
.hero .sub{{font-size:8.4pt;opacity:.95;margin-top:1.4mm}}
.hero .code{{font-size:7pt;opacity:.85;margin-top:1.2mm}}
.hero .kpis{{display:flex;gap:2.2mm}}
.hero .kpi{{background:rgba(255,255,255,.13);border:1px solid rgba(255,255,255,.26);border-radius:1.6mm;padding:2.2mm 2.4mm;min-width:21mm;text-align:center}}
.hero .kpi b{{display:block;font-size:17pt;line-height:1.05}}
.hero .kpi span{{font-size:6.2pt;opacity:.9;line-height:1.3;display:block;margin-top:.5mm}}
.adv{{display:grid;grid-template-columns:repeat(3,1fr);gap:3mm;height:96mm;flex:0 0 auto}}
.card{{border:.7pt solid #dbe6f0;border-radius:2.2mm;padding:3mm 3.2mm;background:#fff;position:relative;overflow:hidden;display:flex;flex-direction:column}}
.card:before{{content:"";position:absolute;left:0;top:0;width:100%;height:1.2mm;background:linear-gradient(90deg,#1a73e8,#7fb3f5)}}
.card h3{{font-size:8.8pt;color:#0b3f7a;margin:1mm 0 1mm}}
.card .big{{font-size:26pt;color:#1a73e8;font-weight:700;line-height:1.02}}
.card .big small{{font-size:8pt;color:#5f7183;font-weight:400}}
.card .cap{{font-size:6.6pt;color:#5f7183;line-height:1.45;margin-top:1.2mm}}
.chart{{flex:1;display:flex;align-items:center;margin-top:1mm}}
.chart svg{{width:100%;height:100%;max-height:52mm;display:block}}
.two{{display:grid;grid-template-columns:1.12fr .88fr;gap:3mm;height:64mm;flex:0 0 auto;margin-top:1mm}}
.panel{{border:.6pt solid #dbe6f0;border-radius:2mm;padding:2.6mm 3mm;background:#fbfdff}}
.panel h2{{margin-top:0}}
.reaction img{{width:100%;height:auto;display:block;margin-top:.8mm}}
.reaction .eq{{font-size:6.6pt;color:#415a70;margin-top:1mm;line-height:1.5}}
.apps{{display:grid;grid-template-columns:repeat(2,1fr);gap:1.8mm;margin-top:1mm}}
.app{{border:.5pt solid #dbe6f0;border-radius:1.4mm;padding:1.9mm 2mm;background:#fff;display:flex;gap:1.6mm;align-items:flex-start}}
.app .dot{{width:1.8mm;height:1.8mm;border-radius:50%;background:#1a73e8;flex:0 0 1.8mm;margin-top:.7mm}}
.app b{{font-size:7.2pt;color:#17456e;display:block}}
.app span{{font-size:6.2pt;color:#5f7183;line-height:1.35;display:block;margin-top:.2mm}}
.order{{display:grid;grid-template-columns:1.35fr .65fr;gap:3mm;height:30mm;flex:0 0 auto}}
table{{width:100%;border-collapse:collapse;font-size:7pt;height:100%}}
th{{background:#eaf3fd;color:#17456e;text-align:left;padding:1.4mm 2mm;border:.5pt solid #cfe0ef;font-weight:600}}
td{{padding:1.4mm 2mm;border:.5pt solid #dbe6f0;vertical-align:middle}}
.note{{border:.6pt solid #dbe6f0;border-radius:2mm;background:#fbfdff;padding:2mm 2.6mm}}
.note b{{font-size:7pt;color:#0b3f7a;display:block;margin-bottom:.6mm}}
</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 class="l"><span class="tag">分子诊断原料 · 报告基因</span>
<h1>Luciferase <span>萤火虫荧光素酶</span></h1>
<div class="sub">基因工程改造 · 高信号 · 耐温稳 · 可冻干</div>
<div class="code">E800系列 ｜ 1 mg/mL ｜ 甘油液体 / 冻干粉</div></div>
<div class="kpis">
  <div class="kpi"><b>3×</b><span>相同酶量<br>荧光信号</span></div>
  <div class="kpi"><b>74%</b><span>37℃ 7 天<br>活力保留</span></div>
  <div class="kpi"><b>77%</b><span>25℃ 7 天<br>活力保留</span></div>
</div></div>

<h2>产品优势：三个可直接比较的指标</h2>
<div class="adv">
  <div class="card"><h3>信号更强 · 用量更省</h3><div class="big">≈3× <small>信号</small></div>
    <div class="chart"><svg viewBox="0 0 260 170">
      <text x="0" y="14" font-size="9" fill="#5f7183">相对信号（同酶量）</text>
      <rect x="0" y="32" width="210" height="30" rx="4" fill="#1a73e8"/><text x="218" y="53" font-size="13" fill="#1a73e8" font-weight="700">100</text>
      <rect x="0" y="82" width="70" height="30" rx="4" fill="#c7d3df"/><text x="78" y="103" font-size="13" fill="#7b8ea2">33</text>
      <line x1="0" y1="132" x2="255" y2="132" stroke="#e3ecf4"/>
      <text x="0" y="152" font-size="9" fill="#415a70">Luciferase</text>
      <text x="150" y="152" font-size="9" fill="#7b8ea2">Supplier N</text>
      <text x="0" y="166" font-size="8" fill="#9aa9b8">同酶量、同检测体系</text>
    </svg></div>
    <div class="cap">相同酶量下信号约为竞品 3 倍；同等信号要求下可减少酶用量。</div></div>

  <div class="card"><h3>耐温更稳 · 运输更宽容</h3><div class="big">74% <small>/ 77%</small></div>
    <div class="chart"><svg viewBox="0 0 260 170">
      <text x="0" y="13" font-size="9" fill="#5f7183">7 天活力保留（%）</text>
      <line x1="26" y1="140" x2="250" y2="140" stroke="#dbe6f0"/>
      <line x1="26" y1="40" x2="250" y2="40" stroke="#eef3f8"/>
      <rect x="48" y="41" width="34" height="99" rx="3" fill="#1a73e8"/><text x="52" y="34" font-size="12" fill="#1a73e8" font-weight="700">74</text>
      <rect x="88" y="87" width="34" height="53" rx="3" fill="#c7d3df"/><text x="92" y="80" font-size="12" fill="#7b8ea2">40</text>
      <rect x="162" y="37" width="34" height="103" rx="3" fill="#1a73e8"/><text x="166" y="30" font-size="12" fill="#1a73e8" font-weight="700">77</text>
      <rect x="202" y="67" width="34" height="73" rx="3" fill="#c7d3df"/><text x="206" y="60" font-size="12" fill="#7b8ea2">55</text>
      <text x="58" y="156" font-size="9" fill="#415a70">37℃</text><text x="172" y="156" font-size="9" fill="#415a70">25℃</text>
      <text x="112" y="156" font-size="8" fill="#7b8ea2">本品</text><text x="226" y="156" font-size="8" fill="#7b8ea2">竞品</text>
    </svg></div>
    <div class="cap">37℃ 7 天保留 74%（竞品 40%）；25℃ 7 天保留 77%（竞品 55%）。</div></div>

  <div class="card"><h3>形式灵活 · 按需定制</h3><div class="big">2 <small>种形式</small></div>
    <div class="chart"><svg viewBox="0 0 260 170">
      <rect x="16" y="26" width="52" height="82" rx="10" fill="#e8f1fd" stroke="#1a73e8" stroke-width="2.5"/>
      <path d="M16 66 h52" stroke="#1a73e8" stroke-width="2.5"/>
      <rect x="16" y="26" width="52" height="20" rx="6" fill="#1a73e8" opacity=".15"/>
      <text x="12" y="128" font-size="9" fill="#415a70">甘油液体</text>
      <rect x="104" y="26" width="52" height="82" rx="6" fill="#e8f1fd" stroke="#1a73e8" stroke-width="2.5"/>
      <path d="M116 44 h28 M116 58 h28 M116 72 h28 M116 86 h28" stroke="#1a73e8" stroke-width="2.5"/>
      <text x="100" y="128" font-size="9" fill="#415a70">冻干粉</text>
      <text x="184" y="62" font-size="11" fill="#1a73e8" font-weight="700">定制</text>
      <text x="184" y="78" font-size="7.5" fill="#5f7183">浓度 / 缓冲</text>
      <text x="184" y="90" font-size="7.5" fill="#5f7183">规格</text>
    </svg></div>
    <div class="cap">冻干后性能稳定；支持浓度、缓冲体系与规格定制。</div></div>
</div>

<div class="two">
  <div class="panel"><h2>反应原理</h2><div class="reaction"><img src="data:image/jpeg;base64,{REACT}"></div>
    <div class="eq">D-Luciferin + ATP + O₂ → Oxyluciferin + AMP + CO₂ + PPi + 光（Mg²⁺ 参与）<br>检测信号：化学发光（RLU）</div></div>
  <div class="panel"><h2>应用方向</h2><div class="apps">
    <div class="app"><div class="dot"></div><div><b>ATP 检测与定量</b><span>细胞、微生物、环境样本</span></div></div>
    <div class="app"><div class="dot"></div><div><b>报告基因检测</b><span>启动子与信号通路活性</span></div></div>
    <div class="app"><div class="dot"></div><div><b>细胞活力/代谢</b><span>增殖、毒性与代谢状态</span></div></div>
    <div class="app"><div class="dot"></div><div><b>ATP 试剂盒开发</b><span>作为核心酶原料</span></div></div>
    <div class="app"><div class="dot"></div><div><b>体外诊断原料</b><span>发光体系与诊断试剂</span></div></div>
    <div class="app"><div class="dot"></div><div><b>分子生物学研究</b><span>基因表达与蛋白研究</span></div></div>
  </div></div>
</div>

<h2>货号与规格</h2>
<div class="order">
<table><tr><th style="width:34%">产品名称</th><th style="width:25%">货号</th><th style="width:18%">规格</th><th>形式</th></tr>
<tr><td>Luciferase</td><td><b>E800系列</b></td><td>1 mg/mL</td><td>甘油液体 / 冻干粉（可定制）</td></tr></table>
<div class="note"><b>保存与数据说明</b><span class="small">−20℃ 长期保存，避免反复冻融；冻干粉按说明书复溶。<br>加速稳定性：4℃/25℃/37℃、0/2/4/7 天；竞品为 Supplier N。</span></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>'''

# ================= B =================
B=f'''<!DOCTYPE html><html lang="zh-CN"><head><meta charset="utf-8"><style>{COMMON}
.hero{{margin-top:1.8mm;height:31mm;display:flex;align-items:flex-end;gap:4mm;border-bottom:2.5pt solid #1a73e8;padding-bottom:2mm;flex:0 0 auto}}
.hero .tag2{{font-size:6.4pt;color:#1a73e8;letter-spacing:.9pt;font-weight:600}}
.hero h1{{font-size:26pt;color:#0b3f7a;margin-top:.6mm}}
.hero .sub{{font-size:8.2pt;color:#5f7183;margin-top:.8mm}}
.hero .code{{margin-left:auto;text-align:right;font-size:6.9pt;color:#415a70;line-height:1.55}}
.main{{display:grid;grid-template-columns:1.02fr .98fr;gap:3.4mm;height:202mm;margin-top:2.6mm;flex:0 0 auto}}
.left{{display:flex;flex-direction:column;gap:2.6mm;height:100%}}
.box{{border:.6pt solid #dbe6f0;border-radius:2mm;padding:2.4mm 3mm;background:#fff}}
.box h2{{margin-top:0}}
.reaction{{height:46mm;display:flex;flex-direction:column;justify-content:center}}
.reaction img{{width:100%;display:block}}
.reaction .eq{{font-size:6.4pt;color:#415a70;margin-top:.8mm;line-height:1.45}}
.apps{{display:grid;grid-template-columns:repeat(3,1fr);gap:1.6mm}}
.app{{background:#f3f8fe;border-radius:1.3mm;padding:1.8mm 1.4mm;text-align:center;font-size:6.4pt;color:#17456e;line-height:1.35}}
.app b{{display:block;color:#1a73e8;font-size:7.2pt;margin-bottom:.3mm}}
table{{width:100%;border-collapse:collapse;font-size:6.8pt}}
th{{background:#eaf3fd;color:#17456e;text-align:left;padding:1.1mm 1.5mm;border:.5pt solid #cfe0ef}}
td{{padding:1.1mm 1.5mm;border:.5pt solid #dbe6f0}}
.dash{{background:linear-gradient(160deg,#0b2f57,#0e4d8a 55%,#1264b8);border-radius:2.4mm;color:#fff;padding:3.4mm 3.6mm;display:flex;flex-direction:column;gap:2.4mm;height:100%}}
.dash .ttl{{font-size:8.8pt;letter-spacing:.6pt;opacity:.96}}
.dash .row{{display:flex;gap:2.2mm}}
.metric{{flex:1;background:rgba(255,255,255,.11);border:1px solid rgba(255,255,255,.2);border-radius:1.6mm;padding:2mm 2mm}}
.metric b{{display:block;font-size:20pt;line-height:1.03}}
.metric span{{font-size:6.2pt;opacity:.9;line-height:1.3;display:block;margin-top:.3mm}}
.metric .cmp{{font-size:5.9pt;opacity:.72;margin-top:.7mm}}
.chartbox{{background:rgba(255,255,255,.97);border-radius:1.6mm;padding:2mm 2.4mm}}
.chartbox .ct{{font-size:6.8pt;color:#17456e;font-weight:600;margin-bottom:.8mm}}
.chartbox svg{{width:100%;height:auto;display:block}}
.chartbox.sig svg{{max-height:34mm}}
.chartbox.ret svg{{max-height:48mm}}
.twoforms{{display:flex;gap:2mm;align-items:center;background:rgba(255,255,255,.11);border-radius:1.6mm;padding:2mm 2.4mm}}
.twoforms .f{{flex:1;font-size:6.3pt;opacity:.9;text-align:center}}
.twoforms .f b{{display:block;font-size:8.2pt;margin-top:.3mm}}
.note{{font-size:6.1pt;opacity:.8;line-height:1.45}}
</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 style="font-size:12pt;font-weight:400;color:#415a70">萤火虫荧光素酶</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" style="flex:1"><h2>应用方向</h2><div class="apps">
      <div class="app"><b>ATP</b>检测与定量</div><div class="app"><b>REPORT</b>报告基因</div><div class="app"><b>CELL</b>活力/代谢</div>
      <div class="app"><b>KIT</b>试剂盒开发</div><div class="app"><b>IVD</b>体外诊断原料</div><div class="app"><b>RESEARCH</b>分子生物学</div>
    </div><p class="small" style="margin-top:2mm">适用于细胞、微生物、环境样本及体外诊断发光体系。</p></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:1.2mm">保存：−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 100">
        <rect x="0" y="12" width="230" height="26" rx="4" fill="#1a73e8"/><text x="240" y="31" font-size="14" fill="#0b3f7a" font-weight="700">100</text>
        <rect x="0" y="56" width="76" height="26" rx="4" fill="#c7d3df"/><text x="86" y="75" font-size="14" fill="#7b8ea2">33</text>
        <text x="0" y="96" font-size="8" fill="#415a70">Luciferase</text><text x="160" y="96" font-size="8" fill="#7b8ea2">Supplier N</text>
      </svg></div>
    <div class="chartbox ret"><div class="ct">7 天活力保留（%）</div>
      <svg viewBox="0 0 300 160">
        <line x1="24" y1="130" x2="292" y2="130" stroke="#dbe6f0"/>
        <rect x="48" y="34" width="36" height="96" rx="3" fill="#1a73e8"/><text x="52" y="27" font-size="13" fill="#0b3f7a" font-weight="700">74</text>
        <rect x="90" y="78" width="36" height="52" rx="3" fill="#c7d3df"/><text x="94" y="71" font-size="13" fill="#7b8ea2">40</text>
        <rect x="168" y="30" width="36" height="100" rx="3" fill="#1a73e8"/><text x="172" y="23" font-size="13" fill="#0b3f7a" font-weight="700">77</text>
        <rect x="210" y="57" width="36" height="73" rx="3" fill="#c7d3df"/><text x="214" y="50" font-size="13" fill="#7b8ea2">55</text>
        <text x="55" y="150" font-size="8" fill="#415a70">37℃</text><text x="175" y="150" font-size="8" fill="#415a70">25℃</text>
        <text x="128" y="150" font-size="7" fill="#7b8ea2">本品</text><text x="248" y="150" 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="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>'''

for name,html in [('Luciferase_A4_优化版A_优势卡片_20261027.html',A),('Luciferase_A4_优化版B_数据看板_20261027.html',B)]:
    p=BASE+name; open(p,'w',encoding='utf-8').write(html); print('saved',p,len(html))
