/* 税理士のための無料計算ツール（shiwake.ai/tools/）— ランディングと同じ色・書体 */
:root {
  --paper: #F5F3ED;
  --paper-deep: #ECE9E1;
  --panel: #FFFFFF;
  --ink: #151A28;
  --ink-soft: #454B5C;
  --ink-faint: #7A7F8C;
  --line: rgba(21,26,40,0.12);
  --line-strong: rgba(21,26,40,0.26);
  --ai: #1F3A5F;
  --ai-soft: rgba(31,58,95,0.07);
  --shu: #B4392F;
  --kin: #8A6F3C;
  --win: #2E6E52;
  --warn-soft: #FFF6D6;
  --font-jp: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  --font-sans: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", "Roboto Mono", "Menlo", monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-sans); line-height: 1.8; -webkit-font-smoothing: antialiased; }
a { color: var(--ai); }
img { max-width: 100%; height: auto; }

.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--paper) 90%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1080px; margin: 0 auto; padding: 0 16px; height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand b { font-family: var(--font-jp); font-size: 1.05rem; letter-spacing: .04em; white-space: nowrap; }
.brand b i { font-style: normal; color: var(--ai); }
.brand span { font-family: var(--font-mono); font-size: .62rem; letter-spacing: .14em; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-cta { flex: none; font-size: .8rem; font-weight: 700; text-decoration: none; color: #fff; background: var(--ai); padding: 7px 14px; border-radius: 3px; white-space: nowrap; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.crumb { font-size: .78rem; color: var(--ink-faint); margin: 18px 0 6px; }
.crumb a { color: var(--ink-faint); }
h1 { font-family: var(--font-jp); font-size: clamp(1.45rem, 4.2vw, 2.1rem); line-height: 1.45; margin: 4px 0 10px; letter-spacing: .02em; }
h1 .h1-sub { display: block; font-size: .56em; line-height: 1.55; margin-top: .35em; color: var(--ink-soft, #555); font-weight: 600; letter-spacing: .01em; }
h1 .h1-dash { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
h2 { font-family: var(--font-jp); font-size: 1.28rem; margin: 38px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--line-strong); }
h3 { font-size: 1.02rem; margin: 22px 0 8px; }
.updated { font-size: .78rem; color: var(--ink-faint); }
/* H1 の下の「無料・登録不要」（freeNote） */
.free-note { margin: -2px 0 8px; line-height: 1.6; }
.free-note .fn-badge { display: inline-block; font-weight: 700; font-size: .78rem; color: var(--ai); background: var(--ai-soft); border: 1px solid var(--line); border-radius: 999px; padding: 1px 10px; }
.lead { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--ai); padding: 12px 16px; margin: 14px 0 22px; }
.lead ul { margin: 0; padding-left: 1.2em; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
@media (min-width: 900px) { .layout { grid-template-columns: minmax(0, 1fr) 300px; } }

.calc { background: var(--panel); border: 1px solid var(--line-strong); border-radius: 4px; padding: 18px 16px; }
.calc h2 { margin-top: 0; border: 0; padding: 0; font-size: 1.1rem; }
.field { display: grid; gap: 4px; margin-bottom: 14px; }
.field > label, .field > .lbl { font-size: .86rem; font-weight: 700; }
.field small { color: var(--ink-faint); font-size: .76rem; line-height: 1.5; }
.row2 { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
/* PC・タブレット（2列）: 高さの違う欄が並んでも引き伸ばさず、見出し・入力・補足の行を左右でそろえる。
   引き伸ばすと入力欄が下がり「円」が入力欄の外にずれていた。スマホ（1列）の見た目は変えない */
@media (min-width: 560px) {
  .row2 { grid-template-columns: 1fr 1fr; align-items: start; }
  .field { align-content: start; }
  .field > * { min-width: 0; }
  .yen { align-self: start; }
  .yen input { display: block; }
  .yen::after { line-height: 1; white-space: nowrap; pointer-events: none; }
  @supports (grid-template-rows: subgrid) {
    /* 行の間隔は gap ではなく margin（使っていない行に間隔が付かないように） */
    .row2 > .field { grid-row: span 4; grid-template-rows: subgrid; row-gap: 0; }
    .row2 > .field > * + * { margin-top: 4px; }
    /* 隣の選択肢が折り返して行が高くなっても、入力欄・プルダウンは引き伸ばさない */
    .row2 > .field > select, .row2 > .field > input, .row2 > .field > textarea, .row2 > .field > .radios { align-self: start; }
    /* 見出しのすぐ下の選択肢は、隣が入力欄・プルダウンなら同じ行の上下中央に（選択肢どうしなら上端でそろえる） */
    .row2:has(> .field > :is(.yen, select, input, textarea)) > .field > :is(label, .lbl) + .radios { align-self: center; }
  }
}
input[type=text], input[type=date], input[type=number], select, textarea {
  width: 100%; font: inherit; font-size: 16px; padding: 9px 10px; border: 1px solid var(--line-strong); border-radius: 3px; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--ai); outline-offset: 1px; }
input::placeholder, textarea::placeholder { color: #B9BDC7; opacity: 1; }
.yen { position: relative; align-self: start; }
.yen input { display: block; padding-right: 34px; text-align: right; font-family: var(--font-mono); text-overflow: ellipsis; }
.yen::after { content: "円"; position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); font-size: .86rem; line-height: 1; white-space: nowrap; pointer-events: none; }
.radios { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .9rem; }
.radios label { display: inline-flex; align-items: center; gap: 5px; }
button.go { width: 100%; font: inherit; font-weight: 700; font-size: 1rem; color: #fff; background: var(--ai); border: 0; border-radius: 3px; padding: 12px; cursor: pointer; }
button.go:hover { filter: brightness(1.12); }

.result { margin-top: 18px; display: none; }
.result.on { display: block; }
.big { background: var(--ai-soft); border: 1px solid var(--line); border-radius: 4px; padding: 14px 16px; margin-bottom: 12px; }
.big .k { font-size: .84rem; color: var(--ink-soft); }
.big .v { font-family: var(--font-mono); font-size: clamp(1.6rem, 6vw, 2.2rem); font-weight: 700; color: var(--ai); line-height: 1.3; }
.big .v small { font-size: .9rem; font-family: var(--font-sans); margin-left: 4px; color: var(--ink-soft); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; margin: 8px 0 14px; }
th, td { border-bottom: 1px solid var(--line); padding: 7px 8px; text-align: left; vertical-align: top; }
th { background: var(--paper-deep); font-weight: 700; font-size: .82rem; }
td.n, th.n { text-align: right; font-family: var(--font-mono); white-space: nowrap; }
tr.total td { font-weight: 700; border-top: 1px solid var(--line-strong); }
.tbl { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.note { font-size: .8rem; color: var(--ink-soft); background: var(--warn-soft); padding: 8px 12px; border-radius: 3px; margin: 8px 0; }
.ok { color: var(--win); font-weight: 700; }
.ng { color: var(--shu); font-weight: 700; }
.err { color: var(--shu); font-size: .86rem; margin-top: 8px; }

.side { display: grid; gap: 16px; align-content: start; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 14px 16px; font-size: .88rem; }
.card h3 { margin: 0 0 8px; font-size: .95rem; }
.card ul { margin: 0; padding-left: 1.1em; }
.promo { background: var(--ink); color: #fff; border-radius: 4px; padding: 18px 16px; }
.promo h3 { font-family: var(--font-jp); margin: 0 0 8px; font-size: 1.05rem; color: #fff; }
.promo p { margin: 0 0 12px; font-size: .86rem; color: rgba(255,255,255,.82); line-height: 1.7; }
.promo a.btn { display: block; text-align: center; background: #C9A227; color: var(--ink); font-weight: 700; text-decoration: none; padding: 10px; border-radius: 3px; }
.promo a.sub { display: block; text-align: center; color: rgba(255,255,255,.75); font-size: .8rem; margin-top: 8px; }

.content { font-size: .95rem; }
.content p { margin: 8px 0; }
.content code, .formula { font-family: var(--font-mono); font-size: .88em; background: var(--paper-deep); padding: 1px 5px; border-radius: 2px; }
.formula { display: block; padding: 10px 12px; margin: 10px 0; white-space: pre-wrap; line-height: 1.7; }
.content pre { font-family: var(--font-mono); font-size: .8em; background: var(--paper-deep); padding: 10px 12px; margin: 10px 0; border-radius: 2px; overflow-x: auto; max-width: 100%; line-height: 1.6; }
.faq details { background: var(--panel); border: 1px solid var(--line); border-radius: 3px; padding: 10px 14px; margin: 8px 0; }
.faq summary { font-weight: 700; cursor: pointer; }
.faq details p { margin: 8px 0 0; }
.src li, .hist li { font-size: .85rem; }
.disclaimer { font-size: .78rem; color: var(--ink-faint); margin: 30px 0 10px; }

/* 本文の前の小さな案内（inlineCta）。広告に見えすぎないよう、白地＋左の線＋文字リンク */
.inline-cta { margin: 18px 0 4px; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid #C9A227; border-radius: 4px; padding: 14px 16px; }
.inline-cta .ic-t { margin: 0 0 4px; font-weight: 700; font-size: .95rem; color: var(--ink); text-wrap: balance; }
/* 見出しは「、」の前後を塊にして、入りきらないときは後半ごと次の行へ（孤立した1〜2文字の行を作らない） */
.inline-cta .ic-t span { display: inline-block; }
/* スマホ: 見出しを14pxにして字間を少し詰め、短い見出しは1行に。入らない長い見出しは「、」の後ろで2行に分かれる（PCは変えない） */
@media (max-width: 559px) { .inline-cta .ic-t { font-size: 14px; letter-spacing: -.02em; } }
.inline-cta .ic-x { margin: 0 0 10px; font-size: .84rem; line-height: 1.7; color: var(--ink-soft); }
.inline-cta .ic-x .nw { white-space: nowrap; }
.inline-cta a { display: inline-block; font-size: .88rem; font-weight: 700; color: #fff; background: var(--ai); text-decoration: none; padding: 8px 14px; border-radius: 3px; }
.inline-cta a:hover { filter: brightness(1.12); }
@media (min-width: 760px) { .inline-cta { display: grid; grid-template-columns: 1fr auto; column-gap: 18px; align-items: center; } .inline-cta .ic-t, .inline-cta .ic-x { grid-column: 1; } .inline-cta .ic-x { margin-bottom: 0; } .inline-cta a { grid-column: 2; grid-row: 1 / span 2; white-space: nowrap; } }
.cta { margin: 40px 0 10px; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 4px; padding: 22px 18px; display: grid; gap: 12px; }
@media (min-width: 760px) { .cta { grid-template-columns: 1fr auto; align-items: center; } }
.cta h2 { margin: 0; border: 0; padding: 0; font-size: 1.2rem; }
.cta p { margin: 4px 0 0; font-size: .9rem; color: var(--ink-soft); }
.cta a.btn { display: inline-block; background: var(--ai); color: #fff; font-weight: 700; text-decoration: none; padding: 12px 22px; border-radius: 3px; text-align: center; white-space: nowrap; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin: 12px 0 24px; }
.tool { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 14px 16px; text-decoration: none; color: var(--ink); }
.tool:hover { border-color: var(--ai); }
.tool b { display: block; font-size: .98rem; margin-bottom: 4px; color: var(--ai); }
.tool span { font-size: .82rem; color: var(--ink-soft); line-height: 1.6; display: block; }
.tool em { font-style: normal; font-size: .7rem; font-weight: 700; color: var(--kin); letter-spacing: .06em; }

/* フッター（トップページと同じ4列） */
.site-footer { background: var(--paper-deep); border-top: 1px solid var(--line-strong); margin-top: 56px; padding: 52px 20px 32px; font-size: .82rem; color: var(--ink-soft); }
.ft-in { max-width: 1060px; margin: 0 auto; }
.ft-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 36px; }
.ft-brand .mark { font-family: var(--font-jp); font-size: 1.1rem; font-weight: 600; letter-spacing: .04em; color: var(--ink); text-decoration: none; }
.ft-brand .mark sup { font-family: Georgia, serif; font-size: .4em; vertical-align: text-top; color: var(--ink-faint); font-weight: 400; margin-left: 1px; }
.ft-brand .mark span { color: var(--ai); }
.ft-brand p { margin: 12px 0 0; line-height: 1.8; max-width: 36ch; }
.ft-brand p a { color: var(--ai); text-decoration: none; }
.ft-brand .ft-oih { margin-top: 18px; display: inline-flex; align-items: stretch; border: 1px solid rgba(138,111,60,0.45); border-radius: 2px; font-size: .72rem; line-height: 1; max-width: none; }
.ft-oih b { display: flex; align-items: center; padding: 6px 9px; background: var(--kin); color: #fff; font-size: .72rem; font-weight: 700; letter-spacing: .08em; white-space: nowrap; }
.ft-oih span { display: flex; align-items: center; padding: 5px 10px; color: var(--kin); font-weight: 600; letter-spacing: .06em; white-space: nowrap; }
.ft-oih svg { width: 24px; height: 16px; flex-shrink: 0; box-shadow: 0 0 0 1px rgba(21,26,40,0.18); }
.ft-col h4 { margin: 0 0 10px; font-family: var(--font-mono); font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--kin); font-weight: 700; }
.ft-col a { display: block; color: var(--ink-soft); text-decoration: none; padding: 4px 0; line-height: 1.6; }
.ft-col a:hover, .ft-bottom a:hover { color: var(--ai); }
.ft-bottom { margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; font-size: .76rem; color: var(--ink-faint); }
.ft-bottom a { color: inherit; text-decoration: none; }
@media (max-width: 900px) { .ft-grid { grid-template-columns: 1fr 1fr; gap: 28px; } .ft-brand { grid-column: 1 / -1; } }
@media (max-width: 520px) { .ft-grid { grid-template-columns: 1fr; } .site-footer { padding: 40px 20px 28px; } }

.drop { border: 2px dashed var(--line-strong); border-radius: 4px; padding: 26px 14px; text-align: center; background: var(--paper); cursor: pointer; }
.drop.over { border-color: var(--ai); background: var(--ai-soft); }
.thumbs { display: grid; gap: 10px; margin-top: 12px; }
.thumb { display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: start; background: var(--paper); border: 1px solid var(--line); border-radius: 3px; padding: 8px; font-size: .84rem; }
.thumb img { width: 72px; height: 72px; object-fit: cover; border-radius: 2px; }
.thumb ul { margin: 4px 0 0; padding-left: 1.1em; }

/* ヘッダーのナビ（無料ツール・解説） */
.top-nav { display: flex; gap: 14px; margin-left: auto; font-size: .82rem; }
.top-nav a { color: var(--ink-soft); text-decoration: none; white-space: nowrap; }
.top-nav a[aria-current] { color: var(--ai); font-weight: 700; }
@media (max-width: 520px) { .top-nav { display: none; } }

/* 解説記事 */
.lead > b { display: block; font-size: .84rem; margin-bottom: 4px; }
.toc { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 12px 16px; margin: 0 0 8px; font-size: .88rem; }
.toc b { font-size: .84rem; }
.toc ol { margin: 6px 0 0; padding-left: 1.4em; }
.toc li { margin: 2px 0; }
.guide h2 { scroll-margin-top: 70px; }
.guide h3 { scroll-margin-top: 70px; }
.guide ul, .guide ol { padding-left: 1.3em; }
.guide li { margin: 3px 0; }
.guide .grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.pnote { background: var(--ai-soft); border: 1px solid var(--line); border-radius: 4px; padding: 4px 16px 12px; margin-top: 30px; }
.pnote h2 { margin-top: 14px; border: 0; padding: 0; font-size: 1.12rem; }
.ex { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 10px 14px; margin: 10px 0; }
.ex > b:first-child { display: block; font-size: .84rem; color: var(--kin); margin-bottom: 2px; }
/* 解説の引用（一次資料の文言） */
.guide blockquote { margin: 12px 0; padding: 8px 14px; border-left: 3px solid var(--kin); background: var(--panel); font-size: .9rem; }
.guide blockquote cite { display: block; margin-top: 6px; font-size: .78rem; font-style: normal; color: var(--ink-soft); }
/* 解説の表: スマホでは表の中だけ横にスクロール（列を1文字ずつに潰さない） */
.guide .tbl table { min-width: 560px; }
.content .tbl th, .content .tbl td { word-break: auto-phrase; }
/* 表の1列目は折り返すが、短い見出しは1行に（5.5em）。1列目が①・番号だけの表（narrow1）は最小幅なし */
.content .tbl th:first-child, .content .tbl td:first-child { white-space: normal; min-width: 5.5em; }
.content .tbl.narrow1 th:first-child, .content .tbl.narrow1 td:first-child { min-width: 0; white-space: nowrap; }
/* 数字の列でも、複数列にまたがる説明の文は折り返す（ほかの列が細くならないように） */
.content .tbl td.n[colspan] { white-space: normal; text-align: left; font-family: inherit; }
