:root {
  --bg: #f7f8fa; --card: #ffffff; --text: #1f2933; --muted: #5f6b7a;
  --accent: #2f6fb3; --border: #d9dee5; --ok: #e8f2fc;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #15191e; --card: #1f252c; --text: #e6e9ed; --muted: #a2adba; --accent: #7fb3ea; --border: #36404b; --ok: #1d2c3c; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: system-ui, "Hiragino Sans", "Yu Gothic UI", sans-serif; line-height: 1.75; }
header, main, footer { max-width: 760px; margin: 0 auto; padding: 0 16px; }
header { padding-top: 16px; }
header a.site { color: var(--text); font-weight: 700; text-decoration: none; }
nav.crumb { font-size: .85rem; color: var(--muted); }
h1 { font-size: 1.5rem; line-height: 1.4; }
h2 { font-size: 1.2rem; margin-top: 2rem; border-left: 4px solid var(--accent); padding-left: .5rem; }
a { color: var(--accent); }
.card > h2:first-child { margin-top: 0; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin: 16px 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
label { font-size: .9rem; color: var(--muted); }
input, select, button { font: inherit; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--card); color: var(--text); }
select { max-width: 100%; }
input[type=number] { width: 3.6em; }
input[type=number].y { width: 5em; }
.row > label:first-child { flex-basis: 100%; margin-bottom: -4px; }
.f { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
button { background: var(--accent); color: #fff; border: none; cursor: pointer; }
.result { background: var(--ok); border-radius: 8px; padding: 10px 12px; margin-top: 8px; min-height: 1.75em; font-weight: 600; }
.result.err { font-weight: 400; color: var(--muted); }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { border: 1px solid var(--border); padding: 4px 8px; text-align: left; }
#hayami th, #hayami td:nth-child(3), #hayami td:nth-child(4) { white-space: nowrap; }
#hayami td:nth-child(2) { white-space: pre-line; }
th { background: var(--ok); }
.table-wrap { overflow-x: auto; }
footer { margin-top: 48px; padding-bottom: 32px; font-size: .85rem; color: var(--muted); }
ul.tools li { margin: 6px 0; }
.note { font-size: .85rem; color: var(--muted); margin: 6px 0 0; }
.row.opts > label:first-child { flex-basis: auto; margin-bottom: 0; }
h3 { font-size: 1rem; margin: 1.2rem 0 0; }
input.amt { width: 9em; text-align: right; }
td input.amt { width: 100%; min-width: 6em; }
#sum td:not(:first-child) { text-align: right; white-space: nowrap; }
button:disabled { opacity: .5; cursor: default; }
button.del { padding: 2px 10px; }
[hidden] { display: none !important; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
nav.cats { margin: 12px 0; font-size: .95rem; }
