/* Biz Calc Tools 共通スタイル。テーマに干渉しないよう .bct-tool 配下だけに効かせる */
.bct-tool {
  --bct-accent: #1a56db;
  --bct-accent-bg: #eef3fe;
  --bct-border: #d9dee7;
  --bct-text: #1f2937;
  --bct-muted: #6b7280;
  --bct-result-bg: #f8fafc;
  box-sizing: border-box;
  max-width: 720px;
  margin: 1.5em auto;
  padding: 20px;
  border: 1px solid var(--bct-border);
  border-radius: 12px;
  background: #fff;
  color: var(--bct-text);
  font-size: 16px;
  line-height: 1.6;
}
.bct-tool *, .bct-tool *::before, .bct-tool *::after { box-sizing: border-box; }

/* JS で組み立てる前に枠の高さを確保する（CLS 対策）。値はショートコードが style 属性で渡す */
.bct-tool[style] { min-height: var(--bct-h, auto); }
@media (max-width: 799px) { .bct-tool[style] { min-height: var(--bct-h-md, var(--bct-h, auto)); } }
@media (max-width: 599px) { .bct-tool[style] { min-height: var(--bct-h-sp, var(--bct-h, auto)); } }
@media (max-width: 399px) { .bct-tool[style] { min-height: var(--bct-h-xs, var(--bct-h, auto)); } }

.bct-title { font-size: 1.15em; font-weight: 700; margin: 0 0 12px; }
.bct-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.bct-field { flex: 1 1 200px; display: flex; flex-direction: column; gap: 4px; }
.bct-field label { font-size: 0.9em; font-weight: 600; color: var(--bct-muted); }
.bct-field input[type="text"],
.bct-field input[type="number"],
.bct-field input[type="date"],
.bct-field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--bct-border);
  border-radius: 8px;
  font-size: 1.05em;
  font-family: inherit;
  background: #fff;
  color: var(--bct-text);
}
.bct-field input:focus, .bct-field select:focus {
  outline: 2px solid var(--bct-accent);
  outline-offset: 1px;
  border-color: var(--bct-accent);
}
.bct-field input[type="text"].bct-amount { text-align: right; font-variant-numeric: tabular-nums; }

/* セグメント（ラジオ） */
.bct-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.bct-seg label {
  flex: 1 1 auto;
  text-align: center;
  padding: 8px 12px;
  border: 1px solid var(--bct-border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95em;
  font-weight: 500;
  color: var(--bct-text);
  user-select: none;
}
.bct-seg input { position: absolute; opacity: 0; width: 0; height: 0; }
.bct-seg input:checked + span { color: var(--bct-accent); font-weight: 700; }
.bct-seg label:has(input:checked) { background: var(--bct-accent-bg); border-color: var(--bct-accent); }
.bct-seg label:focus-within { outline: 2px solid var(--bct-accent); outline-offset: 1px; }

.bct-check { display: flex; align-items: center; gap: 8px; font-size: 0.95em; cursor: pointer; }
.bct-check input { width: 18px; height: 18px; }

/* 結果 */
.bct-result {
  margin-top: 16px;
  padding: 16px;
  border-radius: 10px;
  background: var(--bct-result-bg);
  border: 1px solid var(--bct-border);
}
.bct-result-main { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.bct-result-main .bct-label { font-size: 0.95em; color: var(--bct-muted); font-weight: 600; }
.bct-result-main .bct-value { font-size: 1.8em; font-weight: 700; color: var(--bct-accent); font-variant-numeric: tabular-nums; }
.bct-result-sub { margin: 10px 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; font-size: 0.95em; }
.bct-result-sub li { display: contents; }
.bct-result-sub .bct-label { color: var(--bct-muted); }
.bct-result-sub .bct-value { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.bct-note { margin-top: 10px; font-size: 0.85em; color: var(--bct-muted); }
.bct-error { color: #b91c1c; font-weight: 600; }

/* ボタン */
.bct-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.bct-btn {
  padding: 8px 14px;
  border: 1px solid var(--bct-border);
  border-radius: 8px;
  background: #fff;
  color: var(--bct-text);
  font-size: 0.9em;
  cursor: pointer;
  font-family: inherit;
}
.bct-btn:hover { border-color: var(--bct-accent); color: var(--bct-accent); }
.bct-btn.bct-copied { background: var(--bct-accent-bg); border-color: var(--bct-accent); color: var(--bct-accent); }

/* 営業日ツールのカレンダー風リスト */
.bct-daylist { margin: 10px 0 0; padding: 0; list-style: none; font-size: 0.9em; max-height: 220px; overflow: auto; border-top: 1px solid var(--bct-border); }
.bct-daylist li { display: flex; justify-content: space-between; padding: 4px 6px; border-bottom: 1px solid var(--bct-border); }
.bct-daylist li.bct-off { color: var(--bct-muted); background: #fafafa; }
.bct-daylist li .bct-tag { font-size: 0.85em; }

@media (max-width: 480px) {
  .bct-tool { padding: 14px; font-size: 15px; }
  .bct-result-main .bct-value { font-size: 1.5em; }
}

/* ---------- CSV一括処理 ---------- */
.bct-batch { margin-top: 18px; border-top: 1px solid var(--bct-border); padding-top: 14px; }
.bct-batch > summary {
  cursor: pointer; font-weight: 700; font-size: 0.95em; color: var(--bct-accent);
  list-style: none; display: flex; align-items: center; gap: 6px;
}
.bct-batch > summary::-webkit-details-marker { display: none; }
.bct-batch > summary::before { content: "＋"; font-size: 0.9em; }
.bct-batch[open] > summary::before { content: "−"; }
.bct-batch > summary:hover { text-decoration: underline; text-underline-offset: 3px; }
.bct-batch-body { margin-top: 12px; }
.bct-batch-privacy {
  font-size: 0.82em; color: var(--bct-muted); background: var(--bct-result-bg);
  border-radius: 6px; padding: 8px 12px; margin-bottom: 12px;
}
.bct-batch-drop {
  border: 2px dashed var(--bct-border); border-radius: 10px; padding: 22px 16px;
  text-align: center; color: var(--bct-muted); font-size: 0.92em; cursor: pointer; background: #fff;
}
.bct-batch-drop:hover, .bct-batch-drop:focus-visible, .bct-batch-drop.is-over {
  border-color: var(--bct-accent); color: var(--bct-accent); background: var(--bct-accent-bg);
}
.bct-batch-paste {
  width: 100%; margin-top: 10px; padding: 10px 12px; border: 1px solid var(--bct-border);
  border-radius: 8px; font: inherit; font-size: 0.9em; resize: vertical; color: var(--bct-text); background: #fff;
}
.bct-batch-setup { margin-top: 12px; }
.bct-batch-opts { margin-top: 8px; font-size: 0.85em; color: var(--bct-muted); }
.bct-btn-primary { background: var(--bct-accent); border-color: var(--bct-accent); color: #fff; font-weight: 700; }
.bct-btn-primary:hover { background: var(--bct-accent); border-color: var(--bct-accent); color: #fff; opacity: 0.9; }
.bct-batch-preview { margin-top: 14px; }
.bct-batch-preview-title { font-size: 0.85em; color: var(--bct-muted); margin-bottom: 6px; font-weight: 600; }
.bct-batch-scroll { overflow-x: auto; border: 1px solid var(--bct-border); border-radius: 8px; }
.bct-batch-table { border-collapse: collapse; font-size: 0.82em; width: 100%; white-space: nowrap; }
.bct-batch-table th, .bct-batch-table td { padding: 6px 10px; border-bottom: 1px solid var(--bct-border); text-align: left; }
.bct-batch-table th { background: var(--bct-result-bg); font-weight: 700; position: sticky; top: 0; }
.bct-batch-table .is-new { background: var(--bct-accent-bg); color: var(--bct-accent); font-weight: 600; }
.bct-batch-table tr:last-child td { border-bottom: 0; }

/* 見本データ */
.bct-batch-sample { margin-bottom: 12px; }
.bct-batch-sample-details > summary {
  cursor: pointer; font-size: 0.88em; color: var(--bct-accent); list-style: none;
  display: inline-flex; align-items: center; gap: 5px; font-weight: 600;
}
.bct-batch-sample-details > summary::-webkit-details-marker { display: none; }
.bct-batch-sample-details > summary::before { content: "？"; font-size: 0.85em; }
.bct-batch-sample-details > summary:hover { text-decoration: underline; text-underline-offset: 3px; }
.bct-batch-sample-note { margin: 10px 0 8px; font-size: 0.85em; color: var(--bct-muted); line-height: 1.6; }
.bct-batch-sample-details .bct-batch-table th { position: static; }

/* ---------- ツール直下の枠（広告・案内。bct_after_tool フィルターで中身を入れたときだけ出る） ---------- */
.bct-after-tool { margin: 1.5em 0; }

/* ---------- よくある質問 ---------- */
.bct-faq-q { margin: 1.4em 0 0.4em; }
.bct-faq-a { margin: 0; }
.bct-faq-src { margin: 0.4em 0 0; font-size: 0.85em; color: var(--bct-muted, #6b7280); }

/* この計算に関する解説記事（ツールページの本文内） */
.bct-articles { margin: 2em 0; padding: 16px 18px; border: 1px solid var(--bct-border, #d9dee7); border-left: 4px solid var(--bct-accent, #1a56db); border-radius: 8px; background: #fff; }
.bct-articles-title { margin: 0 0 8px; font-weight: 700; font-size: 0.95em; }
.bct-articles ul { margin: 0; padding: 0; list-style: none; }
.bct-articles li { margin: 0; }
.bct-articles li + li { border-top: 1px solid var(--bct-border, #d9dee7); }
.bct-articles a { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; padding: 8px 0; text-decoration: none; }
.bct-articles a:hover .bct-articles-name { text-decoration: underline; }
.bct-articles-name { flex: 1 1 18em; font-weight: 600; color: var(--bct-accent, #1a56db); }
.bct-articles-date { font-size: 0.8em; color: var(--bct-muted, #6b7280); white-space: nowrap; }

/* 内訳・比較表（年末調整・手取り）：単位は見出しに書き、狭い画面では余白を詰める */
.bct-batch-table.bct-cmp th:first-child, .bct-batch-table.bct-cmp td:first-child { min-width: 7em; }
@media (max-width: 480px) {
  .bct-batch-table.bct-cmp th, .bct-batch-table.bct-cmp td { padding: 6px 5px; }
}
