/* 書類（請求書・領収書・見積書）の用紙レイアウト
 * マネーフォワード クラウド請求書「山形まちづくり大学」アカウントの実物に合わせた A4 縦。
 * 画面プレビューと印刷／PDF保存で同じ見た目になるよう、寸法は mm、文字は pt で固定し、
 * CSS変数には依存しない（PDF出力時の安定のため。members.html の名札シートと同じ方針）。 */
.docsheet{
  width:186mm; min-height:250mm; background:#fff; color:#000; box-sizing:border-box;
  font-family:'Noto Sans JP','Hiragino Sans',sans-serif; font-size:9pt; line-height:1.65;
  margin:0 auto; position:relative;
}
.docsheet *{box-sizing:border-box}

.ds-title{text-align:center;font-family:'Zen Kaku Gothic New','Hiragino Sans',sans-serif;
  font-weight:700;font-size:16pt;margin:0 0 8mm;letter-spacing:.08em}

/* ---- 宛名／発行元 ---- */
.ds-head{display:flex;gap:8mm;align-items:flex-start;margin-bottom:4mm}
.ds-to{flex:1;min-width:0}
.ds-tonm{font-size:11pt;font-weight:500;word-break:break-all}
.ds-tonm.plain{font-size:10pt}
.ds-tosub{font-size:8.5pt;color:#333;margin-top:1.6mm;line-height:1.5}
.ds-from{width:66mm;flex:none;position:relative;text-align:left}
.ds-fromnm{font-size:10pt;font-weight:500}
.ds-reg{font-size:8.5pt;margin-top:.6mm}
.ds-addr{font-size:8.5pt;margin-top:1.8mm;line-height:1.55}
.ds-seal{position:absolute;right:2mm;top:-2mm;width:18mm;height:18mm;object-fit:contain;opacity:.92}

/* ---- 番号・日付 ---- */
.ds-meta{width:66mm;margin-left:auto;font-size:9pt;margin-bottom:6mm}
.ds-meta .r{display:flex}
.ds-meta .r span:first-child{width:24mm;flex:none}
.ds-meta.rcpt{margin-bottom:0}

.ds-subject{font-size:9.5pt;margin-bottom:5mm}

/* ---- 金額ボックス ---- */
.ds-amtbox{border:.3mm solid #333;display:flex;align-items:center;gap:6mm;
  padding:2.6mm 5mm;margin-bottom:5mm}
.ds-amtbox .lb{font-weight:700;font-size:10.5pt;white-space:nowrap}
.ds-amtbox .vl{font-size:12pt;margin-left:auto}
.ds-amtbox.center{width:96mm;margin:7mm auto 5mm}
.ds-amtbox.center .vl{margin-left:auto}

/* ---- 明細表（横罫のみ・セル縦罫なし＝MFの実物に合わせる） ---- */
table.ds-items{width:100%;border-collapse:collapse;font-size:8.5pt;margin-bottom:4mm}
.ds-items th{border-bottom:.25mm solid #333;padding:1.4mm 2mm;font-weight:400;color:#333;text-align:left;white-space:nowrap}
.ds-items td{padding:2mm;vertical-align:top;border-bottom:.2mm solid #CFCFCF}
.ds-items tbody tr:last-child td{border-bottom:.25mm solid #333}
.ds-items th.r,.ds-items td.r{text-align:right}
.ds-items th.c,.ds-items td.c{text-align:center}
.ds-items td.nm{line-height:1.55}
.ds-items td.dlv{white-space:nowrap;font-size:8pt}
.ds-items .dt{font-size:7.5pt;color:#333;margin-top:.8mm;line-height:1.55}

/* ---- 税率別内訳（左）＋ 合計（右） ---- */
.ds-lower{display:flex;gap:8mm;align-items:flex-start;margin-bottom:6mm}
.ds-brk{flex:1;min-width:0}
.ds-brk .h{font-size:8pt;margin-bottom:1mm}
table.ds-brk-t{border-collapse:collapse;font-size:7.5pt}
.ds-brk-t th,.ds-brk-t td{border:.2mm solid #9A9A9A;padding:1mm 2.4mm;font-weight:400;text-align:center;white-space:nowrap}
.ds-brk-t td.r{text-align:right}
.ds-sums{width:70mm;flex:none;font-size:9.5pt}
.ds-sums .r{display:flex;justify-content:space-between;padding:1.4mm 2mm}
.ds-sums .r.grand{border-top:.25mm solid #333;font-size:11pt;padding-top:2mm}

/* ---- 振込先・備考 ---- */
.ds-blk{margin-bottom:4mm}
.ds-blk .h{font-size:8.5pt;margin-bottom:1mm}
.ds-blk .bx{border:.25mm solid #9A9A9A;padding:2.4mm 3mm;font-size:8.5pt;line-height:1.7;
  min-height:8mm;white-space:normal;word-break:break-word}

/* ---- 領収書 ---- */
.ds-proviso{text-align:center;font-size:9.5pt;line-height:1.9;margin-bottom:8mm}
.ds-rlower{display:flex;gap:10mm;align-items:flex-start}
.ds-rsum{width:78mm;flex:none;border-top:.2mm solid #9A9A9A;border-bottom:.2mm solid #9A9A9A;padding:2.4mm 0;font-size:9pt}
.ds-rsum .r{display:flex;justify-content:space-between;padding:.6mm 2mm}
.ds-rsum .uchi{padding:1.6mm 2mm .4mm;font-size:8.5pt}
.ds-rsum .items{padding:.4mm 2mm 0;font-size:7pt;color:#333;line-height:1.5}
.ds-stamp{position:absolute;right:4mm;bottom:10mm;width:24mm;height:24mm;border:.25mm solid #777;
  display:flex;align-items:center;justify-content:center;font-size:7pt;color:#777}

.ds-foot{margin-top:5mm;font-size:8pt;color:#333;line-height:1.6}

/* 画面プレビュー時は用紙らしく影と余白を付ける（印刷では打ち消す） */
.ds-paper{background:#fff;box-shadow:0 2px 14px rgba(0,0,0,.12);padding:14mm 12mm;margin:0 auto;width:210mm;max-width:100%}

@media(max-width:820px){
  /* 幅の狭い画面では横スクロールで全体を保つ（レイアウトは崩さない） */
  .ds-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch}
}

/* ===== 印刷／PDF ===== */
@media print{
  @page{size:A4 portrait;margin:12mm}
  html,body{background:#fff !important;margin:0;padding:0}
  .ds-paper{box-shadow:none;padding:0;width:auto;margin:0}
  .ds-scroll{overflow:visible}
  .docsheet{width:auto;min-height:0;page-break-after:always;break-after:page}
  .docsheet:last-child{page-break-after:auto;break-after:auto}
  .ds-items tr{page-break-inside:avoid;break-inside:avoid}
  .ds-lower,.ds-blk,.ds-amtbox,.ds-rlower{page-break-inside:avoid;break-inside:avoid}
}
