/* ---- base.css ---- */
/* ひとり帳簿 — base（まめ帳場の色：藍・朱・豆のクリーム・紙） */
:root {
  --bg: #f6f3eb;
  --surface: #ffffff;
  --surface-2: #f2eee4;
  --text: #1c2333;
  --text-2: #565f72;
  --text-3: #8a90a0;
  --border: #e3ddd0;
  --border-strong: #cdc6b6;
  --primary: #1f3b6f;
  --primary-hover: #142a52;
  --primary-soft: #e6ebf4;
  --primary-ink: #ffffff;
  --accent: #d9542b;
  --accent-soft: #fbe9e2;
  --cream: #fbf1d6;
  --ok: #2f7d4f;
  --ok-soft: #e4f2e8;
  --warn: #9a5800;
  --warn-soft: #fff1d6;
  --danger: #c0262d;
  --danger-soft: #fdeceb;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(40, 32, 15, 0.06);
  --shadow: 0 1px 3px rgba(40, 32, 15, 0.07), 0 6px 16px rgba(40, 32, 15, 0.05);
  --font: system-ui, -apple-system, 'Segoe UI', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Yu Gothic UI', Meiryo, sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #10141c;
    --surface: #171c26;
    --surface-2: #1e2531;
    --text: #e8eaef;
    --text-2: #a9b0bf;
    --text-3: #7d8597;
    --border: #2b3242;
    --border-strong: #3b4456;
    --primary: #8fb0ec;
    --primary-hover: #a9c2f2;
    --primary-soft: #1d2a44;
    --primary-ink: #0c1220;
    --accent: #f08a63;
    --accent-soft: #3a2018;
    --cream: #2e2a1d;
    --ok: #5cc48d;
    --ok-soft: #14301f;
    --warn: #f0b552;
    --warn-soft: #33270f;
    --danger: #ff7b7b;
    --danger-soft: #3a1717;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 6px 16px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #10141c;
  --surface: #171c26;
  --surface-2: #1e2531;
  --text: #e8eaef;
  --text-2: #a9b0bf;
  --text-3: #7d8597;
  --border: #2b3242;
  --border-strong: #3b4456;
  --primary: #8fb0ec;
  --primary-hover: #a9c2f2;
  --primary-soft: #1d2a44;
  --primary-ink: #0c1220;
  --accent: #f08a63;
  --accent-soft: #3a2018;
  --cream: #2e2a1d;
  --ok: #5cc48d;
  --ok-soft: #14301f;
  --warn: #f0b552;
  --warn-soft: #33270f;
  --danger: #ff7b7b;
  --danger-soft: #3a1717;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
a { color: var(--primary); text-underline-offset: 2px; }
a:hover { color: var(--primary-hover); }
h1, h2, h3, h4 { line-height: 1.35; margin: 0 0 0.5em; letter-spacing: 0.01em; }
p { margin: 0 0 1em; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 16px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600; line-height: 1.2;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-ink); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { filter: brightness(0.94); background: var(--accent); color: #fff; }
.btn-ghost { background: transparent; }
.btn-link { border-color: transparent; background: transparent; color: var(--text-2); font-weight: 500; text-decoration: underline; }
.btn-link:hover { background: transparent; color: var(--danger); }
.btn-sm { min-height: 32px; padding: 5px 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { min-height: 52px; padding: 12px 26px; font-size: 16px; border-radius: 12px; }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.ib {
  width: 28px; height: 28px; display: inline-grid; place-items: center;
  border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--text-3);
  font: inherit; font-size: 14px; cursor: pointer;
}
.ib:hover { background: var(--surface-2); color: var(--text); }
.ib-del:hover { color: var(--danger); background: var(--danger-soft); }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  border-radius: 999px; padding: 3px 11px; font: inherit; font-size: 12.5px; cursor: pointer;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }

/* ---- form ---- */
.in {
  width: 100%; min-height: 40px; padding: 8px 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 15px; line-height: 1.4;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.in:hover { border-color: var(--text-3); }
.in:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.in::placeholder { color: var(--text-3); }
textarea.in { resize: vertical; min-height: 64px; }
select.in { padding-right: 28px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.in.num { text-align: right; font-variant-numeric: tabular-nums; }
.f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.f-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.f-label small { font-weight: 500; color: var(--text-3); font-size: 11.5px; }
.f-msg { font-size: 12px; color: var(--text-3); min-height: 0; }
.f-msg.is-error { color: var(--danger); }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
@media (max-width: 560px) {
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
}

.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border-strong); border-radius: 10px; padding: 3px; background: var(--surface-2); gap: 2px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: block; padding: 5px 12px; border-radius: 7px; font-size: 13.5px; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.seg input:checked + span { background: var(--surface); color: var(--text); font-weight: 700; box-shadow: var(--shadow-sm); }
.seg input:focus-visible + span { outline: 2px solid var(--primary); }

.tg { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; user-select: none; padding: 4px 0; }
.tg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tg-ui { width: 38px; height: 22px; border-radius: 999px; background: var(--border-strong); position: relative; flex: none; transition: background 0.15s; }
.tg-ui::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform 0.15s; }
.tg input:checked + .tg-ui { background: var(--primary); }
.tg input:checked + .tg-ui::after { transform: translateX(16px); }
.tg input:focus-visible + .tg-ui { outline: 2px solid var(--primary); outline-offset: 2px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.card-h { font-size: 15px; font-weight: 700; margin: 0 0 12px; display: flex; align-items: baseline; gap: 6px; }
.card-sub { font-size: 12.5px; font-weight: 500; color: var(--text-3); }
details.card > summary { cursor: pointer; list-style: none; margin: 0; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: '＋'; margin-left: auto; color: var(--text-3); font-weight: 400; }
details.card[open] > summary { margin-bottom: 12px; }
details.card[open] > summary::after { content: '－'; }
.sub-h { font-size: 13px; color: var(--text-2); margin: 16px 0 8px; padding-top: 12px; border-top: 1px dashed var(--border); }
.hint { font-size: 12.5px; color: var(--text-3); margin: 8px 0 0; line-height: 1.6; }
.notice { font-size: 13px; background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 12px; margin: 8px 0 0; color: var(--text-2); }
.notice b { color: var(--text); }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; border-radius: 999px; padding: 4px 12px; background: var(--surface-2); color: var(--text-2); }
.badge.is-ok { background: var(--ok-soft); color: var(--ok); }
.badge.is-warn { background: var(--warn-soft); color: var(--warn); cursor: pointer; }
.badge-details summary { list-style: none; }
.badge-details summary::-webkit-details-marker { display: none; }
.badge-details ul { list-style: none; margin: 8px 0 4px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12.5px; }
.badge-details li.ng { color: var(--warn); font-weight: 700; }
.badge-details li.ok { color: var(--text-3); }
.badge-details p { font-size: 12px; color: var(--text-3); margin: 4px 0 0; }

.hc-toasts { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 1000; pointer-events: none; width: min(92vw, 460px); }
.hc-toast { background: #1d2433; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); transition: opacity 0.4s, transform 0.4s; text-align: center; }
.hc-toast.is-ok { background: #13643f; }
.hc-toast.is-error { background: #9f1f25; }
.hc-toast.is-out { opacity: 0; transform: translateY(8px); }

dialog.hc-dialog { border: 1px solid var(--border); border-radius: 14px; padding: 0; background: var(--surface); color: var(--text); width: min(560px, 94vw); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); }
dialog.hc-dialog::backdrop { background: rgba(10, 15, 25, 0.45); }
.dlg-head { padding: 16px 20px 0; font-weight: 700; font-size: 16px; }
.dlg-body { padding: 12px 20px; }
.dlg-foot { padding: 12px 20px 16px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

.linkbtn { border: 0; background: none; padding: 0; font: inherit; font-size: 12px; font-weight: 600; color: var(--primary); text-decoration: underline; cursor: pointer; }
.callout { background: var(--warn-soft); color: var(--text); border-radius: 10px; padding: 10px 14px; font-size: 14px; margin: 0 0 10px; }
.callout b { color: var(--warn); }
.callout.is-tip { background: var(--ok-soft); }
.callout.is-tip b { color: var(--ok); }
.pct { display: inline-flex; align-items: center; gap: 6px; }
.pct .in { width: 90px; }
.pct .in-sm { width: 70px; }
.in-sm { min-height: 32px; padding: 4px 8px; font-size: 13.5px; }
.w-140 { width: 140px; }
.w-200 { width: 220px; }
.row-set { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.empty { color: var(--text-3); font-size: 14px; margin: 6px 0; }
.sep { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
.kv { width: 100%; border-collapse: collapse; font-size: 15px; }
.kv th { text-align: left; font-weight: 500; color: var(--text-2); padding: 8px 0; border-bottom: 1px solid var(--border); }
.kv td { text-align: right; font-variant-numeric: tabular-nums; font-weight: 800; padding: 8px 0; border-bottom: 1px solid var(--border); }

/* ---- site.css ---- */
/* ひとり帳簿 — サイト */
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.wrap-wide { max-width: 1440px; }
.wrap-narrow { max-width: 780px; }
@media (max-width: 560px) { .wrap { padding: 0 16px; } }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; z-index: 200; background: var(--surface); padding: 8px 12px; border-radius: 8px; }

.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); }
.hd { display: flex; align-items: center; gap: 16px; min-height: 58px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 17px; color: var(--text); text-decoration: none; letter-spacing: 0.02em; white-space: nowrap; }
.brand:hover { color: var(--text); }
.brand img { width: 28px; height: 28px; display: block; }
.nav { display: flex; align-items: center; gap: 2px; margin-left: auto; flex-wrap: wrap; }
.nav a { color: var(--text-2); text-decoration: none; font-size: 13.5px; font-weight: 600; padding: 7px 10px; border-radius: 8px; white-space: nowrap; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current='page'] { color: var(--primary); background: var(--primary-soft); }
.nav .nav-pro { color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); margin-left: 4px; }
.nav-toggle { display: none; margin-left: auto; }
@media (max-width: 1000px) {
  .nav-toggle { display: inline-flex; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px 12px 14px; flex-direction: column; align-items: stretch; box-shadow: var(--shadow); }
  .nav.is-open { display: flex; }
  .nav a { padding: 11px 12px; font-size: 15px; }
  .nav .nav-pro { margin: 6px 0 0; text-align: center; }
}

main { display: block; }
.hero-mini { padding-top: 26px; padding-bottom: 4px; }
.hero-mini h1 { font-size: clamp(21px, 3vw, 28px); font-weight: 800; margin-bottom: 6px; }
.lead { color: var(--text-2); font-size: 15px; margin-bottom: 10px; max-width: 760px; }
.pills { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.pills li { font-size: 12.5px; font-weight: 700; color: var(--ok); background: var(--ok-soft); border-radius: 999px; padding: 3px 11px; }
.pills li::before { content: '✓ '; }

.section { padding: 40px 0; }
.section-alt { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

/* 記事 */
.prose { font-size: 16px; line-height: 1.9; padding-top: 32px; padding-bottom: 48px; }
.prose h1 { font-size: clamp(24px, 3.4vw, 32px); font-weight: 800; margin-bottom: 12px; }
.prose h2 { font-size: 21px; font-weight: 800; margin: 2.2em 0 0.7em; padding-left: 12px; border-left: 4px solid var(--primary); }
.prose h3 { font-size: 17.5px; font-weight: 800; margin: 1.8em 0 0.6em; }
.prose p, .prose ul, .prose ol, .prose table, .prose figure { margin: 0 0 1.1em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: 0.25em 0; }
.prose table { width: 100%; border-collapse: collapse; font-size: 14.5px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
.prose thead th { background: var(--surface-2); }
.prose td.num, .prose th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.prose .meta { color: var(--text-3); font-size: 13.5px; margin-bottom: 1.6em; }
.prose blockquote { margin: 0 0 1.1em; padding: 10px 16px; border-left: 3px solid var(--border-strong); color: var(--text-2); background: var(--surface); border-radius: 0 8px 8px 0; }
.prose .box { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; margin: 0 0 1.4em; }
.prose .box-h { font-weight: 800; margin-bottom: 6px; }
.prose .box > :last-child { margin-bottom: 0; }
.prose .box-ok { border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); background: color-mix(in srgb, var(--ok-soft) 50%, var(--surface)); }
.prose .box-warn { border-color: color-mix(in srgb, var(--warn) 40%, var(--border)); background: color-mix(in srgb, var(--warn-soft) 60%, var(--surface)); }
.prose .cta-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 1.4em 0; }
.prose .sources { font-size: 13.5px; color: var(--text-2); }
.prose .toc { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 20px; font-size: 14.5px; }
.prose .toc ol { margin: 6px 0 0; }
.crumbs { font-size: 12.5px; color: var(--text-3); padding-top: 16px; }
.crumbs a { color: var(--text-3); }
.crumbs span { margin: 0 6px; }

.faq { margin-top: 2em; }
.faq details { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); margin-bottom: 8px; }
.faq summary { cursor: pointer; padding: 14px 18px; font-weight: 700; list-style: none; display: flex; gap: 10px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: 'Q'; color: var(--primary); font-weight: 800; }
.faq .a { padding: 0 18px 14px 40px; color: var(--text-2); font-size: 15px; }
.faq .a p:last-child { margin-bottom: 0; }

.cards-3 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.link-card { display: grid; gap: 6px; padding: 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); text-decoration: none; box-shadow: var(--shadow-sm); transition: border-color 0.15s, transform 0.15s; }
.link-card:hover { border-color: var(--primary); color: var(--text); transform: translateY(-1px); }
.link-card b { font-size: 16px; }
.link-card span { font-size: 13.5px; color: var(--text-2); line-height: 1.6; }
.link-card .tag { font-size: 11.5px; font-weight: 800; color: var(--accent); }

.ad-slot { margin: 28px auto; min-height: 0; text-align: center; }
.ad-slot:empty { display: none; }
.ad-label { display: block; font-size: 11px; color: var(--text-3); margin-bottom: 4px; }

/* Pro 紹介 */
.pro-hero { padding: 48px 0 28px; text-align: center; }
.pro-hero h1 { font-size: clamp(26px, 4vw, 40px); font-weight: 900; letter-spacing: 0.01em; }
.pro-hero .lead { margin: 0 auto 18px; }
.price { font-size: 15px; color: var(--text-2); margin-top: 10px; }
.price b { font-size: 22px; color: var(--text); }
.compare { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 12px; overflow: hidden; font-size: 14.5px; }
.compare th, .compare td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: center; }
.compare th:first-child, .compare td:first-child { text-align: left; }
.compare thead th { background: var(--surface-2); }
.compare .yes { color: var(--ok); font-weight: 800; }
.compare .no { color: var(--text-3); }
.feature-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px; }
.feature b { display: block; font-size: 15.5px; margin-bottom: 4px; }
.feature p { font-size: 14px; color: var(--text-2); margin: 0; }

.site-footer { background: var(--surface); border-top: 1px solid var(--border); margin-top: 40px; padding: 36px 0 28px; font-size: 13.5px; color: var(--text-2); }
.ft-cols { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin: 18px 0 22px; }
.ft-cols h4 { font-size: 13px; color: var(--text); margin-bottom: 8px; }
.ft-cols ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.ft-cols a { color: var(--text-2); text-decoration: none; }
.ft-cols a:hover { color: var(--primary); text-decoration: underline; }
.ft-note { font-size: 12px; color: var(--text-3); line-height: 1.7; }
.ft-copy { font-size: 12px; color: var(--text-3); margin: 0; }

/* トップ */
.top-hero { padding: 44px 0 26px; }
.eyebrow { display: inline-block; font-size: 13px; font-weight: 800; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 3px 12px; margin-bottom: 12px; }
.top-hero h1 { font-size: clamp(28px, 4.6vw, 46px); font-weight: 900; line-height: 1.25; letter-spacing: 0.01em; margin: 0 0 14px; }
.top-hero h1 em { font-style: normal; color: var(--primary); }
.top-hero .lead { font-size: 16px; max-width: 720px; }
.hero-grid { display: grid; gap: 28px; align-items: center; }
@media (min-width: 980px) { .hero-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); } }
.hero-shot { border-radius: 14px; border: 1px solid var(--border); box-shadow: 0 18px 50px rgba(40, 32, 15, 0.16); width: 100%; height: auto; display: block; }
.cta-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0 8px; }
.tool-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.tool-card { display: grid; gap: 6px; padding: 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); text-decoration: none; box-shadow: var(--shadow-sm); transition: border-color 0.15s, transform 0.15s; }
.tool-card:hover { border-color: var(--primary); color: var(--text); transform: translateY(-1px); }
.tool-card .ic { font-size: 26px; line-height: 1; }
.tool-card b { font-size: 16.5px; }
.tool-card span { font-size: 13.5px; color: var(--text-2); line-height: 1.6; }
.sec-h { font-size: 22px; font-weight: 800; margin: 0 0 6px; }
.sec-lead { color: var(--text-2); margin: 0 0 18px; }
.steps { counter-reset: st; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); list-style: none; padding: 0; margin: 0; }
.steps li { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px 16px 58px; position: relative; font-size: 14px; color: var(--text-2); }
.steps li::before { counter-increment: st; content: counter(st); position: absolute; left: 16px; top: 16px; width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: var(--primary-ink); display: grid; place-items: center; font-weight: 900; }
.steps b { display: block; color: var(--text); font-size: 15px; margin-bottom: 2px; }
.note-box { background: var(--cream); border-radius: 14px; padding: 16px 20px; font-size: 14.5px; }

/* ---- tools.css ---- */
/* ひとり帳簿 — 計算ツール */
.tool-grid { display: grid; gap: 18px; align-items: start; grid-template-columns: minmax(0, 1fr); }
.tool-form > *, .tool-result > * { min-width: 0; }
.tool-form select.in { max-width: 100%; }
@media (min-width: 960px) { .tool-grid { grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); } }
.tool-form { display: grid; gap: 12px; }
.tool-form .tg { display: flex; }
.tool-result { display: grid; gap: 14px; }
.tool-out { display: grid; gap: 12px; }
.out-h { font-weight: 800; font-size: 15px; }
.in-xl { font-size: 22px; min-height: 52px; font-weight: 700; }
.seg-lg span { padding: 8px 16px; font-size: 14.5px; }

.mcards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.mcard { position: relative; border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--surface); display: grid; gap: 4px; align-content: start; }
.mcard.is-best { border: 2px solid var(--ok); background: color-mix(in srgb, var(--ok-soft) 55%, var(--surface)); }
.mcard.is-na { opacity: 0.6; }
.mcard-badge { position: absolute; top: -10px; right: 10px; background: var(--ok); color: #fff; font-size: 11.5px; font-weight: 800; border-radius: 999px; padding: 2px 10px; }
.mcard-h { font-weight: 800; font-size: 14px; color: var(--text-2); }
.mcard-v { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; line-height: 1.25; }
.mcard-v small { font-size: 13px; margin-left: 2px; font-weight: 700; }
.mcard-v .na { font-size: 15px; color: var(--text-3); }
.mcard-r { font-size: 12.5px; color: var(--text-2); font-weight: 700; }
.mcard-n { font-size: 12px; color: var(--text-3); margin: 4px 0 0; line-height: 1.55; }
.mcard-d summary { font-size: 12px; color: var(--primary); cursor: pointer; margin-top: 4px; }
.mcard-d dl { margin: 6px 0 0; font-size: 12px; display: grid; gap: 2px; }
.mcard-d dl div { display: flex; justify-content: space-between; gap: 8px; }
.mcard-d dt { color: var(--text-3); }
.mcard-d dd { margin: 0; font-variant-numeric: tabular-nums; }

.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 13.5px; }
.bar-label { color: var(--text-2); font-weight: 700; }
.bar-track { height: 14px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; background: color-mix(in srgb, var(--primary) 55%, var(--surface)); }
.bar-row.is-cur .bar-fill { background: var(--primary); }
.bar-row.is-cur .bar-label { color: var(--text); }
.bar-value { font-variant-numeric: tabular-nums; font-weight: 800; text-align: right; white-space: nowrap; }
.bar-value small { font-weight: 500; color: var(--text-3); font-size: 11.5px; margin-left: 2px; }
@media (max-width: 520px) {
  .bar-row { grid-template-columns: 52px minmax(0, 1fr); }
  .bar-value { grid-column: 2; text-align: left; }
}

.checks { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; font-size: 14px; }

.kv td small { font-weight: 500; color: var(--text-3); font-size: 12px; margin-left: 4px; }
.kv tr.is-minus td { color: var(--danger); }
.kv tr.is-total th, .kv tr.is-total td { font-size: 18px; font-weight: 800; color: var(--text); border-bottom: 2px solid var(--text); }
.big-kv { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 6px 0 4px; }
.big-kv span { font-weight: 700; color: var(--text-2); }
.big-kv b { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
.big-kv b small { font-size: 15px; margin-left: 2px; }
.formula { font-size: 12.5px; color: var(--text-3); margin: 0; font-variant-numeric: tabular-nums; }

/* アフィリエイト */
.aff { display: grid; gap: 10px; }
.aff-h { font-weight: 800; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.pr { font-size: 10.5px; font-weight: 700; color: var(--text-3); border: 1px solid var(--border-strong); border-radius: 4px; padding: 0 5px; line-height: 1.6; }
.aff-list { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.aff-item { display: grid; gap: 4px; align-content: start; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); text-decoration: none; transition: border-color 0.15s, box-shadow 0.15s; }
.aff-item:hover { border-color: var(--primary); box-shadow: var(--shadow); color: var(--text); }
.aff-name { font-weight: 800; font-size: 14.5px; display: flex; gap: 6px; align-items: center; }
.aff-desc { font-size: 12.5px; color: var(--text-2); line-height: 1.6; }
.aff-cta { font-size: 13px; color: var(--primary); font-weight: 700; margin-top: 2px; }

.seg-wrap { display: flex; }
.memo-out { background: var(--cream); border-radius: 10px; padding: 10px 14px; font-size: 14px; margin: 6px 0 10px; color: var(--text); }
.zk-tbl .in-sm { min-width: 80px; }
.zk-tbl .in-sm.num { max-width: 120px; margin-left: auto; display: block; }
.zk-tbl th small { display: block; font-weight: 500; }
.tbl-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; color: var(--text-3); font-weight: 700; padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-ops { white-space: nowrap; text-align: right; }

/* 勘定科目さがし */
.km-search { position: sticky; top: 58px; z-index: 20; background: var(--bg); padding: 10px 0 8px; }
.km-search .in { font-size: 18px; min-height: 52px; padding-left: 44px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%238a90a0' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 14px 50%; }
.km-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.km-meta { font-size: 12.5px; color: var(--text-3); margin: 6px 0 0; }
.km-best { margin: 12px 0 4px; background: var(--surface); border: 2px solid var(--primary); border-radius: 14px; padding: 16px 18px; }
.km-best.is-x { border-color: var(--accent); }
.km-best.is-none { border-color: var(--border-strong); }
.km-best .km-q { display: block; font-size: 14px; color: var(--text-2); font-weight: 700; }
.km-best .km-a { display: block; font-size: 30px; font-weight: 900; color: var(--primary); line-height: 1.3; }
.km-best.is-x .km-a { color: var(--accent); }
.km-best p { margin: 6px 0 0; font-size: 14.5px; }
.km-best .km-tip { color: var(--text-2); font-size: 13.5px; }
.km-best .km-acc { color: var(--text-3); font-size: 12.5px; }
.km-group { margin: 22px 0 0; }
.km-group h2 { font-size: 18px; font-weight: 800; margin: 0 0 8px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; padding-left: 10px; border-left: 4px solid var(--primary); }
.km-group h2 small { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.km-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.km-item { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; display: grid; gap: 2px; align-content: start; }
.km-item b { font-size: 15px; }
.km-alias { font-size: 12px; color: var(--text-3); }
.km-note { font-size: 13px; color: var(--text-2); line-height: 1.6; }
.km-flag { justify-self: start; font-size: 11px; font-weight: 800; border-radius: 6px; padding: 0 7px; margin-top: 2px; }
.f-h { background: var(--cream); color: #7a5a12; }
.f-f { background: var(--primary-soft); color: var(--primary); }
