/* 纸面样式（规格 §7）。移植自 v0.1 原型并扩展；全部用 CSS Grid，不用 <table>。 */
.page{
  --ink:#000; --hair:#8C8C8C; --hair-2:#D6D6D6; --fill:#F1EFE9; --accent:#000;
  position:relative; box-sizing:border-box;
  width:210mm; height:297mm; padding:12mm;
  background:#fff; color:var(--ink);
  display:flex; flex-direction:column; overflow:hidden;
  font-size:9pt; line-height:1.35;
  -webkit-print-color-adjust:exact; print-color-adjust:exact;
}
.page *,.page *::before,.page *::after{box-sizing:border-box}
.page.letter{width:215.9mm;height:279.4mm}
.page.colored{--hair:#B9A88F;--hair-2:#E4DBCB;--fill:#F7F1E3;--accent:#7C5614}

/* 字体按语言（规格 §8.4） */
.page,.page :lang(en),.page :lang(es),.page :lang(pt-BR),.page :lang(pt){font-family:"Helvetica Neue",Helvetica,Arial,sans-serif}
.page :lang(ja),.page:lang(ja){font-family:"Hiragino Sans","Hiragino Kaku Gothic ProN","Yu Gothic","Meiryo","Noto Sans JP",sans-serif}
.page :lang(zh-CN),.page:lang(zh-CN){font-family:"PingFang SC","Hiragino Sans GB","Microsoft YaHei","Noto Sans SC",sans-serif}
.page .mono,.page .tm,.page .url,.page .pg,.page .rg{font-family:"SFMono-Regular",Menlo,Consolas,monospace}

/* 双语 */
.lbl-both{display:inline-flex;flex-direction:column;line-height:1.12;vertical-align:middle}
.lbl-2{font-size:.72em;color:#5A5A5A;margin-top:.3mm}
.lbl-2i{color:#4A4A4A;font-size:.92em}
.sep{color:#888}

/* 页头 */
.sheet-head{display:flex;align-items:flex-end;justify-content:space-between;gap:6mm;border-bottom:1.1pt solid var(--ink);padding-bottom:2.2mm}
.sh-title{font-size:19pt;font-weight:700;letter-spacing:.02em;line-height:1.05}
.sh-title .lbl-2{font-size:8pt;font-weight:500;letter-spacing:.08em}
.sh-right{text-align:right;font-size:7.5pt;color:#333;line-height:1.55}
.sh-right .wk{font-weight:700;font-size:9pt;color:#000}
.brandline{display:inline-flex;align-items:center;gap:1.4mm;font-size:7pt;letter-spacing:.16em;text-transform:uppercase;color:#666;margin-bottom:2mm}
.brandline svg{width:3.4mm;height:3.4mm;color:var(--accent)}

.sheet-meta{display:flex;gap:7mm;flex-wrap:wrap;align-items:flex-end;padding:2.4mm 0;border-bottom:.6pt solid var(--hair-2)}
.meta-item{display:flex;align-items:baseline;gap:1.6mm;font-size:8.5pt}
.meta-item.wide{flex:1;min-width:56mm}
.meta-item .k{font-size:7.2pt;color:#555;white-space:nowrap}
.meta-item .v{font-weight:700;font-size:9pt;min-width:14mm;border-bottom:.4pt dotted var(--hair);padding-bottom:.3mm}
.meta-item .v.plain{border-bottom:0;font-weight:500;font-size:8pt}
.meta-item .v.mono{font-size:8.4pt}
.blankline{display:inline-block;height:4.5mm;border-bottom:.4pt dotted var(--hair);vertical-align:bottom}
.hintline{font-size:7.4pt;color:#3A3A3A;padding:1.8mm 0 0;display:flex;gap:5mm;flex-wrap:wrap}

/* 主体 */
.sheet-body{flex:1;min-height:0;overflow:hidden;display:flex;flex-direction:column}
.sheet-body.overflowing{outline:1.5pt dashed #C9761A}
.blk{display:contents}

/* 周表 */
.wgrid{display:grid;grid-template-columns:47mm repeat(7,minmax(0,1fr));margin-top:2.4mm}
.wgrid>.blk>div{background:#fff;min-width:0}
.hcell{font-size:7.6pt;font-weight:700;line-height:1.25;padding:1.6mm .6mm;text-align:center;border-bottom:.9pt solid var(--ink)}
.hcell .sub{display:block;font-weight:500;font-size:6.8pt;color:#4A4A4A}
.hcell.first{text-align:left;padding-left:1.6mm;font-size:7.2pt;color:#4A4A4A}
.hcell.we{background:var(--fill)}
.wgrid .slotrow{grid-column:1/-1;background:var(--fill);padding:1.5mm 1.6mm;font-size:8pt;font-weight:700;border-top:.5pt solid var(--hair-2);border-bottom:.5pt solid var(--hair-2)}
.slotrow .tm{font-size:8.2pt;margin-left:1.4mm}
.mcell{padding:1.4mm 1.6mm;font-size:8.6pt;line-height:1.3;border-bottom:.4pt solid var(--hair-2);border-left:1.1pt solid var(--accent);overflow-wrap:anywhere}
.mcell .nm{font-weight:700}
.mcell .ds{font-size:7.6pt;color:#333;margin-left:1.4mm}
.mcell .tag{display:inline-block;font-size:6.6pt;padding:.15mm 1.2mm;margin-left:1.2mm;border:.4pt solid var(--hair);border-radius:1mm;color:#3A3A3A}
.mcell .pur{display:block;font-size:6.8pt;color:#5A5A5A;margin-top:.3mm}
.mcell.blank{min-height:7.6mm}
.gcell .gm{line-height:1.3}
.gcell .gm+.gm{margin-top:.4mm}
.gcell .gm .nm{font-size:8pt}
.bcell{min-height:7.6mm;border-bottom:.4pt solid var(--hair-2);border-left:.4pt solid var(--hair-2);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.4mm;padding:.6mm 0}
.bcell.we{background:#FCFCFA}
.bcell.has-dose{min-height:10.6mm}
.cb{display:block;width:4.4mm;height:4.4mm;border:.6pt solid var(--ink);border-radius:.6mm;flex:none}
.cd{font-size:6.6pt;font-weight:700;line-height:1;white-space:nowrap;max-width:100%;overflow:hidden;text-overflow:ellipsis;padding:0 .3mm;box-sizing:border-box}
.cd.sm{font-size:5.8pt}
.cd.chg{text-decoration:underline;text-decoration-thickness:.6pt;text-underline-offset:.5mm}
.mk{font-size:5.8pt;line-height:1;color:#333;white-space:nowrap}
.na{display:block;width:100%;height:100%;min-height:6.4mm;
  background-image:linear-gradient(to top right,transparent calc(50% - .18mm),var(--hair-2) calc(50% - .18mm),var(--hair-2) calc(50% + .18mm),transparent calc(50% + .18mm))}
.emptyrow{grid-column:1/-1;padding:14mm 4mm;text-align:center;font-size:9pt;color:#777;border-bottom:.4pt solid var(--hair-2)}

/* 页尾汇总、按需、备注 */
.tail{flex:1;min-height:0;display:flex;flex-direction:column;margin-top:4mm}
.wrapup{display:flex;gap:6mm;align-items:baseline;flex-wrap:wrap;font-size:8pt;padding:2mm 0;border-top:.9pt solid var(--ink);border-bottom:.5pt solid var(--hair-2)}
.wrapup .cap2{font-size:7.2pt;color:#555}
.notes{flex:1;min-height:0;display:flex;flex-direction:column}
.cap{font-size:7.2pt;color:#555;margin:2.4mm 0 1.2mm}
.ruled{flex:1;min-height:24mm;border-top:.4pt solid var(--hair-2);
  background-image:linear-gradient(to bottom,transparent calc(100% - .5pt),var(--hair-2) calc(100% - .5pt));background-size:100% 7.9mm;background-repeat:repeat-y}  /* 单瓦片平铺：repeating-linear-gradient 在打印光栅化时会丢线 */
.prnlog{margin-top:1mm}
.prnlist{display:flex;flex-wrap:wrap;gap:1mm 5mm;font-size:7.8pt;margin-bottom:1.4mm}
.prnitem .pno{font-weight:700;margin-right:1.2mm}
.prnitem .nm{font-weight:700}
.prnitem .ds,.prnitem .pur,.prnitem .pnote{margin-left:1.4mm;color:#333}
.prngrid{display:grid;grid-template-columns:18mm 16mm 1.4fr 18mm 1.4fr 1fr}
.prngrid .ph{font-size:7pt;font-weight:700;padding:1.2mm;border-bottom:.9pt solid var(--ink);background:var(--fill)}
.prngrid .pc{height:7.6mm;border-bottom:.4pt solid var(--hair-2);border-left:.4pt solid var(--hair-2)}
.prngrid .pc:nth-child(6n+1){border-left:0}

/* 月表 */
.mgrid{flex:1;min-height:0;display:grid;margin-top:2.4mm}
.mgrid>div{min-width:0;background:#fff}
.hcell.mh{display:flex;flex-direction:column;align-items:center;gap:.2mm;padding:1.2mm .6mm;line-height:1.15}
.hcell.mh.blankhead{min-height:13mm;border-left:.4pt solid var(--hair-2)}
.hcell.mh .cno{font-size:6.4pt;color:#555}
.hcell.mh .cnm{font-size:7.4pt;overflow-wrap:anywhere}
.mday{display:flex;align-items:center;gap:1.2mm;padding:0 1.4mm;font-size:7.4pt;border-bottom:.4pt solid var(--hair-2);min-height:0}
.mday .dn{font-weight:700;min-width:4.6mm;text-align:right}
.mday .dw{font-size:6.6pt;color:#555}
.mgrid .mday.we,.mgrid .bcell.we{background:var(--fill)}
.month .bcell,.month .bcell.has-dose{min-height:0;padding:0;gap:.2mm;overflow:hidden}
.month .cb{width:3.4mm;height:3.4mm}
.month .cd{font-size:6.4pt}
.month .cd.sm{font-size:5.6pt}
.month .mk{display:none}
.month .na{min-height:0}
.legend{margin-top:2mm;font-size:7pt;line-height:1.35;columns:2;column-gap:6mm}
.legend .cap{column-span:all;margin-top:0}
.lg{break-inside:avoid;margin-bottom:.6mm}
.lg .cno{font-weight:700;margin-right:.6mm}
.lg .ls{color:#444}
.lg .nm{font-weight:700}
.lg .rl{color:#444}

/* 交接卡 */
.sh-sub{font-size:8pt;color:#444;margin-top:1mm}
.flags{display:grid;grid-template-columns:1fr 1fr;gap:3mm;margin-top:2.4mm}
.flagbox{border:.9pt solid var(--ink);padding:1.6mm 2mm;min-height:13mm}
.flagbox.allergy{border-width:1.6pt;background:var(--fill)}
.flagbox .fk{font-size:7.4pt;font-weight:700}
.flagbox .fv{font-size:9.6pt;font-weight:700;margin-top:.6mm;overflow-wrap:anywhere}
.flagbox .fv .none{font-weight:500;color:#444}
.cgrid{display:grid;grid-template-columns:10mm 60mm 30mm 22mm 36mm minmax(0,1fr);margin-top:2.4mm}
.cgrid>.blk>div{min-width:0}
.ch{font-size:7.2pt;font-weight:700;padding:1.4mm 1.2mm;border-bottom:.9pt solid var(--ink);background:var(--fill)}
.cc{padding:1.4mm 1.2mm;font-size:8.4pt;line-height:1.3;border-bottom:.4pt solid var(--hair-2);overflow-wrap:anywhere;min-height:9mm}
.cc.no{text-align:center;font-weight:700}
.cc .nm{font-weight:700}
.cc .pur{display:block;font-size:7pt;color:#555;margin-top:.3mm}
.cc .tag{display:inline-block;font-size:6.6pt;padding:.15mm 1.2mm;margin-left:1.2mm;border:.4pt solid var(--hair);border-radius:1mm;color:#3A3A3A}
.ctail{flex:none}
.cprn{margin-top:1mm}
.ruled.short{flex:none;min-height:0;height:24mm}
.sign{display:grid;grid-template-columns:1fr 1fr;gap:2.6mm 6mm;margin-top:3mm}
.sign .meta-item .k+.v,.sign .meta-item .v+.k{margin-left:0}
.prnpage .prnlog{margin-top:3mm}
.sheet-foot .fname{font-weight:700;color:#000;white-space:nowrap}

/* 页脚 */
.sheet-foot{display:flex;align-items:flex-end;justify-content:space-between;gap:4mm;border-top:.6pt solid var(--hair);margin-top:2.6mm;padding:1.8mm 0 0;font-size:6.6pt;color:#555;line-height:1.4}
.sheet-foot .url{font-size:6.8pt;color:#222;white-space:nowrap}
.sheet-foot .mid{flex:1;text-align:center}
.sheet-foot .pg{font-size:7pt;color:#000;white-space:nowrap}

/* 大字模式（+18%） */
.page.large{font-size:10.6pt}
.page.large .hcell{font-size:8.8pt;padding:2mm .6mm}
.page.large .slotrow{font-size:9.2pt;padding:1.8mm 1.6mm}
.page.large .mcell{font-size:10pt;padding:1.8mm 1.6mm}
.page.large .bcell{min-height:9.6mm}
.page.large .bcell.has-dose{min-height:13.4mm}
.page.large .cb{width:5.6mm;height:5.6mm}
.page.large .cd{font-size:7.6pt}
.page.large .cd.sm{font-size:6.6pt}
.page.large .hintline{font-size:8.4pt}
.page.large .prngrid .pc{height:9.6mm}
.page.large .mday{font-size:8.6pt}
.page.large .hcell.mh .cnm{font-size:8.6pt}
.page.large.month .cb{width:4mm;height:4mm}
.page.large .legend{font-size:8.2pt}
.page.large .cc{font-size:10pt;min-height:11mm}
.page.large .ch{font-size:8.4pt}
.page.large .flagbox .fv{font-size:11pt}

/* 量高用：离屏、尾部取最小高度 */
.page.measure{position:absolute;left:-10000px;top:0;visibility:hidden}
.page.measure .tail,.page.measure .notes{flex:none}
.page.measure .ruled{flex:none;height:24mm}

@media print{
  .page{box-shadow:none!important;margin:0!important;break-after:page;page-break-after:always}
  .page:last-child{break-after:auto;page-break-after:auto}
  .page .sheet-body.overflowing{outline:none!important}
}
