/* 不動産執行 配当計算 ― 見た目（saiken-haitou・sohikaku と同じ配色） */
:root {
  --primary: #004878; --primary-light: #e8f0f6; --border: #d6dbdf; --bg: #fafafa; --card: #fff;
  --text: #201f1e; --sub: #605e5c; --danger: #a80000; --warn: #9d5d00; --warn-bg: #fff4ce;
  --radius: 6px;
  font-family: "BIZ UDPGothic", "Yu Gothic UI", "Meiryo", "Hiragino Sans", "Noto Sans JP", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
.top { background: var(--primary); color: #fff; display: flex; justify-content: space-between; align-items: center; padding: 10px 20px; gap: 12px; flex-wrap: wrap; }
.brand { font-size: 20px; font-weight: 700; }
.top .right { display: flex; gap: 8px; flex-wrap: wrap; }
.top .brand { display: flex; align-items: center; gap: 10px; }
.top .brand img { width: 34px; height: 34px; border-radius: 8px; flex: none; box-shadow: 0 0 0 1px rgba(255,255,255,.55); }
.privacy { margin: 0; padding: 6px 20px; font-size: 12px; color: var(--sub); background: #f3f6f8; border-bottom: 1px solid var(--border); }
.layout { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; padding: 16px 20px; max-width: 1800px; margin: 0 auto; align-items: start; }
.result-col { position: sticky; top: 12px; }
@media (max-width: 1200px) { .layout { grid-template-columns: 1fr; } .result-col { position: static; } }
.license { max-width: 1800px; margin: 0 auto 16px; padding: 0 20px; font-size: 12px; color: var(--sub); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; }
.card h2 { font-size: 16px; margin: 0 0 8px; color: var(--primary); }
.sub-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; margin: 8px 0; background: #fcfdfe; }
.sub-card.claim { border-left: 4px solid var(--primary); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; }
.row { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: end; margin: 4px 0; }
.row.between { justify-content: space-between; align-items: center; }
.field { display: flex; flex-direction: column; gap: 2px; margin: 4px 0; }
.field.wide2 { grid-column: span 2; min-width: 18em; }
.hint.span-all { grid-column: 1 / -1; margin: 2px 0; }
.calc-line { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 10px; border-top: 1px dashed var(--border); padding-top: 4px; }
.calc-line .field { min-width: 8em; }
.calc-line .field.narrow { min-width: 5em; max-width: 6em; }
.calc-out { font-size: 13px; color: var(--primary); min-width: 9em; padding-bottom: 8px; }
details.history { overflow-x: auto; }
details.history table { margin: 4px 0; }
details.history td:first-child, details.history td:nth-child(2), details.history .btn { white-space: nowrap; }
.label { font-size: 12px; color: var(--sub); }
/* 作成者の氏名：見出しが長いので 1 行を使い、欄の右に計算結果による肩書を添える */
.signer-field { grid-column: 1 / -1; }
.signer-row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; }
.signer-row .in { flex: 0 1 15em; min-width: 10em; }
.signer-role { font-size: 12px; color: var(--sub); }
.hint { font-size: 12.5px; color: var(--sub); margin: 6px 0; }
.hint.warn { color: var(--warn); background: var(--warn-bg); padding: 6px 10px; border-radius: 4px; }
.hint.warn ul { margin: 4px 0 0; padding-left: 1.4em; }
.err { color: var(--danger); }
.sub { color: var(--sub); font-size: 13px; }
.in { font: inherit; padding: 4px 7px; border: 1px solid #b9c0c6; border-radius: 4px; background: #fff; min-width: 0; width: 100%; }
.in.num { text-align: right; }
.in.wide { width: 100%; }
.in:focus, .btn:focus-visible { outline: 2px solid #0f6cbd; outline-offset: 1px; }
.chk { display: inline-flex; gap: 4px; align-items: center; font-size: 13px; margin: 6px 12px 6px 0; }
.btn { font: inherit; padding: 5px 12px; border: 1px solid var(--primary); color: var(--primary); background: #fff; border-radius: 4px; cursor: pointer; }
.btn:hover:not(:disabled) { background: var(--primary-light); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.light { background: transparent; color: #fff; border-color: #fff; }
.btn.light:hover { background: rgba(255,255,255,.15); }
a.btn { text-decoration: none; display: inline-block; vertical-align: middle; } /* 行の高さは .btn（ボタン）と同じく親から受け継ぐ。normal にするとフォントによって文字が上下にずれる */
.btn { line-height: inherit; }
.btn.small { padding: 2px 10px; font-size: 13px; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
details summary { cursor: pointer; color: var(--primary); font-size: 13px; margin: 6px 0; }
table.mini { border-collapse: collapse; font-size: 12.5px; width: 100%; }
table.mini th, table.mini td { border: 1px solid var(--border); padding: 3px 6px; vertical-align: top; }
table.mini td.n { text-align: right; }

/* 配当表（実務の書式。園部厚「書式 不動産執行の実務〔全訂12版〕」の書式88） */
.print-area { overflow-x: auto; background: #fff; padding: 8px 0; }
.ht-sheet { border-collapse: collapse; width: 100%; min-width: 860px; font-family: "BIZ UDPMincho", "Yu Mincho", "MS PMincho", "Hiragino Mincho ProN", serif; font-size: 12px; table-layout: fixed; }
.ht-sheet td, .ht-sheet th { border: 1px solid #000; padding: 3px 5px; vertical-align: middle; font-weight: normal; }
.ht-sheet .c-rank { width: 4.5%; } .ht-sheet .c-payee { width: 22%; } .ht-sheet .c-amt { width: 11%; } .ht-sheet .c-note { width: 18.5%; }
.ht-left { vertical-align: top !important; line-height: 1.9; padding: 6px 10px !important; }
.ht-left .ht-signer { margin-top: 1.4em; padding-left: 2em; }
.ht-title { font-size: 18px; text-align: center; letter-spacing: .3em; }
.ht-cases { text-align: right; vertical-align: top !important; line-height: 1.7; }
.ht-flabel { text-align: center; }
.ht-fval { text-align: right; }
.ht-debtor { text-align: center; letter-spacing: .2em; }
.ht-c { text-align: center; }
.ht-n { text-align: right; white-space: nowrap; }
.ht-bottom { vertical-align: bottom !important; }
.ht-stack div { line-height: 1.55; }
th.ht-stack { text-align: left; white-space: nowrap; }
.ht-uline { border-bottom: 1px solid #000; margin-bottom: 2px; }
.ht-who div { min-height: 1.3em; }
.ht-note { font-size: 11px; vertical-align: top !important; }
.ht-total td { height: 2em; }
.ht-status { margin-top: 18px; page-break-before: always; break-before: page; }
.ht-status-title { font-family: "BIZ UDPMincho", "Yu Mincho", serif; font-weight: normal; font-size: 16px; text-align: center; letter-spacing: .2em; }
.ht-st th { text-align: center; }
.ht-small { font-size: 11px; }
.ht-dep { text-align: left; white-space: nowrap; }
.ht-r { text-align: right; }
.ht-prov { margin: 0 0 4px; font-size: 13px; color: #a80000; }
/* 手続費用計算書（書式2-72） */
.ht-cost { margin-top: 18px; page-break-before: always; break-before: page; }
.ht-cost-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 4px; font-family: "BIZ UDPMincho", "Yu Mincho", serif; }
.ht-cost-title { font-weight: normal; font-size: 16px; letter-spacing: .1em; margin: 0; }
.ht-cost-meta { font-size: 12px; line-height: 1.6; }
.ht-cs .cs-no { width: 6%; } .ht-cs .cs-item { width: 44%; } .ht-cs .cs-amt { width: 14%; } .ht-cs .cs-note { width: 36%; }
.ht-cs td { height: 1.7em; }
.pp .ht-cost { margin-top: 0; }

.in.bad { border-color: var(--danger); color: var(--danger); }

/* 配当等事件の番号 */
.cases { display: flex; flex-direction: column; gap: 4px; }
.case-count { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.case-count .case-n { width: 4em; padding: 2px 6px; }
.case-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 14px; }
.case-row .case-k { display: inline-block; min-width: 1.6em; color: var(--sub); font-size: 12px; }
.case-row .case-era { width: 5.2em; padding: 3px 2px; } .case-row .case-y { width: 4em; } .case-row .case-no { width: 7em; } .case-row .case-raw { width: 18em; }
.case-row .in { padding: 3px 6px; }

/* テンプレート */
.card.tpl { border: 2px solid var(--primary); background: var(--primary-light); }
.tpl-kinds { margin: 4px 0 6px; }
.tpl-kinds .label { display: block; font-size: 12.5px; color: var(--sub); margin-bottom: 2px; }
.tpl-kind { display: flex; align-items: center; gap: 4px 14px; min-height: 34px; }
.tpl-kind .tpl-n { width: 4.5em; padding: 2px 6px; }
.tpl-kind > .chk:first-child { min-width: 14em; }
.tpl-patterns { display: flex; flex-direction: column; gap: 0; margin: 4px 0; }
.tpl-patterns .chk { margin: 3px 0; }
.card.guide ol { margin: 4px 0 0; padding-left: 1.4em; font-size: 13px; }
.card.guide li { margin: 3px 0; }

.examples { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 6px; }
.examples h3 { font-size: 15px; margin: 4px 0; color: var(--primary); }
.ex-group summary { cursor: pointer; font-weight: 600; font-size: 13.5px; padding: 3px 0; }
.ex-group ul { list-style: none; margin: 2px 0 6px; padding: 0; }
.ex-group li { display: grid; grid-template-columns: auto 1fr; gap: 0 8px; align-items: start; padding: 4px 0; border-bottom: 1px dotted var(--border); }
.ex-group li .ex-title { font-size: 13px; font-weight: 600; }
.ex-group li .ex-desc { grid-column: 2; font-size: 12px; color: var(--sub); }
.ex-book { font-size: 11px; color: #fff; background: var(--primary); border-radius: 3px; padding: 0 5px; margin-left: 6px; }
.ex-banner { border: 1px solid var(--border); border-left: 4px solid var(--sub); border-radius: var(--radius); padding: 6px 10px; margin: 0 0 8px; font-size: 13px; background: #fff; }
.ex-banner.ok { border-left-color: #2e7d32; }
.ex-banner p { margin: 3px 0; }
.ex-banner.ok .ex-check { color: #2e7d32; font-weight: 600; }

/* 誤りの報告・改善の提案 */
.report-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 10px 0 4px; }
.report-row .hint { margin: 0; font-size: 12px; flex-basis: 100%; }

/* 印刷の選択 */
.print-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; }
.print-opts .po-start { width: 4em; padding: 2px 4px; }
.print-opts .po-btns { margin-left: auto; }

/* 印刷用のページ（print.js が組む）。@page の余白を0にしてブラウザのヘッダ・フッタ（URL・日時等）を出さず、
   余白・ページ番号はページの中に置く。.pp の体裁で行の高さを測るので、印刷と同じ指定を画面側にも置く */
#print-pages { display: none; }
.pp .ht-sheet { min-width: 0; font-size: 9.5pt; }
.pp .ht-sheet td, .pp .ht-sheet th { padding: 2px 4px; }
.pp .ht-stack div { line-height: 1.3; }
.pp .ht-status { margin-top: 0; }
.pp-measure { position: absolute; left: -10000px; top: 0; width: 273mm; visibility: hidden; background: #fff; }
.pp-mm { height: 100mm; }
.pp-page { position: relative; width: 297mm; height: 209mm; padding: 12mm; box-sizing: border-box; overflow: hidden; break-after: page; page-break-after: always; }
.pp-page:last-child { break-after: auto; page-break-after: auto; }
.pp-page .ht-sheet + .ht-sheet, .pp-page .ht-sheet + p { margin-top: 0; }
.pp-no { position: absolute; left: 0; right: 0; bottom: 7mm; text-align: center; font-family: "BIZ UDPMincho", "Yu Mincho", "MS PMincho", "Hiragino Mincho ProN", serif; font-size: 10pt; }

@media print {
  @page { size: A4 landscape; margin: 0; }
  html, body { margin: 0; padding: 0; background: #fff; }
  body > :not(#print-pages):not(.pp-measure) { display: none !important; }
  #print-pages { display: block; }
}

/* ---- 不動産執行の配当表（6列）と付属の表 ---- */
.ht-sheet .c-rank { width: 4%; } .ht-sheet .c-payee { width: 27%; } .ht-sheet .c-amt { width: 12%; } .ht-sheet .c-note { width: 33%; }
.ht-prop { text-align: right; }
.ht-subtitle { font-size: 11px; letter-spacing: 0; margin-top: 2px; }
.ht-who .ht-code { text-align: right; font-size: 11px; min-height: 0; }
.ht-foot { margin: 2px 0; font-size: 10.5px; font-family: "BIZ UDPMincho", "Yu Mincho", serif; }
.ht-block + .ht-block { margin-top: 18px; }
.ht-newpage { page-break-before: always; break-before: page; }
.ht-sub-title { font-family: "BIZ UDPMincho", "Yu Mincho", serif; font-weight: normal; font-size: 16px; text-align: center; letter-spacing: .2em; margin: 4px 0; }
.ht-dl .dl-code { width: 6%; } .ht-dl .dl-who { width: 38%; } .ht-dl .dl-amt { width: 15%; } .ht-dl .dl-note { width: 26%; }
.ht-ut { table-layout: auto; }
.ht-dash { color: #555; }
.pp .ht-block + .ht-block { margin-top: 0; }
.sheet-wrap { overflow-x: auto; background: #fff; padding: 8px 0; }

/* 画面 */
.tpl-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.ex-list { list-style: none; padding: 0; margin: 4px 0; font-size: 13px; }
.ex-list li { padding: 4px 0; border-bottom: 1px dotted var(--border); }
.ex-list a { font-size: 11px; }
button.link { background: none; border: none; color: var(--primary); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; font-weight: 600; }
.badge { display: inline-block; background: var(--primary); color: #fff; border-radius: 3px; padding: 1px 8px; font-size: 13px; }
.badge.warn { background: var(--warn); }
.warnings { color: var(--warn); background: var(--warn-bg); padding: 6px 10px; border-radius: 4px; font-size: 13px; margin: 8px 0; }
.warnings ul { margin: 4px 0 0; padding-left: 1.4em; }
.excluded { font-size: 13px; }
p.ok { color: #2e7d32; font-size: 13px; margin: 6px 0; }
p.warn { color: var(--warn); font-size: 13px; margin: 6px 0; }
.report { font-size: 12.5px; }
.field.narrow { max-width: 7em; }
.span-all { grid-column: 1 / -1; }
.card.ex-banner { border-left: 4px solid #2e7d32; font-size: 13px; }
.ex-group .ex-list li { display: block; }
.ex-group { margin-left: 4px; }
/* 配当表が次葉にわたる位置（印刷の改ページ。画面だけに線を引く。box-shadow は行の高さを変えない） */
.ht-pagestart > td { box-shadow: inset 0 2px 0 0 #c0392b; }
.pp .ht-pagestart > td, .pp-page .ht-pagestart > td { box-shadow: none; }
@media print { .ht-pagestart > td { box-shadow: none; } }
