/*
 * 帳票（A4ページ）のスタイル。プレビューとPDFの見た目を決める。
 * UI改善などの都合で変更しないこと。画面（操作領域）のスタイルは app.css に書く。
 *
 * 構成：
 *   1. 基本レイアウト（表紙・目次・表）
 *   2. 署名欄
 *   3. 以降は「PDF様式に合わせた微調整」の積み重ね。後ろの規則が前の規則を上書きするため、
 *      見た目を直すときは、該当する最後の規則（!important 付き）を編集する。
 */

/* ---- 1. 基本レイアウト ---- */
.a4{width:210mm;min-height:297mm;margin:0 auto 20px;background:#fff;padding:15mm 17mm 16mm;color:#111;font-family:"Yu Gothic",Meiryo,sans-serif;font-size:10.5pt;line-height:1.72;position:relative}
.a4.landscape{width:297mm;min-height:210mm;padding:13mm 15mm}
.title{font-size:15pt;margin:0 0 12mm}
.cover{padding:14mm 18mm}
.coverProject{position:absolute;top:101mm;left:20mm;right:20mm;text-align:center;font-size:12pt}
.coverDoc{position:absolute;top:135mm;left:15mm;right:15mm;text-align:center;font-size:22pt;font-weight:bold}
.coverDate{position:absolute;top:184mm;left:20mm;right:20mm;text-align:center}
.coverCompany{position:absolute;top:219mm;left:20mm;right:20mm;text-align:center}
.toc h1{text-align:center;font-size:16pt;letter-spacing:.35em;margin:5mm 0 15mm}
.a4 h2{font-size:11pt;margin:7mm 0 2mm}
.kv{width:100%;border-collapse:collapse}
.kv th,.kv td{border:0;padding:1.5mm 2mm}
.kv th{width:38mm;text-align:justify;text-align-last:justify;font-weight:normal}
.table{width:100%;border-collapse:collapse;font-size:var(--cp-table-font,8.5pt)}
.table th,.table td{border:1px solid #333;padding:1.5mm}
.toc-chapter{padding:0}

/* ---- 2. 署名欄 ---- */
.sign-area{position:absolute;left:18mm;right:18mm;bottom:13mm;font-size:8pt;line-height:1.25}.sign-table{border-collapse:collapse;width:100%;table-layout:fixed}.sign-table th,.sign-table td{border:.25mm solid #222;text-align:center;vertical-align:middle;padding:1mm}.sign-table th{height:7mm;font-weight:400}.sign-table td{height:20mm}.sign-cell{position:relative;min-height:17mm;display:flex;align-items:center;justify-content:center;gap:2mm}.sign-cell .stamp-img{max-width:17mm;max-height:17mm;object-fit:contain}.sign-cell .sign-text{font-size:7.5pt;line-height:1.35;white-space:pre-line}.sign-company{font-size:8pt;font-weight:400}.sign-stack{display:grid;grid-template-columns:1fr 1fr;gap:8mm}.sign-block-label{margin-bottom:2mm}.sign-block{border-collapse:collapse;width:100%;table-layout:fixed}.sign-block th,.sign-block td{border:.25mm solid #222;text-align:center;padding:1mm}.sign-block th{height:6mm;font-weight:400}.sign-block td{height:18mm}.sign-design{display:grid;grid-template-columns:1fr;gap:7mm}.sign-design .sign-block-label{font-weight:600}

/* ---- 3. PDF様式に合わせた微調整 ---- */
/* 表紙全体を上方向へ調整 */
.coverProject{top:82mm!important}.coverDoc{top:116mm!important}.coverDate{top:163mm!important}.coverCompany{top:196mm!important}.sign-area{bottom:24mm!important}
/* 2段署名欄は少し上へ詰め、表紙内に収める */
.sign-area.sign-design{bottom:18mm!important;gap:5mm!important}.sign-design .sign-block-label{margin-bottom:1.5mm!important}.sign-design .sign-block th{height:5.5mm!important}.sign-design .sign-block td{height:16mm!important}

/* 表紙位置の追加調整: v5.1 cover-up-more */
.coverProject{top:calc(70mm + var(--cp-cover-project,0mm))!important}
.coverDate{top:calc(151mm + var(--cp-cover-date,0mm))!important}
.coverCompany{top:calc(184mm + var(--cp-cover-company,0mm))!important}
.sign-area{bottom:calc(39mm - var(--cp-cover-sign,0mm))!important}
.sign-area.sign-design{bottom:calc(33mm - var(--cp-cover-sign,0mm))!important}

/* PDF様式に合わせた階層型目次 */
.toc-pdf-style{padding:var(--cp-toc-mt,16mm) var(--cp-toc-mr,24mm) var(--cp-toc-mb,18mm) var(--cp-toc-ml,24mm)!important;font-family:"Yu Gothic","YuGothic",Meiryo,sans-serif!important}.toc-pdf-style h1{text-align:center!important;font-size:16pt!important;letter-spacing:.65em!important;margin:0 0 13mm!important;font-weight:700!important}.toc-body{line-height:1.3}.toc-items{line-height:var(--cp-toc-lh,1.3)}.toc-chapter{margin:0 0 6mm;break-inside:avoid}.toc-chapter-title{display:flex;align-items:center;margin-bottom:var(--cp-toc-chapter-after,2.3mm);font-weight:var(--cp-toc-chapter-weight,400);font-size:var(--cp-toc-chapter-font,10pt)}.toc-chapter-no{flex:0 0 9mm;margin-right:2mm;text-align:left}.toc-chapter-name{white-space:nowrap}.toc-item{display:flex;align-items:center;margin:1.5mm 0;padding-left:var(--cp-toc-indent,0mm);min-height:4.4mm;font-size:var(--cp-toc-item-font,10pt)}.toc-item-no{flex:0 0 9mm;margin-right:2mm;text-align:left}.toc-item-title{white-space:nowrap}.toc-leader{flex:1;align-self:center;border-bottom:.28mm dotted #222;margin:0 3mm;min-width:12mm}.toc-page-number{width:var(--cp-toc-num,9mm);text-align:right}.toc-pdf-style.toc-dense .toc-chapter{margin-bottom:3mm}.toc-pdf-style.toc-dense .toc-item{margin:.5mm 0}.toc-item-title::first-letter{letter-spacing:normal}

/* PDF様式: x.1ページの先頭に章見出し */
.document-chapter-heading{display:grid;grid-template-columns:11mm 1fr;column-gap:2mm;font-size:11pt;font-weight:400;margin:0 0 7mm}.document-chapter-heading+.title{margin-top:0}

/* 各章の先頭見出しをPDF様式に合わせて統一 */
.document-chapter-heading{
  display:grid!important;
  grid-template-columns:10mm 1fr!important;
  column-gap:2mm!important;
  align-items:baseline!important;
  margin:0 0 5mm 0!important;
  padding:0!important;
  font-family:"Yu Gothic","YuGothic",Meiryo,sans-serif!important;
  font-size:10.5pt!important;
  line-height:1.35!important;
  font-weight:400!important;
  letter-spacing:0!important;
}
.document-chapter-heading span:first-child{
  text-align:left!important;
  font-size:10.5pt!important;
  font-weight:400!important;
}
.document-chapter-heading span:last-child{
  font-size:10.5pt!important;
  font-weight:400!important;
}
.document-chapter-heading + .title{
  margin:0 0 9mm 10mm!important;
  padding:0!important;
  font-size:10.5pt!important;
  line-height:1.35!important;
  font-weight:400!important;
  letter-spacing:0!important;
}
/* 第1章の本文見出しも2章以降の小項目と同じ大きさへ統一 */
.a4:not(.toc):not(.cover) h2{
  font-size:10.5pt!important;
  line-height:1.35!important;
  font-weight:400!important;
}

/* 第1章と同じ章・項目階層へ統一 */
.a4.chapter-first .document-chapter-heading{margin:0 0 8mm 0!important;font-size:10.5pt!important;line-height:1.35!important;font-weight:400!important}
.a4.chapter-first>.title{margin:0 0 14mm 10mm!important;font-size:10.5pt!important;line-height:1.35!important;font-weight:400!important}
.a4.chapter-continuation>.title{margin:0 0 14mm 10mm!important;font-size:10.5pt!important;line-height:1.35!important;font-weight:400!important}
.a4.chapter-continuation>h2:first-of-type{margin-top:0!important}

/* 津田塾大学PDF準拠の本文階層・余白 最終調整 */
.a4.chapter-first,.a4.chapter-continuation{padding-top:18mm!important;padding-left:20mm!important;padding-right:18mm!important}
.document-chapter-heading{display:flex!important;align-items:baseline!important;margin:0 0 6mm 0!important;padding:0!important;font-family:"Yu Gothic","YuGothic",Meiryo,sans-serif!important;font-size:10.5pt!important;line-height:1.35!important;font-weight:400!important}
.document-chapter-heading .chapter-number{display:inline-block!important;width:15mm!important;text-align:left!important}
.document-chapter-heading .chapter-name{display:inline-block!important;font-size:10.5pt!important;font-weight:400!important}
.a4.chapter-first>.title{margin:0 0 10mm 15mm!important;padding:0!important;font-size:10.5pt!important;line-height:1.35!important;font-weight:400!important}
.a4.chapter-continuation>.title{margin:0 0 10mm 15mm!important;padding:0!important;font-size:10.5pt!important;line-height:1.35!important;font-weight:400!important}
.document-body{margin-left:15mm!important;font-size:10.5pt!important;line-height:1.65!important}
.document-body>h2{margin:0 0 2mm 0!important;font-size:10.5pt!important;line-height:1.35!important;font-weight:400!important}
.document-body>h2:not(:first-child){margin-top:6mm!important}
.document-body .kv{margin-left:0!important;width:auto!important;min-width:145mm!important}
.document-body .kv th{width:42mm!important;padding:1.6mm 2mm 1.6mm 0!important;text-align:justify!important;text-align-last:justify!important;white-space:nowrap!important}
.document-body .kv td{padding:1.6mm 0 1.6mm 2mm!important}
.document-body .table{margin-left:0!important}
.a4.landscape .document-body{margin-left:10mm!important}
.a4.landscape.chapter-first>.title,.a4.landscape.chapter-continuation>.title{margin-left:10mm!important}

/* 大項目と小項目の基準線を全章で完全統一 */
.a4.chapter-only,.a4.chapter-first,.a4.chapter-continuation{padding-top:18mm!important;padding-left:20mm!important;padding-right:18mm!important}
.a4.chapter-only>.document-chapter-heading,.a4.chapter-first>.document-chapter-heading{display:grid!important;grid-template-columns:15mm 1fr!important;column-gap:0!important;margin:0 0 6mm 0!important;padding:0!important;font-size:10.5pt!important;line-height:1.35!important;font-weight:400!important}
.a4.chapter-only>.document-chapter-heading .chapter-number,.a4.chapter-first>.document-chapter-heading .chapter-number{width:auto!important;text-align:left!important}
.a4.chapter-only>.document-chapter-heading .chapter-name,.a4.chapter-first>.document-chapter-heading .chapter-name{font-size:10.5pt!important;font-weight:400!important}
/* 小項目の左端は全章ともページ左から35mm */
.a4.chapter-first>.title,.a4.chapter-continuation>.title{margin:0 0 10mm 15mm!important;padding:0!important;font-size:10.5pt!important;line-height:1.35!important;font-weight:400!important}
.a4.chapter-only>.document-body,.a4.chapter-first>.document-body,.a4.chapter-continuation>.document-body{margin-left:15mm!important;font-size:10.5pt!important;line-height:1.65!important}
.a4.chapter-only>.document-body>h2,.a4.chapter-first>.document-body>h2,.a4.chapter-continuation>.document-body>h2{margin:0 0 2mm 0!important;padding:0!important;font-size:10.5pt!important;line-height:1.35!important;font-weight:400!important}
.a4.chapter-only>.document-body>h2:not(:first-child),.a4.chapter-first>.document-body>h2:not(:first-child),.a4.chapter-continuation>.document-body>h2:not(:first-child){margin-top:6mm!important}

@media print{.a4{box-shadow:none;break-after:page;margin:0}}
/* Explicit character slots preserve justified labels in both DOM and html2canvas. */
.kv-label{display:flex;justify-content:space-between;align-items:center;width:100%;font-weight:400}/* Media pages use the same geometry for live HTML and final PDF. */
/* 前の余白は padding-top（前の要素の下余白と相殺しない＝独立に加算）。後は padding-bottom。 */
.placed-image{margin:0;padding-top:var(--cp-img-mt,6mm);padding-bottom:var(--cp-img-mb,0mm);break-inside:avoid}
.placed-image.align-left{margin-left:0;margin-right:auto}
.placed-image.align-center{margin-left:auto;margin-right:auto}
.placed-image.align-right{margin-left:auto;margin-right:0}
.placed-image figcaption{margin-top:1.5mm;font-size:9pt;line-height:1.4;text-align:center}
.placed-image img{width:100%;height:auto;object-fit:contain;display:block}
/* 横並び（2枚・等幅・間隔4mm）。行は本文幅いっぱい。各画像はセル幅の中で、配置（左・中央・右）に従う。行全体は分割しない。 */
.placed-row{display:flex;align-items:flex-start;gap:4mm;width:100%;margin:0;break-inside:avoid}
/* 行の中の幅は --rw の比（省けば1＝等幅）。隙間（4mm）を除いた残りを比で分ける。 */
.placed-row>.placed-image{flex:var(--rw,1) 1 0;width:auto;min-width:0;max-width:none;margin:0;display:flex;flex-direction:column;align-items:flex-start}
.placed-row>.placed-image.align-center{align-items:center}
.placed-row>.placed-image.align-right{align-items:flex-end}
/* フィットオフの行：各画像は自分のサイズのまま（幅は style の幅）。行に余裕がなければ比で縮む（比例縮小）。行全体の寄せは行の位置。 */
.placed-row>.placed-image.row-free{flex:0 1 auto}
.placed-row.row-al-center{justify-content:center;margin-left:auto;margin-right:auto}   /* 行の幅を変えた時（rs）は行の位置を寄せる（幅いっぱいの行は変わらない） */
.placed-row.row-al-left{margin-right:auto}
.placed-row>.placed-image.row-free.va-middle{align-self:center}
.placed-row>.placed-image.row-free.va-bottom{align-self:flex-end}
.placed-row.row-al-right{justify-content:flex-end;margin-left:auto}
.placed-row>.placed-image img{display:block;max-width:100%}
.placed-row>.placed-image figcaption{align-self:stretch}
/* 表示範囲の箱（切り取り・回転）。箱で切り、画像は箱の中へ位置で置く（画像は元のまま。PDFも同じ箱で切る）。 */
.placed-image>.img-view>img,.img-view>img{position:absolute;display:block;max-width:none;max-height:none;margin:0;padding:0;object-fit:fill}
.img-view{position:relative;overflow:hidden;width:100%;margin:0;padding:0;display:block}

/* ---- 4. 文書レイアウト設定。report.js が article の style に与える CSS 変数で上書きする。
 *   変数が無いときは上の既定値（従来の値）になる。既定値は js/model.js の LAYOUT_DEFAULTS と一致させる。 */
.a4.chapter-only,.a4.chapter-first,.a4.chapter-continuation{padding:var(--cp-m-top,18mm) var(--cp-m-right,18mm) var(--cp-m-bottom,12mm) var(--cp-m-left,20mm)!important}
.a4.chapter-first>.title,.a4.chapter-continuation>.title{margin:0 0 var(--cp-title-after,10mm) var(--cp-indent,15mm)!important;font-size:var(--cp-title-font,10.5pt)!important}
.a4.chapter-only>.document-body,.a4.chapter-first>.document-body,.a4.chapter-continuation>.document-body{margin-left:var(--cp-indent,15mm)!important;font-size:var(--cp-body-font,10.5pt)!important;line-height:var(--cp-body-lh,1.65)!important}
.a4.chapter-only>.document-body>h2,.a4.chapter-first>.document-body>h2,.a4.chapter-continuation>.document-body>h2{margin:0 0 var(--cp-h-after,2mm) 0!important;font-size:var(--cp-heading-font,10.5pt)!important}
.a4.chapter-only>.document-body>h2:not(:first-child),.a4.chapter-first>.document-body>h2:not(:first-child),.a4.chapter-continuation>.document-body>h2:not(:first-child){margin-top:var(--cp-h-before,6mm)!important}
.block-text{margin-bottom:var(--cp-block-after,0mm)}
.page-break{height:0;margin:0;padding:0}
/* 表紙の文字サイズ・太さ・余白・揃え（既定値は旧来の見た目と同じ） */
.coverProject{font-size:var(--cp-cover-fp,12pt);left:var(--cp-cover-side,20mm);right:var(--cp-cover-side,20mm);text-align:var(--cp-cover-align,center)}
.coverDoc{top:calc(104mm + var(--cp-cover-doc,0mm))!important;font-size:var(--cp-cover-fd,22pt);font-weight:var(--cp-cover-fw,700);left:var(--cp-cover-dside,15mm);right:var(--cp-cover-dside,15mm);text-align:var(--cp-cover-align,center)}
.coverDate,.coverCompany{font-size:var(--cp-cover-fi,10.5pt);left:var(--cp-cover-side,20mm);right:var(--cp-cover-side,20mm);text-align:var(--cp-cover-align,center)}


/* Preserve plain-text cell line breaks in preview and vector PDF alike. */
.table td{white-space:pre-line;overflow-wrap:anywhere}
.table td.ca-v-top{vertical-align:top}.table td.ca-v-middle{vertical-align:middle}.table td.ca-v-bottom{vertical-align:bottom}
.table td.ca-h-left{text-align:left}.table td.ca-h-center{text-align:center}.table td.ca-h-right{text-align:right}
