/* 家計シミュレーター 共通スタイル（テーマと干渉しないよう .kakei-tool 配下に限定） */
.kakei-tool {
  --kk-bg: #ffffff;
  --kk-surface: #f5f7f4;
  --kk-line: #dfe5dc;
  --kk-text: #1f2a24;
  --kk-muted: #5d6b63;
  --kk-accent: #1f7a55;
  --kk-accent-soft: #e3f1ea;
  --kk-accent-ink: #145238;
  --kk-old: #a9b5ae;
  --kk-warn-bg: #fff6e0;
  --kk-warn-line: #e9c46a;
  --kk-radius: 14px;
  margin: 2em 0;
  color: var(--kk-text);
  font-size: 16px;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
}
.kakei-tool *, .kakei-tool *::before, .kakei-tool *::after { box-sizing: border-box; }
.kakei-tool [hidden] { display: none !important; }

.kakei-tool .kk-card {
  background: var(--kk-bg);
  border: 1px solid var(--kk-line);
  border-radius: var(--kk-radius);
  padding: 24px 20px;
  box-shadow: 0 1px 2px rgba(20, 40, 30, .04), 0 8px 24px rgba(20, 40, 30, .06);
}
.kakei-tool .kk-head { margin-bottom: 20px; }
.kakei-tool .kk-eyebrow {
  display: inline-block; margin: 0 0 8px; padding: 2px 10px;
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
  color: var(--kk-accent-ink); background: var(--kk-accent-soft); border-radius: 999px;
}
.kakei-tool .kk-title { margin: 0 0 6px; padding: 0; border: 0; background: none; font-size: 24px; line-height: 1.35; color: var(--kk-text); }
.kakei-tool .kk-title::before, .kakei-tool .kk-title::after { display: none; }
.kakei-tool .kk-lead { margin: 0; font-size: 14px; color: var(--kk-muted); }

.kakei-tool fieldset.kk-field { border: 0; margin: 0 0 16px; padding: 0; min-width: 0; }
.kakei-tool .kk-field { margin: 0 0 16px; }
.kakei-tool .kk-field > label, .kakei-tool legend {
  display: block; margin-bottom: 6px; padding: 0;
  font-size: 14px; font-weight: 700; color: var(--kk-text);
}
.kakei-tool .kk-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.kakei-tool .kk-chip { position: relative; margin: 0; cursor: pointer; }
.kakei-tool .kk-chip input { position: absolute; opacity: 0; pointer-events: none; }
.kakei-tool .kk-chip span {
  display: inline-block; padding: 8px 14px; font-size: 14px; line-height: 1.4;
  border: 1px solid var(--kk-line); border-radius: 999px; background: var(--kk-bg); color: var(--kk-text);
  transition: background-color .15s, border-color .15s, color .15s;
}
.kakei-tool .kk-chip input:checked + span { background: var(--kk-accent); border-color: var(--kk-accent); color: #fff; font-weight: 700; }
.kakei-tool .kk-chip input:focus-visible + span { outline: 3px solid rgba(31, 122, 85, .35); outline-offset: 2px; }
.kakei-tool .kk-note { margin: 8px 0 0; font-size: 13px; color: var(--kk-muted); }

.kakei-tool .kk-grid { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 640px) {
  .kakei-tool .kk-card { padding: 32px; }
  .kakei-tool .kk-grid { grid-template-columns: 1fr 1fr; }
  .kakei-tool .kk-title { font-size: 28px; }
}

.kakei-tool .kk-input-unit {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--kk-line); border-radius: 10px; background: var(--kk-bg);
  padding: 0 12px; transition: border-color .15s, box-shadow .15s;
}
.kakei-tool .kk-input-unit:focus-within { border-color: var(--kk-accent); box-shadow: 0 0 0 3px rgba(31, 122, 85, .15); }
.kakei-tool .kk-input-unit input {
  flex: 1; min-width: 0; width: 100%; height: 44px; margin: 0; padding: 0;
  border: 0 !important; background: transparent !important; box-shadow: none !important; outline: none;
  font: inherit; font-size: 18px; font-weight: 700; color: var(--kk-text); text-align: right;
}
.kakei-tool .kk-input-unit span { flex: none; font-size: 14px; color: var(--kk-muted); }
.kakei-tool .kk-input-unit .kk-pre { order: -1; }
.kakei-tool .kk-input-lg input { height: 52px; font-size: 24px; }

.kakei-tool input[type="range"] {
  width: 100%; margin: 10px 0 0; padding: 0; height: 28px; background: transparent;
  accent-color: var(--kk-accent); cursor: pointer;
}

.kakei-tool .kk-monthly { padding: 16px; background: var(--kk-surface); border-radius: 12px; }
.kakei-tool .kk-monthly-top { display: flex; justify-content: space-between; align-items: baseline; }
.kakei-tool .kk-monthly-top label { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.kakei-tool .kk-link {
  margin: 0; padding: 4px 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 700; color: var(--kk-accent); text-decoration: underline; text-underline-offset: 3px;
}
.kakei-tool .kk-limit { margin: 4px 0 0; font-size: 13px; color: var(--kk-muted); }

.kakei-tool .kk-more { margin: 0 0 20px; border-top: 1px solid var(--kk-line); border-bottom: 1px solid var(--kk-line); }
.kakei-tool .kk-more summary {
  padding: 14px 0; cursor: pointer; font-size: 14px; font-weight: 700; color: var(--kk-accent-ink); list-style: none;
}
.kakei-tool .kk-more summary::-webkit-details-marker { display: none; }
.kakei-tool .kk-more summary::before { content: "＋ "; }
.kakei-tool .kk-more[open] summary::before { content: "− "; }
.kakei-tool .kk-more .kk-grid { padding-bottom: 4px; }
.kakei-tool .kk-check { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; font-size: 14px; font-weight: 700; cursor: pointer; }
.kakei-tool .kk-check input { width: 20px; height: 20px; margin: 0; accent-color: var(--kk-accent); }

.kakei-tool .kk-result {
  margin: 0 0 20px; padding: 20px; border-radius: 12px; text-align: center;
  background: var(--kk-accent); color: #fff;
}
.kakei-tool .kk-result-label { margin: 0; font-size: 14px; opacity: .9; }
.kakei-tool .kk-result-main { margin: 2px 0 0; font-size: 40px; line-height: 1.2; font-weight: 800; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.kakei-tool .kk-result-sub { margin: 4px 0 16px; font-size: 14px; opacity: .9; }
.kakei-tool .kk-stats { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 520px) { .kakei-tool .kk-stats { grid-template-columns: repeat(3, 1fr); } }
.kakei-tool .kk-stats > div { padding: 10px 12px; border-radius: 10px; background: var(--kk-surface); text-align: left; }
.kakei-tool .kk-stats span { display: block; font-size: 12px; color: var(--kk-muted); }
.kakei-tool .kk-stats strong { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.kakei-tool .kk-result .kk-stats > div { background: rgba(255, 255, 255, .14); }
.kakei-tool .kk-result .kk-stats span { color: rgba(255, 255, 255, .85); }
.kakei-tool .kk-result .kk-stats strong { color: #fff; }

.kakei-tool .kk-compare, .kakei-tool .kk-future { margin: 0 0 20px; }
.kakei-tool .kk-compare h3, .kakei-tool .kk-future h3 {
  margin: 0 0 6px; padding: 0; border: 0; background: none; font-size: 17px; line-height: 1.5; color: var(--kk-text);
}
.kakei-tool .kk-compare h3::before, .kakei-tool .kk-compare h3::after,
.kakei-tool .kk-future h3::before, .kakei-tool .kk-future h3::after { display: none; }
.kakei-tool .kk-bar-row { display: grid; grid-template-columns: 96px 1fr auto; align-items: center; gap: 10px; margin-top: 12px; }
.kakei-tool .kk-bar-name { font-size: 13px; line-height: 1.35; color: var(--kk-muted); }
.kakei-tool .kk-bar-name small { font-size: 12px; }
.kakei-tool .kk-bar { height: 14px; border-radius: 999px; background: var(--kk-surface); overflow: hidden; }
.kakei-tool .kk-bar i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--kk-old); transition: width .3s ease; }
.kakei-tool .kk-bar-new i { background: var(--kk-accent); }
.kakei-tool .kk-bar-row strong { font-size: 15px; font-variant-numeric: tabular-nums; min-width: 6.5em; text-align: right; }
.kakei-tool .kk-bar-new strong { color: var(--kk-accent-ink); }
.kakei-tool .kk-diff { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--kk-accent-soft); color: var(--kk-accent-ink); font-size: 14px; font-weight: 700; }

.kakei-tool .kk-warn { margin: 0 0 20px; padding: 12px 14px; border-left: 4px solid var(--kk-warn-line); border-radius: 8px; background: var(--kk-warn-bg); font-size: 14px; }
.kakei-tool .kk-warn p { margin: 0; }
.kakei-tool .kk-warn p + p { margin-top: 6px; }

.kakei-tool .kk-foot { padding-top: 14px; border-top: 1px solid var(--kk-line); font-size: 12px; color: var(--kk-muted); }
.kakei-tool .kk-foot p { margin: 0 0 4px; }
.kakei-tool .kk-updated { margin-top: 8px !important; }

@media (prefers-reduced-motion: reduce) {
  .kakei-tool .kk-bar i, .kakei-tool .kk-chip span { transition: none; }
}

/* ---- NISA 積立シミュレーター ---- */
.kakei-tool .kk-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 0 0 20px; padding: 4px; border-radius: 14px; background: var(--kk-surface); }
.kakei-tool .kk-tab {
  margin: 0; padding: 10px 6px; border: 0; border-radius: 10px; background: transparent; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 700; line-height: 1.35; color: var(--kk-muted); transition: background-color .15s, color .15s, box-shadow .15s;
}
.kakei-tool .kk-tab[aria-selected="true"] { background: var(--kk-bg); color: var(--kk-accent-ink); box-shadow: 0 1px 3px rgba(20, 40, 30, .12); }
.kakei-tool .kk-tab:focus-visible { outline: 3px solid rgba(31, 122, 85, .35); outline-offset: 1px; }
@media (min-width: 640px) { .kakei-tool .kk-tab { font-size: 15px; padding: 12px 8px; } }
.kakei-tool .kk-grid-3 { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 640px) { .kakei-tool .kk-grid-3 { grid-template-columns: repeat(3, 1fr); } }
.kakei-tool .kk-err { margin: 6px 0 0; font-size: 12px; color: #b42318; }
.kakei-tool input[aria-invalid="true"] { color: #b42318; }
.kakei-tool .kk-input-unit:has(input[aria-invalid="true"]) { border-color: #e5a39b; }
.kakei-tool .kk-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 20px; font-size: 13px; color: var(--kk-muted); }
.kakei-tool .kk-pill { margin: 0; padding: 5px 12px; border: 1px solid var(--kk-line); border-radius: 999px; background: var(--kk-bg); cursor: pointer; font: inherit; font-size: 13px; color: var(--kk-text); }
.kakei-tool .kk-pill:hover { border-color: var(--kk-accent); color: var(--kk-accent-ink); }

.kakei-tool .kk-chart-wrap { margin: 0 0 20px; }
.kakei-tool .kk-chart-wrap h3 { margin: 0 0 4px; padding: 0; border: 0; background: none; font-size: 17px; line-height: 1.5; color: var(--kk-text); }
.kakei-tool .kk-chart-wrap h3::before, .kakei-tool .kk-chart-wrap h3::after { display: none; }
.kakei-tool .kk-legend { display: flex; gap: 16px; margin: 0 0 8px; font-size: 12px; color: var(--kk-muted); }
.kakei-tool .kk-legend i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 3px; vertical-align: -1px; }
.kakei-tool .kk-legend .lg-p { background: #b9cbbf; }
.kakei-tool .kk-legend .lg-g { background: var(--kk-accent); }
.kakei-tool .kk-chart svg { display: block; width: 100%; height: auto; }
.kakei-tool .kk-chart .gl { stroke: var(--kk-line); stroke-width: 1; }
.kakei-tool .kk-chart .ax { fill: var(--kk-muted); font-size: 11px; font-family: inherit; }
.kakei-tool .kk-chart .bp { fill: #b9cbbf; }
.kakei-tool .kk-chart .bg { fill: var(--kk-accent); }

.kakei-tool .kk-table-wrap { overflow-x: auto; padding-bottom: 12px; }
.kakei-tool .kk-table { width: 100%; margin: 0; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.kakei-tool .kk-table th, .kakei-tool .kk-table td { padding: 8px 10px; border: 0; border-bottom: 1px solid var(--kk-line); text-align: right; white-space: nowrap; }
.kakei-tool .kk-table th { font-size: 12px; font-weight: 700; color: var(--kk-muted); background: var(--kk-surface); }
.kakei-tool .kk-table th:first-child, .kakei-tool .kk-table td:first-child { text-align: left; }

/* ---- ふるさと納税 ---- */
.kakei-tool .kk-tabs-2 { grid-template-columns: repeat(2, 1fr); }
.kakei-tool .kk-tab small { display: block; margin-top: 2px; font-size: 11px; font-weight: 600; color: var(--kk-muted); }
.kakei-tool .kk-hint { margin: 6px 0 0; font-size: 12px; line-height: 1.5; color: var(--kk-muted); }
.kakei-tool .kk-select { position: relative; }
.kakei-tool .kk-select select {
  width: 100%; height: 46px; margin: 0; padding: 0 40px 0 12px; border: 1px solid var(--kk-line); border-radius: 10px;
  background: var(--kk-bg); font: inherit; font-size: 16px; font-weight: 700; color: var(--kk-text);
  -webkit-appearance: none; appearance: none; cursor: pointer;
}
.kakei-tool .kk-select::after { content: ""; position: absolute; right: 16px; top: 50%; width: 8px; height: 8px; margin-top: -6px; border-right: 2px solid var(--kk-muted); border-bottom: 2px solid var(--kk-muted); transform: rotate(45deg); pointer-events: none; }
.kakei-tool .kk-select select:focus { outline: none; border-color: var(--kk-accent); box-shadow: 0 0 0 3px rgba(31, 122, 85, .15); }
.kakei-tool fieldset.kk-fs { margin: 0 0 16px; padding: 12px 16px 0; border: 1px solid var(--kk-line); border-radius: 12px; }
.kakei-tool .kk-fs legend { padding: 0 6px; font-size: 14px; font-weight: 800; color: var(--kk-accent-ink); }
.kakei-tool .kk-bd { margin-top: 8px; }
.kakei-tool .kk-bd-row { display: grid; grid-template-columns: 120px 1fr auto; align-items: center; gap: 10px; margin-top: 10px; }
.kakei-tool .kk-bd-name { font-size: 13px; color: var(--kk-muted); }
.kakei-tool .kk-bd-row strong { min-width: 6.5em; text-align: right; font-size: 15px; font-variant-numeric: tabular-nums; }
.kakei-tool .kk-bd-1 i { background: #b9cbbf; }
.kakei-tool .kk-bd-2 i { background: #6fa58a; }
.kakei-tool .kk-bd-3 i { background: var(--kk-accent); }
@media (max-width: 480px) { .kakei-tool .kk-bd-row { grid-template-columns: 96px 1fr auto; } }
.kakei-tool fieldset.kk-fs > .kk-note { margin: 0 0 14px; }
