/* 色と書体は start_map・seimu_katsudohi と揃えている */
:root {
  --bg: #f4f6f4; --surface: #ffffff; --ink: #16191c; --ink-2: #4c5258; --ink-3: #7a8087;
  --rule: #dfe2df; --rule-strong: #b9bdb9; --accent: #1f5f8b; --accent-soft: #e3eef6;
  --track: #eceeec; --tip-bg: #16191c; --tip-ink: #f4f6f4;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300;
  --card: var(--surface); --line: var(--rule); --ref: var(--ink-3);
  --font-display: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", sans-serif;
  --font-body: "BIZ UDPGothic", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121415; --surface: #1b1e1f; --ink: #eef0ee; --ink-2: #b8bdbf; --ink-3: #8a9094;
    --rule: #2c3133; --rule-strong: #475054; --accent: #7cb4dc; --accent-soft: #1d2c38;
    --track: #24292b; --tip-bg: #eef0ee; --tip-ink: #121415;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121415; --surface: #1b1e1f; --ink: #eef0ee; --ink-2: #b8bdbf; --ink-3: #8a9094;
  --rule: #2c3133; --rule-strong: #475054; --accent: #7cb4dc; --accent-soft: #1d2c38;
  --track: #24292b; --tip-bg: #eef0ee; --tip-ink: #121415;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.7; }
a { color: var(--accent); }
.site-header { background: var(--surface); border-bottom: 1px solid var(--rule); }
.site-header-inner { max-width: 1040px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--ink); text-decoration: none; }
.badge { font-size: 12px; color: var(--ink-2); border: 1px solid var(--rule-strong); border-radius: 999px; padding: 0 10px; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 28px 16px 40px; display: grid; gap: 32px; }
.wrap > header { display: grid; gap: 6px; }
.eyebrow { font-size: 12px; letter-spacing: .08em; color: var(--ink-3); }
h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(24px, 4vw, 32px); line-height: 1.3; margin: 0; }
h2 { font-family: var(--font-display); font-size: 20px; margin: 0; }
.lead { margin: 0; color: var(--ink-2); max-width: 50em; }
.lead b { color: var(--ink); }
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 22px; display: grid; gap: 16px; min-width: 0; }
@media (max-width: 640px) { .panel { padding: 16px; } }
.panel-head { display: grid; gap: 4px; }
.panel-head p { margin: 0; font-size: 13.5px; color: var(--ink-2); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 640px) { .stats { grid-template-columns: 1fr; gap: 8px; } .stat { padding: 10px 14px; grid-template-columns: 7.5em auto 1fr; align-items: baseline; gap: 8px; } .stat .val { font-size: 22px; } .stat .sub { font-size: 11.5px; text-align: right; } }
@media (max-width: 640px) { th, td { padding: 8px 8px; } #years-table .n { display: none; } }
.stat { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 16px 18px; display: grid; gap: 2px; }
.stat .lbl { font-size: 12.5px; color: var(--ink-3); }
.stat .val { font-family: var(--font-display); font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat .val small { font-size: 14px; font-weight: 400; color: var(--ink-2); margin-left: 2px; }
.stat .sub { font-size: 12.5px; color: var(--ink-2); }

.controls { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; position: sticky; top: 0; z-index: 20; background: var(--bg); padding: 10px 0; border-bottom: 1px solid var(--rule); }
.controls .lbl { font-size: 13px; color: var(--ink-2); }
.seg { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { font: inherit; font-size: 13.5px; border: 0; background: none; color: var(--ink-2); padding: 6px 12px; cursor: pointer; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .seg button { padding: 6px 10px; } .seg .fy { display: none; } }
.seg button + button { border-left: 1px solid var(--rule); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); font-weight: 700; }

/* 円グラフ＋凡例（凡例に金額と割合を並べ、色だけに頼らない） */
.pie { display: grid; grid-template-columns: minmax(180px, 300px) 1fr; gap: 20px 32px; align-items: center; }
@media (max-width: 640px) { .pie { grid-template-columns: 1fr; } .pie svg { max-width: 260px; margin: 0 auto; } }
.pie svg { display: block; width: 100%; height: auto; }
.pie svg path { stroke: var(--surface); stroke-width: 2; }
.pie svg path.on { opacity: .8; }
.pie svg .c1 { font-family: var(--font-body); font-size: 12px; fill: var(--ink-3); }
.pie svg .c2 { font-family: var(--font-display); font-size: 22px; font-weight: 700; fill: var(--ink); font-variant-numeric: tabular-nums; }
.pie-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.pie-legend li { display: grid; grid-template-columns: 14px 1fr auto 52px; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--rule); }
.pie-legend li:last-child { border-bottom: 0; }
.pie-legend i { width: 12px; height: 12px; border-radius: 3px; align-self: center; }
.pie-legend .v { font-weight: 700; text-align: right; }
.pie-legend .p { color: var(--ink-3); text-align: right; }
.pie-legend small { display: block; font-size: 11.5px; color: var(--ink-3); }

.scroller { overflow-x: auto; border: 1px solid var(--rule); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--rule); text-align: right; }
th:first-child, td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); }
thead th { font-size: 12px; color: var(--ink-3); font-weight: 400; }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 700; border-top: 1px solid var(--rule-strong); border-bottom: 0; }
td.na { color: var(--ink-3); text-align: left; white-space: normal; min-width: 16em; }

.more { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; padding: 16px 22px; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; font-size: 13.5px; color: var(--ink-2); }
.more a { font-weight: 700; }

.notes { font-size: 12.5px; color: var(--ink-2); display: grid; gap: 6px; max-width: 56em; }
.notes h2 { font-size: 14px; color: var(--ink); }
.notes ul { margin: 0; padding-left: 1.2em; display: grid; gap: 4px; }

#tip { position: fixed; z-index: 50; pointer-events: none; background: var(--tip-bg); color: var(--tip-ink); font-size: 12.5px; line-height: 1.6; padding: 8px 12px; border-radius: 6px; max-width: 280px; font-variant-numeric: tabular-nums; opacity: 0; transition: opacity .1s; }
#tip.on { opacity: 1; }
#tip b { display: block; margin-bottom: 2px; }
#tip .r { display: flex; justify-content: space-between; gap: 16px; }

/* ---- 財政ダッシュボード固有 ---- */
.controls select { font: inherit; font-size: 14px; padding: 6px 10px; border: 1px solid var(--rule-strong); border-radius: 8px; background: var(--surface); color: var(--ink); }
.controls .hint { font-size: 12px; color: var(--ink-3); }
.stats.four { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 860px) { .stats.four { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .stats.four { grid-template-columns: 1fr; } }
.delta { font-size: 12px; color: var(--ink-3); }

.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--ink-2); }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .base { stroke: var(--rule-strong); stroke-width: 1; }
.chart .ax { font-family: var(--font-body); font-size: 11px; fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.chart .ax.on { fill: var(--ink); font-weight: 700; }
.chart .val { font-family: var(--font-body); font-size: 11px; fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:hover, .chart .hit.on { fill: var(--ink); fill-opacity: .05; }
.chart rect.seg { stroke: var(--surface); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--s1); stroke-width: 2; }
.chart .dot { fill: var(--s1); stroke: var(--surface); stroke-width: 2; }
.chart .dot.on { r: 6; }

.multiples { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 760px) { .multiples { grid-template-columns: 1fr; } }
.mini { border: 1px solid var(--rule); border-radius: 8px; padding: 14px 16px; display: grid; gap: 6px; align-content: start; min-width: 0; }
.mini h3 { font-family: var(--font-display); font-size: 15px; margin: 0; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.mini h3 .now { font-size: 20px; font-variant-numeric: tabular-nums; }
.mini h3 .now small { font-size: 12px; font-weight: 400; color: var(--ink-2); margin-left: 2px; }
.mini p { margin: 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.7; }

.hbars { display: grid; gap: 6px; font-size: 13px; font-variant-numeric: tabular-nums; }
.hbar { display: grid; grid-template-columns: 7em 1fr 10.5em; gap: 10px; align-items: center; }
.hbar .bar { height: 14px; background: var(--track); border-radius: 0 4px 4px 0; overflow: hidden; }
.hbar .bar span { display: block; height: 100%; background: var(--s1); border-radius: 0 4px 4px 0; }
.hbar .v { text-align: right; }
.hbar .v { white-space: nowrap; }
.hbar .v small { font-size: 11px; color: var(--ink-3); margin-left: 6px; }
@media (max-width: 640px) { .hbar { grid-template-columns: 6.4em 1fr auto; gap: 8px; } .hbar .v small { display: block; margin: 0; } }

.glossary { margin: 0; display: grid; gap: 8px; font-size: 13px; }
.glossary dt { font-weight: 700; }
.glossary dd { margin: 0 0 4px; color: var(--ink-2); }

/* ---- 重点事業の予算と決算（jigyo.html） ---- */
.eyebrow a { color: var(--ink-3); }
.jlist { display: grid; gap: 8px; }
.jcard { border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); }
.jcard[open] { border-color: var(--rule-strong); }
.jcard summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 2em 1fr auto; gap: 4px 12px; align-items: center; padding: 12px 14px; }
.jcard summary::-webkit-details-marker { display: none; }
.jcard summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.jno { font-family: var(--font-display); font-weight: 700; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.jname { font-weight: 700; line-height: 1.5; }
.jname small { display: block; font-weight: 400; font-size: 12px; color: var(--ink-3); }
.jamt { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.jamt small { display: block; font-weight: 400; font-size: 11px; color: var(--ink-3); }
.tag { grid-column: 2 / 4; justify-self: start; font-size: 11.5px; border: 1px solid var(--rule-strong); border-radius: 999px; padding: 0 9px; color: var(--ink-2); }
.tag.on { border-color: var(--accent); color: var(--accent); }
.jbody { padding: 4px 16px 18px; display: grid; gap: 10px; border-top: 1px solid var(--rule); }
.jbody p { margin: 0; }
.jbody h3 { font-family: var(--font-display); font-size: 14.5px; margin: 10px 0 0; }
table.taihi { white-space: normal; font-size: 13px; }
table.taihi th, table.taihi td { text-align: left; vertical-align: top; }
table.taihi tbody th { font-weight: 700; white-space: nowrap; }
table.taihi td { min-width: 12em; }
table.taihi .na { color: var(--ink-3); }
.zbar { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; }
.small { font-size: 12.5px; color: var(--ink-2); }
.plain { margin: 0; padding-left: 0; list-style: none; font-size: 13.5px; display: grid; gap: 2px; }
.plain li { white-space: pre-line; }
.seika { font-size: 13.5px; color: var(--ink-2); border-left: 3px solid var(--rule-strong); padding-left: 10px; }
.src { font-size: 12px; color: var(--ink-3); }
@media (max-width: 640px) { .jcard summary { grid-template-columns: 1.6em 1fr auto; padding: 12px; } .jbody { padding: 4px 12px 16px; } }
table.taihi .chu { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
/* スマホ幅では予定と実績を縦に積む（3列のままだと実績の列がはみ出す） */
@media (max-width: 640px) {
  table.taihi thead { display: none; }
  table.taihi, table.taihi tbody, table.taihi tr, table.taihi th, table.taihi td { display: block; min-width: 0; }
  table.taihi tr { padding: 10px 12px; border-bottom: 1px solid var(--rule); }
  table.taihi tr:last-child { border-bottom: 0; }
  table.taihi th, table.taihi td { padding: 2px 0; border: 0; position: static; background: none; }
  table.taihi td::before { content: attr(data-l); display: inline-block; font-size: 11px; color: var(--ink-3); border: 1px solid var(--rule-strong); border-radius: 4px; padding: 0 5px; margin-right: 6px; }
}
table.taihi td { white-space: pre-line; }
table.taihi .kijun { display: block; margin-top: 6px; font-size: 12px; color: var(--ink-2); border-top: 1px dashed var(--rule); padding-top: 4px; }

/* ---- 指標カード8枚・お金の流れ（index.html） ---- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 899px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 519px) { .kpi-grid { grid-template-columns: 1fr; } }

.kpi-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.kpi-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.kpi-head h3 { font-family: var(--font-display); font-size: 16px; font-weight: 700; margin: 0; line-height: 1.3; }
.kpi-val { font-family: var(--font-display); font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; white-space: nowrap; }
.kpi-val small { font-size: 13px; font-weight: 400; color: var(--ink-2); margin-left: 2px; }

.kpi-card.overview { background: var(--s1); border-color: var(--s1); color: #ffffff; align-content: start; }
.kpi-card.overview .kpi-head { border-bottom-color: rgba(255, 255, 255, .28); }
.kpi-card.overview .kpi-year { font-size: 14px; font-weight: 700; opacity: .92; }
.kpi-card.overview { grid-template-rows: auto 1fr; }
.kpi-ov-list { display: grid; align-content: space-evenly; gap: 14px; margin: 4px 0; }
.kpi-ov-row { display: grid; gap: 2px; }
.kpi-ov-row .lbl { font-size: 14px; font-weight: 700; opacity: .92; }
.kpi-ov-row .kpi-val { font-size: 30px; text-align: right; }
.kpi-ov-row .kpi-val small { color: #ffffff; opacity: .88; }

.kpi-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 12px; color: var(--ink-2); }
.kpi-legend li { display: inline-flex; align-items: center; gap: 5px; }
.kpi-legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; flex: none; }
.kpi-legend .sw.line { width: 14px; height: 2.5px; border-radius: 2px; }
.kpi-legend .sw.dash { width: 14px; height: 0; border-top: 2px dashed var(--ref); border-radius: 0; background: none; }

.kpi-chart { min-width: 0; }
.kpi-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.kpi-chart text { font-family: var(--font-body); font-size: 12px; fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.kpi-chart text.val-lbl { fill: var(--ink); font-weight: 700; }
.kpi-chart text.ax-on { fill: var(--ink); font-weight: 700; }
.kpi-chart .grid { stroke: var(--line); stroke-width: 1; }
.kpi-chart .base { stroke: var(--rule-strong); stroke-width: 1; }
.kpi-desc { margin: 0; font-size: 13px; color: var(--ink-2); line-height: 1.55; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { font: inherit; font-size: 14px; color: var(--ink-3); font-weight: 500; background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 14px; cursor: pointer; white-space: nowrap; min-height: 40px; }
.tabs button[aria-selected="true"] { color: var(--s1); border-bottom-color: var(--s1); font-weight: 700; }

.flow-kind-note { margin: 12px 0 4px; font-size: 15px; line-height: 1.7; color: var(--ink-2); }
.flow-kind-note b { color: var(--ink); }
.flow-layout { display: grid; grid-template-columns: minmax(0, 1fr); }
.flow-sankey { min-width: 0; }
.flow-sankey svg { display: block; width: 100%; height: auto; overflow: visible; }

/* サンキー図：マウスを当てた流れ・区分を濃いグラデーションに（ほかは薄くしない。2026-11-19） */
#flow .flow-link { transition: opacity .15s; }
#flow .flow-link.on { opacity: .8; }
