/*
 * 海星学園 月次決算報告 — 画面のスタイル
 *
 * 方向：理事会資料の落ち着き。紺の文字・海の青のアクセント・星の金は差し色だけ。
 * 箱と罫を減らし、細い線で区切る。数字は BIZ UDGothic（等幅）で桁をそろえる。
 * 色はすべてトークン経由（ライト／ダーク／明示テーマの3状態）。
 */
:root {
  color-scheme: light;
  --bg: #F4F6F9;
  --surface: #FFFFFF;
  --surface-2: #F7F9FB;
  --line: #E2E7EE;
  --line-strong: #C9D2DE;
  --text: #14213D;
  --muted: #5B6679;
  --faint: #8A94A6;
  --accent: #1F5F8B;
  --accent-ink: #FFFFFF;
  --accent-weak: #E8F0F7;
  --gold: #B8923A;
  --gold-weak: #F8F1E1;
  --pos: #127A55;
  --neg: #B42318;
  --warn: #9A6A12;
  --warn-weak: #FBF3E2;
  --ok-weak: #E5F3EC;
  --neg-weak: #FBEAE8;
  --shadow: 0 1px 2px rgba(20, 33, 61, .05), 0 8px 24px rgba(20, 33, 61, .06);
  --f-body: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --f-disp: "Zen Old Mincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --f-num: "BIZ UDGothic", "BIZ UDPGothic", "Yu Gothic UI", ui-monospace, monospace;
  --r: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0E141D; --surface: #151D29; --surface-2: #1A2331; --line: #263144; --line-strong: #35425A;
    --text: #E6ECF4; --muted: #9DA9BB; --faint: #6F7B8E; --accent: #7FB2DA; --accent-ink: #0B1523; --accent-weak: #1A2B3E;
    --gold: #D9B566; --gold-weak: #2A2416; --pos: #4CC38A; --neg: #FF8A80; --warn: #E7B14E; --warn-weak: #2B2413;
    --ok-weak: #13291F; --neg-weak: #2E1A19; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0E141D; --surface: #151D29; --surface-2: #1A2331; --line: #263144; --line-strong: #35425A;
  --text: #E6ECF4; --muted: #9DA9BB; --faint: #6F7B8E; --accent: #7FB2DA; --accent-ink: #0B1523; --accent-weak: #1A2B3E;
  --gold: #D9B566; --gold-weak: #2A2416; --pos: #4CC38A; --neg: #FF8A80; --warn: #E7B14E; --warn-weak: #2B2413;
  --ok-weak: #13291F; --neg-weak: #2E1A19; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--f-body); font-size: 14px; line-height: 1.65; -webkit-font-smoothing: antialiased; }
button, select, input, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- 枠 ---------- */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: 100%; }
.top {
  grid-column: 1 / -1; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px;
  padding: 12px 24px; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .star { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--text); color: var(--gold); font-size: 14px; }
.brand b { font-family: var(--f-disp); font-weight: 600; font-size: 17px; letter-spacing: .04em; white-space: nowrap; }
.brand small { color: var(--muted); font-size: 12px; white-space: nowrap; padding-left: 10px; border-left: 1px solid var(--line); }
.period { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.period label { font-size: 11px; color: var(--muted); letter-spacing: .08em; }
.period select {
  appearance: none; padding: 7px 34px 7px 14px; border: 1px solid var(--line-strong); border-radius: 999px; background-color: var(--surface);
  font-family: var(--f-num); font-weight: 700; font-size: 13px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%; background-size: 5px 5px; background-repeat: no-repeat;
}
.period .note { font-size: 12px; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.who { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.who a { color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  border-radius: 8px; padding: 7px 16px; cursor: pointer; font-weight: 700; font-size: 13px; white-space: nowrap;
  transition: border-color .15s, background .15s, color .15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); color: var(--accent-ink); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.small { padding: 4px 11px; font-size: 12px; font-weight: 500; }

/* ---------- ナビ ---------- */
.nav { position: sticky; top: 59px; align-self: start; max-height: calc(100vh - 59px); overflow: auto; padding: 18px 12px 30px; border-right: 1px solid var(--line); background: var(--surface); }
.nav h6 { margin: 18px 10px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .14em; color: var(--faint); }
.nav h6:first-child { margin-top: 0; }
.nav a { display: flex; align-items: baseline; gap: 8px; padding: 6px 10px; border-radius: 7px; color: var(--text); text-decoration: none; font-size: 13px; }
.nav a .no { min-width: 2.4em; font-family: var(--f-num); font-size: 11px; color: var(--faint); }
.nav a:hover { background: var(--surface-2); }
.nav a.on { background: var(--accent-weak); color: var(--accent); font-weight: 700; }
.nav a.on .no { color: var(--accent); }

/* ---------- 本文 ---------- */
main { min-width: 0; padding-block: 28px 64px; padding-inline: 32px; }
.ph { display: grid; gap: 4px; margin-bottom: 22px; }
.ph h1 { margin: 0; font-family: var(--f-disp); font-weight: 600; font-size: 26px; line-height: 1.3; letter-spacing: .03em; text-wrap: balance; }
.ph h1 .no { display: inline-block; margin-right: .55em; font-family: var(--f-num); font-weight: 700; font-size: 15px; color: var(--gold); vertical-align: 3px; letter-spacing: 0; }
.ph p { margin: 0; color: var(--muted); font-size: 13px; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.stack { display: grid; gap: 18px; min-width: 0; }
.panel { min-width: 0; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.panel h2 { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; margin: 0 0 12px; font-size: 14px; font-weight: 700; }
.panel h2 small { font-weight: 400; color: var(--muted); font-size: 12px; }
details.panel summary { list-style: none; }
details.panel summary::-webkit-details-marker { display: none; }
details.panel summary::after { content: "＋"; float: right; color: var(--muted); }
details.panel[open] summary::after { content: "－"; }
.note { color: var(--muted); font-size: 12px; }
.empty { color: var(--muted); font-size: 13px; padding: 6px 0; }
.flash { margin: 0 0 16px; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; }
.flash.error { border-color: color-mix(in srgb, var(--neg) 40%, transparent); background: var(--neg-weak); }
.flash.success { border-color: color-mix(in srgb, var(--pos) 40%, transparent); background: var(--ok-weak); }

/* ---------- タイル ---------- */
/* 区切り線は gap の 1px で描く（列数が変わっても線がそろう） */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.tile { padding: 16px 18px; background: var(--surface); }
@media (max-width: 1320px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile .k { font-size: 12px; color: var(--muted); }
.tile .v { margin: 4px 0 6px; font-family: var(--f-num); font-weight: 700; font-size: 24px; line-height: 1.2; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.tile .v small { color: var(--muted); }
.tile .v.neg { color: var(--neg); }
.tile .s { font-size: 12px; color: var(--muted); }

/* ---------- 表 ---------- */
.tw { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-family: var(--f-num); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.t th, .t td { padding: 7px 10px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.t thead th {
  position: sticky; top: 0; z-index: 1; text-align: right; background: var(--surface);
  font-family: var(--f-body); font-weight: 700; font-size: 11px; color: var(--muted); letter-spacing: .06em;
  border-bottom: 1px solid var(--line-strong);
}
.t thead th:first-child, .t td:first-child { position: sticky; left: 0; text-align: left; background: var(--surface); font-family: var(--f-body); }
.t thead th:first-child { z-index: 2; }
.t td { text-align: right; }
.t td.neg { color: var(--neg); }
.t td.b { font-weight: 700; }
.t td.lbl2 { color: var(--muted); font-family: var(--f-body); text-align: left; }
.t tbody tr:last-child td { border-bottom: 0; }
.t tr.tot td { font-weight: 700; border-top: 1.5px solid var(--text); background: var(--surface); }
.t tr.dif td, .t tr.dif td:first-child { font-weight: 700; background: var(--surface-2); }
.t tr.sub td:first-child { padding-left: 24px; color: var(--muted); }
.t tr.grp td { padding-top: 14px; font-family: var(--f-body); font-size: 11px; font-weight: 700; letter-spacing: .1em; color: var(--faint); text-align: left; }
.t tr.cash td, .t tr.cash td:first-child { background: var(--gold-weak); }
.t td.plan { color: var(--muted); background: repeating-linear-gradient(135deg, transparent 0 7px, color-mix(in srgb, var(--line) 55%, transparent) 7px 8px); }
.t th.plan { color: var(--gold); }
.t tr.click { cursor: pointer; }
.t tr.click:hover td, .t tr.click:hover td:first-child { background: var(--accent-weak); }

.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-family: var(--f-num); font-size: 11px; font-weight: 700; white-space: nowrap; }
.pill.up { background: var(--ok-weak); color: var(--pos); }
.pill.down { background: var(--neg-weak); color: var(--neg); }
.pill.flat { background: var(--surface-2); color: var(--muted); }

/* ---------- コメント ---------- */
.side { position: sticky; top: 82px; max-height: calc(100vh - 96px); overflow-y: auto; }
.side .panel { padding: 18px; }
.cm { display: grid; gap: 14px; }
.cm .f label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 5px; font-size: 12.5px; font-weight: 700; }
.cm .f label span { font-size: 11px; font-weight: 500; color: var(--faint); }
.cm textarea, .t textarea {
  width: 100%; min-height: 96px; resize: vertical; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface-2); line-height: 1.65; font-size: 13px; font-family: var(--f-body); transition: border-color .15s, background .15s;
}
.cm textarea:focus, .t textarea:focus { background: var(--surface); border-color: var(--accent); outline: none; }
.cm textarea.edited, .t textarea.edited { border-color: var(--gold); background: var(--gold-weak); }
/* コメント欄を隠す（重点課題のページは入力欄が本体なので隠さない） */
html.cm-off .cmside:not([data-page="issues"]) { display: none; }
html.cm-off .grid:has(> .cmside:not([data-page="issues"])) { grid-template-columns: minmax(0, 1fr); }
.side .hint { margin: 12px 0 0; font-size: 11.5px; color: var(--muted); }

/* ---------- データと検算 ---------- */
.drop { display: grid; justify-items: center; gap: 6px; padding: 26px 20px; text-align: center; border: 1.5px dashed var(--line-strong); border-radius: var(--r); background: var(--surface); transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--accent); background: var(--accent-weak); }
.drop b { font-family: var(--f-disp); font-size: 18px; font-weight: 600; }
.drop p { max-width: 36em; margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.drop .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.progress { font-size: 12px; color: var(--muted); }
.files { display: grid; }
.fi { display: grid; grid-template-columns: 76px 1fr auto; gap: 2px 14px; align-items: baseline; padding: 11px 2px; border-bottom: 1px solid var(--line); }
.fi:last-child { border-bottom: 0; }
.fi .st { grid-row: 1 / 3; align-self: start; justify-self: start; margin-top: 2px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--surface-2); color: var(--faint); }
.fi .st::before { content: "任意"; }
.fi.ok .st { background: var(--ok-weak); color: var(--pos); }
.fi.ok .st::before { content: "読込済"; }
.fi.warn .st { background: var(--warn-weak); color: var(--warn); }
.fi.warn .st::before { content: "未読込"; }
.fi.need .st { background: var(--neg-weak); color: var(--neg); }
.fi.need .st::before { content: "必要"; }
.fi .nm { font-weight: 700; font-size: 13.5px; }
.fi .tag { font-size: 11px; color: var(--faint); }
.fi .ds { grid-column: 2 / 4; font-size: 12px; color: var(--muted); word-break: break-all; }
.checks { display: grid; gap: 10px; }
.ck { display: grid; grid-template-columns: 22px 1fr; gap: 10px; font-size: 13px; align-items: start; }
.ck i { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-style: normal; font-weight: 700; font-size: 12px; }
.ck.ok i { background: var(--ok-weak); color: var(--pos); }
.ck.ng i { background: var(--neg-weak); color: var(--neg); }
.ck.info i { background: var(--surface-2); color: var(--muted); }
.ck small { display: block; color: var(--muted); font-size: 12px; }
.steps { display: grid; gap: 6px; margin: 0; padding-left: 1.3em; font-size: 13px; }
.steps li::marker { font-family: var(--f-num); color: var(--gold); font-weight: 700; }

/* ---------- 決算予測 ---------- */
.chart svg { display: block; width: 100%; height: auto; }
.chart text { fill: var(--muted); font-family: var(--f-num); font-size: 11px; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin: 10px 0 0; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 2px; vertical-align: -1px; }
.fc { display: grid; grid-template-columns: auto 1fr; margin: 0; font-size: 14px; }
.fc dt, .fc dd { padding: 10px 4px; border-bottom: 1px solid var(--line); }
.fc dt { color: var(--muted); }
.fc dd { margin: 0; text-align: right; font-family: var(--f-num); font-weight: 700; font-variant-numeric: tabular-nums; }
.fc .hl { background: var(--gold-weak); font-size: 16px; }
.fc dd.neg { color: var(--neg); }

/* ---------- 部品 ---------- */
.seg { display: inline-flex; padding: 2px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; padding: 4px 13px; border-radius: 999px; cursor: pointer; font-size: 12px; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); font-weight: 700; box-shadow: 0 1px 2px rgba(20, 33, 61, .12); }
.toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60; max-width: calc(100% - 32px); padding: 10px 18px; border-radius: 999px; background: var(--text); color: var(--bg); font-size: 13px; box-shadow: var(--shadow); }
.ov { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; background: rgba(12, 20, 36, .42); backdrop-filter: blur(2px); }
.dlg { display: flex; flex-direction: column; width: 100%; max-width: 1000px; max-height: 84vh; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.dlg header { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.dlg header b { font-family: var(--f-disp); font-size: 17px; font-weight: 600; }
.dlg header .sp { margin-left: auto; }
.dlg .body { overflow: auto; padding: 8px 18px 18px; }
code.tok { display: block; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); font-family: var(--f-num); font-size: 12px; word-break: break-all; }

/* ---------- フォーム・ログイン ---------- */
.form { display: grid; gap: 10px; max-width: 520px; }
.form label, .login label { font-size: 12px; color: var(--muted); }
.login input, .form input, .form select { width: 100%; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); }
.login input:focus, .form input:focus, .form select:focus { border-color: var(--accent); outline: none; }
.login { display: grid; gap: 16px; max-width: 380px; margin: 12vh auto; padding-inline: 16px; }
.login .brand { justify-content: center; }
.login .panel { display: grid; gap: 6px; padding: 26px 24px; box-shadow: var(--shadow); }
.login .panel label { margin-top: 8px; }

/* ---------- 狭い画面 ---------- */
@media (max-width: 1100px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; max-height: none; overflow: visible; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .top { padding: 10px 16px; }
  .actions { margin-left: 0; }
  .brand small { display: none; }
  .nav { position: static; display: flex; gap: 4px; max-height: none; overflow-x: auto; padding: 8px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav h6 { display: none; }
  .nav a { white-space: nowrap; }
  main { padding-inline: 16px; }
  .tiles { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- 予算・前期比較表（単月と累計の境に縦の罫線） ---------- */
.t th.bl, .t td.bl { border-left: 1.5px solid var(--line-strong); }
.t tr.band th { text-align: center; padding-block: 6px 2px; border-bottom: 0; font-size: 11px; letter-spacing: .3em; color: var(--text); }
.t tr.band th.bl { border-left: 1.5px solid var(--line-strong); }
.t.cfb thead tr:not(.band) th { font-size: 10.5px; letter-spacing: .02em; }

/* ---------- 月別の内訳（収入明細をクリックしたとき） ---------- */
.dlg.wide { max-width: min(1500px, 96vw); }
.t.mg th, .t.mg td { vertical-align: top; }
.t.mg thead th { text-align: center; }
.t.mg tr.mg-total td { border-top: 0; border-bottom: 1.5px solid var(--text); }
.t.mg td.mg-name { font-weight: 700; vertical-align: middle; background: var(--surface); border-right: 1px solid var(--line); }
.t.mg tr.mg-sum td { font-weight: 700; border-bottom: 0; padding-bottom: 2px; }
.t.mg tr.mg-lines td { min-width: 190px; max-width: 260px; white-space: normal; text-align: left; font-family: var(--f-body); border-left: 1px solid var(--line); }
.t.mg tr.mg-lines td:first-child { border-left: 0; }
.mg-l { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; font-size: 12px; line-height: 1.5; border-bottom: 1px dotted var(--line); }
.mg-l:last-child { border-bottom: 0; }
.mg-l em { flex: none; font-style: normal; font-family: var(--f-num); color: var(--muted); }
.mg-l em.neg { color: var(--neg); }

/* ---------- 当期・前期比較（内容ごとに当期を上・前期を下） ---------- */
.t.mc td { vertical-align: top; }
.t.mc tr.mc-cur td:not(.mg-name) { border-top: 1px solid var(--line-strong); }
.t.mc tr.mc-prev td { background: var(--surface-2); border-bottom: 1px solid var(--line-strong); }
.t.mc tr.mc-prev td.mg-name { background: var(--surface); }
.t.mc tr.mc-diff td { font-weight: 700; border-bottom: 1.5px solid var(--text); }
.t.mc tr.mc-lines td:not(.mg-name):not(.lbl2) { min-width: 190px; max-width: 260px; white-space: normal; text-align: left; font-family: var(--f-body); }
.t.mc tr.mc-lines td.b { text-align: right; font-family: var(--f-num); min-width: 0; }
.mc-t { text-align: right; font-family: var(--f-num); font-weight: 700; padding-bottom: 2px; }
.mc-t.neg { color: var(--neg); }

.mg-l .mg-n { margin-left: 4px; color: var(--faint); font-size: 11px; }

/* ---------- 仕訳の窓：前後の項目への移動 ---------- */
.dlg .dnav { align-items: center; }
.dlg .dnav button:disabled { opacity: .35; cursor: default; }
.dlg .dnav .pos { padding: 0 8px; font-family: var(--f-num); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.t tr.cur-row td, .t tr.cur-row td:first-child { background: var(--gold-weak); }

/* ---------- 収入明細の内訳：大項目（科目）の下に当期・前期 ---------- */
.t tr.sub-h td { padding-top: 10px; padding-bottom: 2px; font-family: var(--f-body); font-weight: 700; text-align: left; border-bottom: 0; }
.t tr.sub-c td:first-child, .t tr.sub-p td:first-child { padding-left: 30px; color: var(--muted); }
.t tr.sub-c td { border-bottom: 0; }
.t tr.sub-p td { color: var(--muted); }
.t tr.sub-p td.neg { color: var(--neg); }

/* ======================================================================
 * 経営ダッシュボード（色はアプリ全体と同じ：海の青＝収入・実績、星の金＝支出・計画、緑＝良い、赤＝悪い）
 * ====================================================================== */
.dash { display: grid; gap: 18px; }
.dash-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.dash .chart svg { display: block; width: 100%; height: auto; }
.dash .chart text { font-family: var(--f-num); font-size: 11px; fill: var(--muted); }
.dash .chart .lab { font-family: var(--f-body); font-size: 12.5px; font-weight: 700; fill: var(--text); }
.dash .chart .val { font-size: 11.5px; font-weight: 700; fill: var(--text); }
.dash .chart .val.dim { fill: var(--faint); font-weight: 400; }
.dash .chart .val.warn, .dash .chart .thr-t { fill: var(--gold); }
.dash .chart .grid { stroke: var(--line); stroke-width: 1; }
.dash .chart .ax0 { stroke: var(--line-strong); stroke-width: 1.5; }
.dash h3 { margin: 0 0 4px; font-size: 12.5px; color: var(--muted); }
.dash .legend i.s-a { background: var(--accent); } .dash .legend i.s-b { background: #6FA3C9; } .dash .legend i.s-c { background: var(--line-strong); }
.dash .fchart.exp ~ .legend i.s-a { background: var(--gold); } .dash .fchart.exp ~ .legend i.s-b { background: #D8BE84; }
.dash .legend i.ln { height: 2px; width: 14px; background: var(--text); vertical-align: 3px; }

/* ① 今月の要点 */
.dash-points ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.dash-points li { display: grid; grid-template-columns: 64px 1fr; align-items: baseline; gap: 12px; font-size: 14.5px; }
.dash-points .tag { justify-self: start; padding: 2px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.dash-points li.good .tag { background: var(--ok-weak); color: var(--pos); }
.dash-points li.warn .tag { background: var(--warn-weak); color: var(--warn); }
.dash-points li.act .tag { background: var(--neg-weak); color: var(--neg); }

/* ② KPIカード */
.dash-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; background: var(--surface); }
.kpi-h { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.kpi-v { font-family: var(--f-num); font-weight: 700; font-size: 26px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi-v small { margin-left: 3px; font-size: 12px; font-weight: 400; color: var(--muted); }
.kpi-v.neg { color: var(--neg); } .kpi-v.warn { color: var(--gold); }
.kpi dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 6px 0 0; font-size: 12px; }
.kpi dt { color: var(--muted); } .kpi dd { margin: 0; text-align: right; font-family: var(--f-num); font-variant-numeric: tabular-nums; }
.kpi .neg { color: var(--neg); } .kpi .warn { color: var(--gold); font-weight: 700; } .kpi .na { color: var(--faint); }
.kpi-f { margin: auto 0 0; padding-top: 6px; font-size: 10.5px; color: var(--faint); line-height: 1.5; }

/* ③ 部門別 */
.dchart .bar-cur.neg { fill: var(--neg); } .dchart .bar-cur.pos { fill: var(--pos); }
.dchart .bar-prev.neg { fill: color-mix(in srgb, var(--neg) 30%, transparent); } .dchart .bar-prev.pos { fill: color-mix(in srgb, var(--pos) 30%, transparent); }
.dash .t .neg { color: var(--neg); }
.dash .t td.wrap { white-space: normal; min-width: 180px; font-size: 12px; }

/* ④ 予算の進み具合 */
.bchart .track { fill: var(--surface-2); stroke: var(--line); }
.bchart .bar-inc { fill: var(--accent); } .bchart .bar-exp { fill: #6FA3C9; }
.bchart .bar-inc.warn, .bchart .bar-exp.warn { fill: var(--gold); }
.bchart .mark { stroke: var(--text); stroke-width: 2; }

/* ⑤ 資金繰り */
.cchart .planzone { fill: color-mix(in srgb, var(--line) 35%, transparent); }
.cchart .thr { stroke: var(--gold); stroke-width: 1.5; stroke-dasharray: 6 4; }
.cchart .ln-act, .cchart .ln-plan { fill: none; stroke: var(--accent); stroke-width: 2.6; }
.cchart .ln-plan { stroke-dasharray: 6 4; stroke-width: 2; }
.cchart .ln-bud { fill: none; stroke: var(--faint); stroke-width: 1.8; }
.cchart .pt { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.cchart .pt.low { stroke: var(--neg); fill: var(--neg-weak); }
.cchart .pt.now { fill: var(--accent); }
.dash-fc { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 10px 0 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.dash-fc dt { grid-row: 1; padding: 6px 10px 0; font-size: 11px; color: var(--muted); background: var(--surface-2); }
.dash-fc dd { grid-row: 2; margin: 0; padding: 2px 10px 8px; font-family: var(--f-num); font-weight: 700; font-size: 14px; text-align: right; background: var(--surface-2); }
.dash-fc dd.hl, .dash-fc dt:nth-of-type(4) { background: var(--gold-weak); }

/* ⑥ 月次の収入と支出 */
.dash-flow { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.fchart .s-a { fill: var(--accent); } .fchart .s-b { fill: #6FA3C9; } .fchart .s-c { fill: var(--line-strong); }
.fchart.exp .s-a { fill: var(--gold); } .fchart.exp .s-b { fill: #D8BE84; }
.fchart .ln-prev { fill: none; stroke: var(--text); stroke-width: 1.6; }
.fchart .pt-prev { fill: var(--text); }

/* ⑦ 学園の体力 */
.dash-sp { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.sp-h { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; }
.sp-h span { font-size: 10.5px; color: var(--faint); }
.sp-v { font-family: var(--f-num); font-weight: 700; font-size: 20px; }
.sp-v small { margin-left: 6px; font-size: 11px; font-weight: 400; color: var(--muted); }
.spchart .sp-line { fill: none; stroke-width: 2; } .spchart .sp-line.good { stroke: var(--pos); } .spchart .sp-line.bad { stroke: var(--neg); }
.spchart .sp-area.good { fill: color-mix(in srgb, var(--pos) 10%, transparent); } .spchart .sp-area.bad { fill: color-mix(in srgb, var(--neg) 10%, transparent); }
.spchart .sp-pt.good { fill: var(--pos); } .spchart .sp-pt.bad { fill: var(--neg); }

@media (max-width: 1320px) { .dash-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .dash-2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .dash-kpis { grid-template-columns: 1fr 1fr; } .dash-fc { grid-template-columns: 1fr 1fr; } }
