/* デザイン：白×スカイの経済メディア風（okanefuyasu.net 共通・2026-10-15）。
   印刷して渡す資料なので塗りは最小限、区切りは罫線。見本は tools/yakuin-hoshu-sim */
:root {
  --ink: #111;
  --sub: #5f6368;
  --line: #e3e3e3;
  --accent: #8cc8ff;
  --pos: #157f3b;
  --neg: #c2410c;
  --bg: #fff;
  font-family: "Inter", "Noto Sans JP", "Hiragino Sans", sans-serif;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.7;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); -webkit-font-smoothing: antialiased; }
td, .num, .big, .stats b { font-variant-numeric: tabular-nums; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
[hidden] { display: none !important; }

/* header */
.topbar { border-top: 6px solid var(--ink); border-bottom: 1px solid var(--ink); background: #fff; padding: 28px 0 22px; }
.headrow { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.tag { display: inline-block; background: var(--accent); color: var(--ink); font-size: .75rem; font-weight: 700; padding: 2px 10px; letter-spacing: .06em; }
.topbar h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 900; letter-spacing: -.01em; line-height: 1.25; margin: 10px 0 0; }
.topbar .sub { font-size: .95rem; font-weight: 700; margin: 6px 0 0; }
.topbar .lead { font-size: .82rem; color: var(--sub); margin: 6px 0 0; }
.topnav { display: flex; gap: 6px; flex-wrap: wrap; }

main { padding-top: 28px; padding-bottom: 60px; }
.card { background: none; border: 0; border-bottom: 1px solid var(--line); padding: 0 0 22px; margin-bottom: 26px; }
.step-head { display: flex; align-items: center; gap: 10px; border-top: 2px solid var(--ink); padding-top: 8px; margin-bottom: 14px; }
.step { width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
h2 { font-size: .78rem; font-weight: 700; letter-spacing: .12em; margin: 0; }
.sub-h { font-size: .78rem; font-weight: 700; letter-spacing: .12em; margin: 26px 0 10px; border-top: 2px solid var(--ink); padding-top: 8px; }
.hint { color: var(--sub); font-size: 13px; margin: 6px 0; }
.row { display: flex; gap: 8px; align-items: center; }
.row.gap { margin-top: 14px; flex-wrap: wrap; }

/* buttons */
.btn { font: inherit; font-size: 14px; font-weight: 700; padding: 9px 16px; border-radius: 4px; border: 1.5px solid var(--ink); background: var(--ink); color: #fff; cursor: pointer; text-decoration: none; display: inline-block; white-space: nowrap; line-height: 1.4; }
.btn:hover { background: #333; border-color: #333; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { padding: 11px 20px; }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--ink); padding: 7px 14px; }
.btn.ghost:hover { background: var(--accent); border-color: var(--ink); }
.btn.small { font-size: 12.5px; padding: 4px 10px; }
.linklike { font: inherit; background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; cursor: pointer; }

/* import */
.howto { margin: 0 0 12px; padding-left: 22px; font-size: 14px; }
.howto li { margin: 3px 0; }
#paste { width: 100%; font: 13px/1.5 ui-monospace, "SF Mono", Menlo, monospace; padding: 10px 12px; border: 1px solid #bdbdbd; border-radius: 0; resize: vertical; background: transparent; color: var(--ink); }
#paste:focus { outline: none; border-color: var(--ink); }
.hint.error { color: var(--neg); }
input[type=text], input[type=password], input[type=month], select { font: inherit; font-size: 15px; font-weight: 600; padding: 6px 2px; border: none; border-bottom: 1.5px solid #bdbdbd; border-radius: 0; background: transparent; color: var(--ink); min-width: 0; }
input[type=text]:focus, input[type=password]:focus, input[type=month]:focus, select:focus { outline: none; border-bottom-color: var(--ink); }
input[type=checkbox] { accent-color: var(--ink); }
.privacy { font-size: 12.5px; color: var(--ink); border: 1px solid var(--ink); padding: 10px 14px; margin: 18px 0 8px; }

/* sheet（画面でも1枚の紙のように見せる。箱は使わず罫線で区切る） */
.sheet { background: none; border: 0; padding: 0; margin-bottom: 44px; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--ink); padding: 10px 0 8px; margin-bottom: 16px; }
.sheet-title { font-size: 1.3rem; font-weight: 900; letter-spacing: -.01em; margin: 0; color: var(--ink); }
.sheet-meta { margin: 2px 0 0; font-size: 12.5px; color: var(--sub); }
.atena input { width: 220px; }
.atena span { font-size: 16px; font-weight: 700; }
.sheet-note { font-size: 11.5px; color: var(--sub); margin: 14px 0 0; line-height: 1.6; }
.print-only { display: none; }
.check-line { font-size: 13px; margin: 0 0 12px; padding: 4px 0 4px 12px; border-left: 4px solid var(--line); }
.check-line:empty { display: none; }
.check-line.ok { border-left-color: var(--pos); color: var(--pos); }
.check-line.ng { border-left-color: var(--neg); color: var(--neg); }
.more summary { cursor: pointer; color: var(--ink); font-weight: 700; font-size: 15px; }

/* 結論：一番大事な数字（法人税等の見込み） */
.conclusion { margin-bottom: 24px; }
.conclusion .label { font-size: .85rem; color: var(--sub); }
.conclusion .big { font-size: clamp(2.4rem, 6vw, 3.6rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.15; margin: 2px 0 6px; }
.conclusion .big .mark { background: linear-gradient(transparent 62%, var(--accent) 62%); }
.conclusion .fine { font-size: .78rem; color: var(--sub); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); border-top: 1px solid var(--line); margin-top: 14px; }
.stats > div { padding: 12px 12px 4px 0; min-width: 0; }
.stats > div + div { border-left: 1px solid var(--line); padding-left: 14px; }
.stats span { display: block; font-size: .74rem; color: var(--sub); }
.stats b { display: block; font-size: 1.25rem; font-weight: 700; letter-spacing: -.01em; }
.stats small { display: block; font-size: .72rem; color: var(--sub); line-height: 1.5; }

/* 節税策の合計（2ページ目） */
.osu-summary { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.osu-summary:empty { display: none; }
.osu-sum { padding: 8px 12px 8px 0; display: flex; flex-direction: column; min-width: 0; }
.osu-sum + .osu-sum { border-left: 1px solid var(--line); padding-left: 14px; }
.osu-sum span { font-size: .74rem; color: var(--sub); }
.osu-sum strong { font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.osu-sum:first-child strong { background: linear-gradient(transparent 62%, var(--accent) 62%); align-self: flex-start; }
.osu-sum strong.ng { color: var(--neg); }

/* controls */
.controls { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; margin-bottom: 14px; font-size: 14px; }
.controls label { display: flex; align-items: center; gap: 8px; color: var(--sub); font-size: 13px; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

/* tables：見出し行は塗らず、黒線で区切る */
.table-scroll { overflow-x: auto; }
.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.grid th, .grid td { border-bottom: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: middle; }
.grid th:first-child, .grid td:first-child { padding-left: 0; }
.grid thead th { background: none; font-size: 12px; color: var(--sub); font-weight: 500; white-space: nowrap; border-bottom: 1.5px solid var(--ink); }
.grid thead th:not(.item) { text-align: right; }
.grid th.item { font-weight: 500; min-width: 210px; }
.row-hint { display: block; font-size: 11.5px; color: var(--sub); font-weight: 400; }
.grid tr.group th { background: none; font-size: 12px; color: var(--sub); font-weight: 700; letter-spacing: .08em; padding-top: 14px; }
.grid td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 170px; }
.grid td.num input { width: 150px; text-align: right; font-variant-numeric: tabular-nums; }
.grid tr.strong th, .grid tr.strong td { font-weight: 700; }
.grid td.ok { color: var(--pos); font-weight: 600; white-space: nowrap; }
.grid td.ng { color: var(--neg); font-weight: 600; white-space: nowrap; }
.warn { border: 1px solid var(--ink); padding: 8px 12px; font-size: 13.5px; margin: 6px 0; }
.caveats { padding-left: 20px; margin: 0; font-size: 13px; color: var(--sub); }
.caveats li { margin: 4px 0; }

/* footer */
.site-foot { max-width: 1080px; margin: 0 auto; border-top: 1px solid var(--ink); font-size: .75rem; color: var(--sub); padding: 14px 20px 40px; }

@media screen and (max-width: 760px) {
  .grid th.item { min-width: 150px; }
  .grid td.num { min-width: 120px; }
  .grid td.num input { width: 110px; }
  .atena input { width: 100%; }
}

/* 印刷：シート1枚ずつを A4 縦に収める */
@page { size: A4 portrait; margin: 12mm; }
@media print {
  :root { font-size: 10.5px; }
  body { background: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .no-print, [hidden] { display: none !important; }
  .print-only { display: inline; }
  .wrap { max-width: none; padding: 0; }
  main { padding: 0; }
  .sheet { border: 0; padding: 0; margin: 0; }
  .sheet-head { padding: 4px 0 6px; margin-bottom: 10px; }
  .sheet-title { font-size: 16px; }
  .sheet-meta { font-size: 10px; }
  .atena span { font-size: 14px; }
  /* 結論は横一列にして高さを抑える */
  .conclusion { display: grid; grid-template-columns: 1.15fr 2fr; gap: 0 16px; align-items: end; margin-bottom: 10px; }
  .conclusion .label { font-size: 9.5px; }
  .conclusion .big { font-size: 2.2rem; margin: 0 0 2px; }
  .conclusion .fine { font-size: 9px; }
  .stats { margin-top: 0; }
  .stats > div { padding: 6px 8px 2px 0; }
  .stats > div + div { padding-left: 10px; }
  .stats span, .stats small { font-size: 9px; }
  .stats b { font-size: 14px; }
  .table-scroll { overflow: visible; }
  .grid { font-size: 10px; }
  .grid th, .grid td { padding: 2.5px 8px; }
  .grid th.item { min-width: 0; }
  .grid td.num { min-width: 0; }
  .grid thead th { font-size: 9.5px; }
  .grid tr.group th { padding-top: 4px; font-size: 9.5px; }
  .grid td.num input { width: 100%; border: 0; background: none; padding: 0; font-size: 10px; height: auto; }
  .row-hint, .est { display: none; }
  .sheet-note { font-size: 8.5px; margin-top: 8px; }
  .grid, .conclusion { break-inside: avoid; }
  .osu-sum { padding: 4px 10px 4px 0; }
  .osu-sum + .osu-sum { padding-left: 10px; }
  .osu-sum span { font-size: 9px; }
  .osu-sum strong { font-size: 12px; }
}

/* ===== 決算前 納税予測 ===== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tab { font: inherit; font-size: 14px; background: none; border: 0; border-bottom: 3px solid transparent; padding: 8px 12px; color: var(--sub); cursor: pointer; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 700; }
.csv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; margin: 10px 0; }
.csv-box { border-top: 1px solid var(--ink); padding: 10px 0; min-width: 0; }
.csv-box h3 { font-size: 14px; margin: 0 0 6px; }
.csv-box input[type=file] { max-width: 100%; font-size: 13px; }
.csv-box textarea { width: 100%; margin-top: 8px; font: 12px/1.4 ui-monospace, Menlo, monospace; border: 1px solid #bdbdbd; border-radius: 0; padding: 6px 8px; background: transparent; }
.csv-box textarea:focus { outline: none; border-color: var(--ink); }
.req, .opt { font-size: 11px; font-weight: 700; padding: 0 6px; margin-left: 4px; border: 1px solid currentColor; }
.req { color: var(--neg); }
.opt { color: var(--sub); }
.map-table select { max-width: 280px; font-size: 13px; padding: 4px 2px; }
.map-table td { white-space: nowrap; }
#mapping { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }

.sec-h { font-size: .78rem; font-weight: 700; letter-spacing: .12em; margin: 22px 0 8px; border-top: 2px solid var(--ink); padding-top: 8px; color: var(--ink); }
#pl-table td.num, #tax-table td.num { min-width: 120px; }
#pl-table th.item, #tax-table th.item { min-width: 170px; }
.cell-in { width: 130px; text-align: right; font-variant-numeric: tabular-nums; padding: 3px 2px !important; font-size: 14px !important; }
.cell-in.changed { box-shadow: inset 0 -3px 0 var(--accent); border-bottom-color: var(--ink); }
td.muted, tr.muted-row td, tr.muted-row th { color: var(--sub); }
td.strong { font-weight: 700; }
.how { display: block; font-size: 10.5px; color: var(--sub); }
tr.subtotal th, tr.subtotal td { font-weight: 700; background: none; }
tr.total th, tr.total td { font-weight: 700; background: none; border-top: 1.5px solid var(--ink); }
.grid tr.total th:first-child { box-shadow: inset 4px 0 0 var(--accent); padding-left: 10px; }
tr.zero { color: var(--sub); }
.st-table td, .st-table th { font-size: 13px; vertical-align: top; }
.st-table td.r, .st-table th.r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.grid.st-table thead th:not(.item) { text-align: left; }
.grid.st-table thead th.r { text-align: right; }
.st-table tr.off td { color: var(--sub); }
.st-table .req-note { font-size: 11.5px; color: var(--sub); min-width: 220px; }
.st-table .mini { display: flex; align-items: center; gap: 4px; font-size: 12px; margin-top: 4px; font-weight: 400; color: var(--sub); }
.st-table .mini input { width: 56px; padding: 2px; font-size: 12px; }
.st-table .mini select { font-size: 12px; padding: 2px; }
.rates { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px 20px; }
.rates label { display: flex; flex-direction: column; font-size: 12.5px; color: var(--sub); gap: 2px; }
.rates label span { display: flex; align-items: center; gap: 4px; color: var(--ink); }
.rates input { width: 110px; }
.rates .hint { grid-column: 1 / -1; }

@media screen and (max-width: 760px) {
  .csv-grid { grid-template-columns: 1fr; }
  .osu-summary { grid-template-columns: 1fr 1fr; }
  .osu-sum:nth-child(3) { border-left: 0; padding-left: 0; }
  .osu-sum:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media screen and (max-width: 560px) {
  .stats { grid-template-columns: 1fr; }
  .stats > div + div { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; }
}

@media print {
  .sheet.page2 { break-before: page; }
  .cell-in { display: none; }
  .how { display: none; }
  #pl-table td.num, #tax-table td.num { min-width: 0; }
  #pl-table th.item, #tax-table th.item { min-width: 0; }
  .sec-h { font-size: 10px; margin: 8px 0 4px; padding-top: 4px; }
  .st-table td, .st-table th { font-size: 9px; padding: 2.5px 5px; }
  .st-table tr.off { display: none; }
  .st-table .req-note { font-size: 8.5px; min-width: 0; }
  tr.zero { display: none; }
}
.st-table td.item { min-width: 230px; }
