:root{--ink:#222;--muted:#666;--line:#ccc;--bg:#f7f9fb;--card:#fff;--accent:#2a6fb0;--sun:#d03a2f;--sat:#2f63c0}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--ink);font-family:system-ui,-apple-system,"Hiragino Sans","Yu Gothic UI",Meiryo,sans-serif;line-height:1.7}
main{max-width:1080px;margin:0 auto;padding:16px}
main.doc{max-width:760px}
h1{font-size:1.6rem;line-height:1.35;margin:.4em 0}
h2{font-size:1.2rem;margin-top:1.8em}
a{color:#1d5fa8}
.small{font-size:.85rem;color:var(--muted)}
.pr-notice{font-size:.8rem;color:var(--muted);margin:0}
.tool{display:grid;grid-template-columns:300px 1fr;gap:20px;align-items:start}
form{background:var(--card);border:1px solid var(--line);border-radius:10px;padding:14px}
fieldset{border:0;margin:0 0 12px;padding:0}
.t,legend{display:block;font-weight:700;font-size:.92rem;margin-bottom:4px}
select,input[type=text],input[type=date],textarea{width:100%;font:inherit;font-size:1rem;padding:8px;border:1px solid #bbb;border-radius:6px;background:#fff;color:var(--ink)}
textarea{min-height:7.5em}
.dates{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.checks label{display:block;font-size:.95rem}
#print{width:100%;font-size:1.05rem;font-weight:700;padding:12px;border:0;border-radius:8px;background:var(--accent);color:#fff;cursor:pointer}
.preview{min-width:0}
.pv{width:100%;overflow:hidden;margin-bottom:14px;box-shadow:0 1px 4px rgba(0,0,0,.15);background:#fff}
.sheet{transform-origin:top left;background:#fff;width:210mm;height:297mm;padding:10mm;display:flex;flex-direction:column;overflow:hidden;color:#222;font-family:"Hiragino Sans","Yu Gothic",Meiryo,sans-serif}
.hd{display:flex;align-items:flex-end;gap:4mm;height:16mm;padding-bottom:2mm}
.tt{margin:0;font-size:8mm;font-weight:700;line-height:1.1;flex:1;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.nm{margin:0;font-size:4mm;display:flex;align-items:flex-end;gap:2mm}
.nm span{display:inline-block;width:45mm;border-bottom:.3mm solid #555;height:6mm}
.pg{margin:0;font-size:3.5mm;color:#666}
.pr{background:var(--card);border:1px solid var(--line);border-radius:10px;padding:10px 14px;margin:20px 0}
.pr-label{margin:0;font-size:.85rem;color:var(--muted)}
.pr ul{margin:.3em 0;padding-left:1.2em}
footer{max-width:1080px;margin:30px auto 0;padding:16px;border-top:1px solid var(--line);font-size:.85rem;display:flex;flex-wrap:wrap;gap:12px}
footer p{width:100%;margin:0;color:var(--muted)}
@media (max-width:760px){.tool{grid-template-columns:1fr}}
@media print{
  @page{size:210mm 297mm;margin:0}
  body{background:#fff}
  body>*:not(main),main>*:not(.tool),.tool>form,#info,.no-print{display:none!important}
  main,.tool,.preview{display:block;padding:0;margin:0;max-width:none}
  .pv{box-shadow:none;margin:0;height:auto!important;overflow:visible;break-after:page;page-break-after:always}
  .pv:last-child{break-after:auto;page-break-after:auto}
  .sheet{transform:none!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
}
.row2{display:flex;gap:8px}
.row2 button{flex:1;font:inherit;padding:8px;border:1px solid #bbb;border-radius:6px;background:#fff;cursor:pointer}
#seed{width:7.5em}
#dans label{display:inline-block;margin-right:.7em}
.presets{display:flex;flex-wrap:wrap;gap:6px;padding:0;list-style:none}
.presets a{display:inline-block;padding:4px 10px;border:1px solid var(--line);border-radius:999px;background:#fff;text-decoration:none;font-size:.92rem}
.sheet{gap:0}
.sheet .hd{height:auto;display:block;border-bottom:.4mm solid #888;padding-bottom:2mm;margin-bottom:3mm}
.sheet .tt{white-space:normal;font-size:6.5mm}
.ak{margin-left:4mm;font-size:4.5mm;color:#fff;background:var(--sun);border-radius:1mm;padding:0 2mm;vertical-align:middle}
.meta{display:flex;flex-wrap:wrap;gap:2mm 6mm;margin-top:2mm;font-size:4mm;align-items:flex-end}
.meta .ln{display:inline-block;width:42mm;border-bottom:.3mm solid #555;margin-left:2mm;height:5mm}
.meta .sm{display:inline-block;width:9mm;border-bottom:.3mm solid #555;height:5mm}
.meta .sc{margin-left:auto;border:.4mm solid #888;border-radius:1mm;padding:1mm 2mm;min-width:30mm;text-align:right}
.ft{margin:2mm 0 0;font-size:2.8mm;color:#999;text-align:right}
.yoko{flex:1;display:grid;grid-template-columns:1fr 1fr;gap:0 8mm;min-height:0}
.yoko .col{margin:0;padding:0 0 0 11mm;display:flex;flex-direction:column}
.yoko li{flex:1;display:flex;align-items:center;gap:2mm;border-bottom:.2mm dashed #ccc;font-variant-numeric:tabular-nums}
.yoko li::marker{color:#888}
.yoko .ex{white-space:nowrap}
.yoko .bx{display:inline-flex;align-items:center;justify-content:center;border:.35mm solid #888;border-radius:1mm;color:var(--sun);font-weight:700}
.yoko .bx.wide{justify-content:flex-end;padding-right:1mm}
.yoko .bx em{font-style:normal;color:#888;font-weight:400;font-size:.6em}
.nx{font-size:9mm}.nx .bx{width:24mm;height:13mm}.nx .bx.wide{width:42mm}
.ns{font-size:7mm}.ns .bx{width:20mm;height:10mm}.ns .bx.wide{width:38mm}
.nm{font-size:5.6mm}.nm .bx{width:17mm;height:8mm}.nm .bx.wide{width:32mm}
.nl{font-size:4.8mm}.nl .bx{width:15mm;height:6.5mm}.nl .bx.wide{width:28mm}
.hs{flex:1;display:grid;min-height:0}
.hs.h12{grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(4,1fr);--c:10mm}
.hs.h20{grid-template-columns:repeat(4,1fr);grid-template-rows:repeat(5,1fr);--c:8mm}
.hp{position:relative;display:flex;justify-content:center;align-items:flex-start;padding-top:5mm;border-right:.2mm dashed #ccc;border-bottom:.2mm dashed #ccc}
.hp .no{position:absolute;left:1mm;top:.5mm;font-size:3.6mm;color:#888}
.g{display:flex;flex-direction:column}
.g .r{display:grid;grid-template-columns:repeat(var(--w),var(--c));height:var(--c)}
.g .r.t{border-top:.5mm solid #333}
.g b{display:flex;align-items:center;justify-content:center;font-size:calc(var(--c)*.72);font-weight:400;border-right:.2mm dotted #ccc}
.g b:first-child{border-left:.2mm dotted #ccc}
.ans .g .a b{color:var(--sun);font-weight:700}
