/* 帳簿・伝票をモチーフにしたデザイン。
   紙(paper)・墨(ink)・罫線(rule)・藍(ai)・朱(shu)・記入欄(cell) の6色で構成する。 */
:root {
  --paper: #fbfcfd;
  --sheet: #ffffff;
  --ink: #1b2430;
  --muted: #56616f;
  --rule: #b9cad9;
  --rule-soft: #dde6ee;
  --ai: #1f4e79;
  --ai-ink: #ffffff;
  --shu: #c23a2b;
  --cell: #fff8d6;
  --cell-line: #e3d48f;
  --serif: "BIZ UDPMincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --sans: "BIZ UDPGothic", "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  --num: var(--sans);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #13171c;
    --sheet: #1a1f26;
    --ink: #e4e8ec;
    --muted: #a2adb9;
    --rule: #3d4b5a;
    --rule-soft: #2a333d;
    --ai: #8fb4e0;
    --ai-ink: #0f1a26;
    --shu: #e2685b;
    --cell: #2b2818;
    --cell-line: #5a5130;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.85;
}
a { color: var(--ai); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--ai); outline-offset: 2px; }
.wrap { max-width: 780px; margin: 0 auto; padding: 0 16px; }

/* ヘッダー:朱の角印+明朝の屋号 */
header.site { border-bottom: 1px solid var(--rule); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; gap: 10px 20px; padding-top: 14px; padding-bottom: 12px; flex-wrap: wrap; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--serif); font-weight: 700; font-size: 19px; letter-spacing: .04em; }
.logo i { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 2px solid var(--shu); border-radius: 4px; color: var(--shu); font-style: normal; font-size: 17px; line-height: 1; transform: rotate(-4deg); }
nav.top { display: flex; gap: 18px; font-size: 14px; }
nav.top a { color: var(--muted); text-decoration: none; }
nav.top a:hover { color: var(--ai); text-decoration: underline; }

.crumbs { font-size: 13px; color: var(--muted); margin: 18px 0 0; }
.crumbs a { color: var(--muted); }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; letter-spacing: .02em; }
h1 { font-size: clamp(24px, 4.6vw, 32px); line-height: 1.45; margin: 10px 0 8px; }
h2 { font-size: 21px; line-height: 1.5; margin: 44px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--rule); }
h3 { font-size: 17px; margin: 26px 0 6px; }
.lead { color: var(--muted); margin: 0 0 22px; max-width: 38em; }
article p, article li { max-width: 38em; }

/* 入力欄:Excel商品と同じ「黄色いセル=入力するところ」 */
.sheet { background: var(--sheet); border: 1px solid var(--rule); border-radius: 3px; padding: 20px; margin: 18px 0; }
.tool label { display: block; font-weight: 700; font-size: 14px; margin: 14px 0 5px; }
.tool .hint { font-weight: 400; color: var(--muted); font-size: 13px; }
.tool input, .tool select, .tool textarea {
  width: 100%; font: inherit; padding: 9px 11px; border: 1px solid var(--cell-line); border-radius: 2px;
  background: var(--cell); color: var(--ink);
}
.tool input[inputmode] { font-family: var(--num); font-variant-numeric: tabular-nums; }
.tool input:focus, .tool select:focus, .tool textarea:focus { outline: 2px solid var(--ai); outline-offset: 0; border-color: var(--ai); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }
.radios { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.radios label { display: inline-flex; align-items: center; gap: 7px; font-weight: 400; margin: 0; font-size: 15px; }
.radios input { width: auto; accent-color: var(--ai); }
button {
  display: inline-block; font: inherit; font-weight: 700; padding: 10px 20px; border-radius: 3px; border: 1px solid var(--ai);
  background: var(--ai); color: var(--ai-ink); cursor: pointer; margin: 16px 8px 0 0;
}
button.sub { background: transparent; color: var(--ai); }
button:hover { filter: brightness(1.08); }

/* 計算結果:帳簿の伝票。合計には会計の朱の二重線 */
.result {
  margin-top: 22px; padding: 14px 0 4px; border-top: 2px solid var(--ink);
}
.result > div:first-child { font-size: 14px; color: var(--muted); }
.result .big {
  display: inline-block; font-family: var(--num); font-size: clamp(28px, 7vw, 38px); font-weight: 700; line-height: 1.25;
  font-variant-numeric: tabular-nums; padding: 2px 4px 4px; margin: 2px 0 12px; border-bottom: 4px double var(--shu);
}
.result table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.result td { padding: 6px 2px; border-bottom: 1px solid var(--rule); font-size: 15px; }
.result td.n { text-align: right; font-family: var(--num); }
.result tr:last-child td { border-bottom: 1px solid var(--ink); }
.result p, .result ul { font-size: 15px; }
.result ul { padding-left: 1.3em; }

table.data { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 15px; font-variant-numeric: tabular-nums; }
table.data th, table.data td { border-bottom: 1px solid var(--rule); padding: 7px 8px; text-align: left; }
table.data tr:first-child th { border-bottom: 1px solid var(--ink); font-size: 14px; color: var(--muted); }
.note { border-left: 3px solid var(--shu); padding: 8px 14px; font-size: 14px; margin: 20px 0; color: var(--muted); background: var(--sheet); }
#warn { color: var(--ink); }

/* 商品・PR枠:罫線で区切った控えめな囲み */
.promo { border: 1px solid var(--rule); border-left: 3px solid var(--ai); background: var(--sheet); padding: 14px 16px; margin: 18px 0; }
.promo .tag { display: inline-block; font-size: 12px; color: var(--muted); border: 1px solid var(--rule); padding: 0 6px; margin-bottom: 4px; }
.promo strong { display: block; font-size: 17px; font-family: var(--serif); }
.promo p { margin: 6px 0 0; font-size: 14px; color: var(--muted); }

/* ツール一覧:帳簿の目次のような罫線リスト */
.index { list-style: none; margin: 8px 0 0; padding: 0; border-top: 2px solid var(--ink); }
.index li { border-bottom: 1px solid var(--rule); }
.index a { display: grid; grid-template-columns: 11em 1fr; gap: 4px 20px; padding: 13px 4px; text-decoration: none; color: var(--ink); }
.index a:hover b { text-decoration: underline; }
.index b { color: var(--ai); }
.index span { color: var(--muted); font-size: 15px; }
@media (max-width: 560px) { .index a { grid-template-columns: 1fr; gap: 0; } }

/* トップの見出し */
.hero { padding: 34px 0 4px; }
.hero h1 { font-size: clamp(28px, 6.4vw, 44px); line-height: 1.35; margin: 0 0 12px; letter-spacing: .03em; }
.hero p { color: var(--muted); margin: 0; max-width: 34em; }

details { border-bottom: 1px solid var(--rule); padding: 10px 2px; }
details:first-of-type { border-top: 1px solid var(--rule); }
summary { font-weight: 700; cursor: pointer; }
details p { margin: 8px 0 2px; color: var(--muted); }
footer.site { margin-top: 56px; border-top: 1px solid var(--rule); font-size: 13px; color: var(--muted); }
footer.site .wrap { padding-top: 18px; padding-bottom: 28px; }
footer.site a { color: var(--muted); margin-right: 14px; display: inline-block; }

/* 請求書の明細入力 */
.items { width: 100%; border-collapse: collapse; }
.items th { font-size: 13px; text-align: left; color: var(--muted); padding: 4px; font-weight: 400; }
.items td { padding: 3px; vertical-align: top; }
.items td input, .items td select { padding: 7px; }
.items .del { margin: 0; padding: 7px 11px; background: transparent; color: var(--muted); border: 1px solid var(--rule); }
@media (max-width: 640px) {
  .items thead { display: none; }
  .items tr { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--rule); }
  .items td:first-child { grid-column: 1 / -1; }
}

/* 請求書プレビュー(印刷対象)。紙の書類なので常に白地 */
#doc { background: #fff; color: #111; padding: 36px; border: 1px solid var(--rule); margin-top: 22px; font-family: var(--serif); font-size: 13px; line-height: 1.6; overflow-x: auto; }
#doc h2.dtitle { text-align: center; font-size: 24px; letter-spacing: .4em; border: 0; margin: 0 0 18px; color: #111; }
#doc .dhead { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
#doc .to { font-size: 17px; border-bottom: 1px solid #111; padding-bottom: 2px; min-width: 220px; }
#doc .from { text-align: right; white-space: pre-wrap; }
#doc .total { font-size: 18px; margin: 18px 0; border-bottom: 3px double #111; display: inline-block; padding: 0 4px; }
#doc table { width: 100%; border-collapse: collapse; margin-top: 8px; font-family: var(--sans); font-variant-numeric: tabular-nums; }
#doc th, #doc td { border: 1px solid #888; padding: 5px 7px; }
#doc th { background: #eee; }
#doc .sum th { white-space: nowrap; text-align: left; }
#doc td.n { text-align: right; white-space: nowrap; }
#doc .sum { width: auto; margin-left: auto; margin-top: 10px; min-width: 300px; }
#doc .memo { margin-top: 16px; white-space: pre-wrap; }
@media (max-width: 560px) {
  .sheet { padding: 16px 14px; }
  #doc { padding: 16px 12px; font-size: 12px; }
  #doc .sum { min-width: 0; width: 100%; }
  #doc .total { font-size: 16px; }
}
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; }
  body * { visibility: hidden; }
  #doc, #doc * { visibility: visible; }
  #doc { position: absolute; left: 0; top: 0; width: 100%; border: 0; padding: 0; margin: 0; }
}
