/* 新デザインシステム(docs/pmf-redesign/14_・prototype/migiude-v3.html のスタイルを、そのまま再利用。トークン・コンポーネント・レスポンシブ)。
   Web 版で足したものは、末尾の「Web 版の追加」に限る。外部フォント・外部 CSS は使わない。 */
/* フォント: 外部フォントは使わない。端末の日本語フォントのスタックで、数字・記号・英字だけを local() の "Num" で桁のそろう端末フォントにする。
   右腕デザイン v3(仮称)。方針: 白と薄いグレーの面 + 深いネイビー。罫線を減らし、面の差と余白で区切る。
   状態色は 3 役割(良好=緑 / 注意=琥珀 / 重要=赤)。情報は無彩色+ネイビー。グラフ色は検証済みの 2 色(実績=青 / 予算=琥珀)+中立グレー(前年)。
   文字は 14px 未満を使わない(グラフ目盛りのみ 13px)。 */
:root {
  --bg: #f5f6f7; --surface: #ffffff; --surface-2: #eff1f3; --surface-3: #e6e9ed; --line: #e3e6ea; --line-strong: #c9cfd7;
  --text: #14202e; --text-2: #44505f; --text-3: #5b6676;
  --navy: #1c3557; --navy-ink: #ffffff; --navy-soft: #e9eff6; --navy-mid: #3d6a9e; --link: #1d4f86;
  --good: #1a7a4c; --good-soft: #e5f3ea; --caution: #7a5400; --caution-soft: #fbf0d6; --caution-line: #d8b25a; --critical: #b3261e; --critical-soft: #fdeceb; --critical-line: #e2877f;
  --c-actual: #2b6cb0; --c-budget: #b7791f; --c-budget-ink: #8a5800; --c-prior: #7c8794; --c-in: #2b6cb0; --c-out: #b7791f;
  --grid: #e6e9ed; --focus: #1d4f86; --shadow: 0 1px 2px rgba(20,32,46,.06), 0 1px 8px rgba(20,32,46,.04);
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", "Meiryo UI", "Meiryo", "Noto Sans JP", "Noto Sans CJK JP", system-ui, sans-serif;
  --font-num: "Num", var(--font);
  --r: 12px; --r-sm: 8px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e151d; --surface: #151f2a; --surface-2: #1b2735; --surface-3: #243244; --line: #263445; --line-strong: #37495d;
    --text: #e8eef5; --text-2: #bac5d2; --text-3: #98a6b6;
    --navy: #9dbde6; --navy-ink: #0e151d; --navy-soft: #1d2d42; --navy-mid: #7fa6d6; --link: #a8c8f0;
    --good: #5fc592; --good-soft: #12301f; --caution: #e3b75e; --caution-soft: #38300f; --caution-line: #8a6d2a; --critical: #ff9d95; --critical-soft: #3b1b19; --critical-line: #9b4a45;
    --c-actual: #5a8fd0; --c-budget: #bd8530; --c-budget-ink: #e3b75e; --c-prior: #8f9bab; --c-in: #5a8fd0; --c-out: #bd8530;
    --grid: #263445; --focus: #a8c8f0; --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e151d; --surface: #151f2a; --surface-2: #1b2735; --surface-3: #243244; --line: #263445; --line-strong: #37495d;
  --text: #e8eef5; --text-2: #bac5d2; --text-3: #98a6b6;
  --navy: #9dbde6; --navy-ink: #0e151d; --navy-soft: #1d2d42; --navy-mid: #7fa6d6; --link: #a8c8f0;
  --good: #5fc592; --good-soft: #12301f; --caution: #e3b75e; --caution-soft: #38300f; --caution-line: #8a6d2a; --critical: #ff9d95; --critical-soft: #3b1b19; --critical-line: #9b4a45;
  --c-actual: #5a8fd0; --c-budget: #bd8530; --c-budget-ink: #e3b75e; --c-prior: #8f9bab; --c-in: #5a8fd0; --c-out: #bd8530;
  --grid: #263445; --focus: #a8c8f0; --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
}
@font-face { font-family: "Num"; src: local("Segoe UI"), local("SF Pro Text"), local("Helvetica Neue"), local("Roboto"), local("Arial"); unicode-range: U+0020-007E; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.7; font-feature-settings: "palt" 1; padding-block: 12px 28px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.tn, .kpi .v, .mini .mv .big, .tbl table, .mix b, .tip { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 26px; line-height: 1.35; font-weight: 600; text-wrap: balance; }
h2 { font-size: 20px; line-height: 1.4; font-weight: 600; text-wrap: balance; }
h3 { font-size: 17px; line-height: 1.5; font-weight: 600; text-wrap: balance; }
.cap { font-size: 14px; line-height: 1.6; color: var(--text-2); }
.mut { color: var(--text-3); }

/* 操作盤(本番画面ではない) */
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 6px 14px; min-height: 44px; cursor: pointer; font-size: 14px; color: var(--text-2); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--navy); color: var(--navy-ink); font-weight: 600; }

.frame { max-width: 1280px; margin: 0 auto; }
.frame[data-w="phone"] { max-width: 390px; }
.app { container-type: inline-size; container-name: app; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; overflow: clip; }
.frame[data-w="phone"] .app { height: 820px; overflow-y: auto; overflow-x: hidden; }
.shell { display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: 720px; }
.side { background: var(--surface); padding: 20px 14px; display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--navy); padding: 2px 10px 18px; }
.brand i { width: 30px; height: 30px; border-radius: 9px; background: var(--navy); color: var(--navy-ink); display: grid; place-items: center; font-style: normal; font-size: 15px; }
.side .nav { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 12px; border: 0; background: transparent; border-radius: 10px; color: var(--text-2); cursor: pointer; font-size: 16px; text-align: left; width: 100%; }
.side .nav:hover { background: var(--surface-2); }
.side .nav[aria-current="page"] { background: var(--navy-soft); color: var(--navy); font-weight: 600; }
.ico { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side .sp { flex: 1; }
.main { padding: 24px 32px 40px; min-width: 0; }
.subtabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 20px; padding: 4px; background: var(--surface-2); border-radius: 12px; width: fit-content; max-width: 100%; }
.subtabs button { border: 0; background: transparent; min-height: 44px; padding: 8px 16px; border-radius: 9px; cursor: pointer; color: var(--text-2); font-size: 15px; }
.subtabs button[aria-pressed="true"] { background: var(--surface); color: var(--navy); font-weight: 600; box-shadow: var(--shadow); }

.top { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; margin-bottom: 20px; }
.top .grow { flex: 1 1 280px; min-width: 0; }
.top .hello { font-size: 14px; color: var(--text-3); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 18px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); cursor: pointer; font-size: 16px; font-weight: 500; }
.btn:hover { background: var(--surface-2); }
.btn.pri { background: var(--navy); border-color: var(--navy); color: var(--navy-ink); font-weight: 600; }
.btn.pri:hover { filter: brightness(1.1); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--link); padding-inline: 10px; }
.btn.quiet:hover { background: var(--surface-2); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 11px; min-height: 28px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 14px; white-space: nowrap; }
.chip.good { background: var(--good-soft); color: var(--good); font-weight: 600; }
.chip.caution { background: var(--caution-soft); color: var(--caution); font-weight: 600; }
.chip.critical { background: var(--critical-soft); color: var(--critical); font-weight: 600; }
.chip.navy { background: var(--navy-soft); color: var(--navy); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

.card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 22px 24px; min-width: 0; }
.card + .card { margin-top: 20px; }
.card-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 14px; }
.card-h .grow { flex: 1; }
.sec { margin-top: 28px; }
.sec > h2 { margin-bottom: 4px; }
.sec > .cap { margin-bottom: 14px; }
.g2 { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 24px; align-items: start; }
.g2e { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.g2e.eq { align-items: stretch; }
.kpis3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mini { background: var(--surface-2); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mini .mh { font-size: 14px; color: var(--text-2); min-height: 44px; }
.mini .mv { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; }
.mini .mv .big { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mini .mv .big small { font-size: 16px; font-weight: 500; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* 重大な警告(別枠) */
.notices { display: grid; gap: 10px; margin-bottom: 20px; }
.notice { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px 14px; align-items: center; padding: 14px 18px; border-radius: var(--r); background: var(--critical-soft); border: 2px solid var(--critical-line); }
.notice .ni { width: 28px; height: 28px; border-radius: 50%; background: var(--critical); color: var(--surface); display: grid; place-items: center; font-weight: 700; font-size: 16px; }
.notice b { color: var(--critical); }
.notice p { font-size: 15px; color: var(--text); }
.notice .cat { font-size: 14px; color: var(--text-2); }

/* 次の一手 */
.na { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px 20px; display: grid; gap: 10px; }
.na + .na { margin-top: 12px; }
.na[data-sev="critical"] { border: 2px solid var(--critical-line); padding: 17px 19px; }
.na-top { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 14px; color: var(--text-2); }
.na-top .due { margin-left: auto; color: var(--text); font-weight: 600; }
.na h3 { font-size: 18px; }
.na .why { font-size: 15px; color: var(--text-2); }
.effect { font-size: 15px; display: flex; gap: 8px; align-items: baseline; }
.effect .lab { font-size: 14px; color: var(--text-3); white-space: nowrap; }
.uncert { font-size: 14px; background: var(--caution-soft); color: var(--text); border-radius: 8px; padding: 8px 12px; }
.uncert b { color: var(--caution); }
.ev { display: grid; gap: 4px; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; font-size: 14px; }
.ev div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; }
.ev .v { font-weight: 600; text-align: right; }
.ev .s { grid-column: 1 / -1; color: var(--text-3); }
.na-act { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.na .detail { display: none; }
.na.open .detail { display: grid; gap: 10px; }
.collapsed { background: var(--surface-2); border-radius: var(--r); padding: 12px 16px; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 14px; color: var(--text-2); }

/* KPI タイル */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.kpi { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px 18px; text-align: left; border: 0; cursor: pointer; display: grid; gap: 2px; min-width: 0; min-height: 44px; }
.kpi:hover { background: var(--surface-2); }
.kpi .l { font-size: 14px; color: var(--text-2); }
.kpi .v { font-size: 32px; line-height: 1.25; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi .v small { font-size: 16px; font-weight: 500; color: var(--text-2); margin-left: 3px; }
.kpi .d { font-size: 14px; display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: center; }
.kpi .src { font-size: 14px; color: var(--text-3); }
.kpi .sv { margin-top: 6px; }
.kpi.na .v { font-size: 20px; color: var(--text-2); font-weight: 500; }
.dl-good { color: var(--good); font-weight: 600; }
.dl-bad { color: var(--critical); font-weight: 600; }
.dl-flat { color: var(--text-2); font-weight: 600; }

/* チャート枠 */
.cf { display: grid; gap: 12px; }
.cf-h { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.cf-h h3 { flex: 1 1 220px; }
.take { font-size: 16px; line-height: 1.6; background: var(--navy-soft); border-radius: 10px; padding: 10px 14px; color: var(--text); }
.take b { color: var(--navy); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 14px; color: var(--text-2); align-items: center; }
.sw { display: inline-block; width: 14px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: 0; }
.sw.line { height: 3px; border-radius: 2px; vertical-align: 3px; }
.sw.dash { height: 0; border-top: 3px dashed var(--c-prior); background: transparent; vertical-align: 3px; }
.sw.hatch { background: repeating-linear-gradient(45deg, var(--line-strong) 0 3px, transparent 3px 6px); border: 1px solid var(--line-strong); }
.chart { width: 100%; min-width: 0; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--font-num); fill: var(--text-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.chart text.lbl { font-size: 14px; fill: var(--text); font-weight: 600; }
.chart text.mute { fill: var(--text-3); }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--line-strong); stroke-width: 1; }
.chart .mk { cursor: pointer; }
.chart .mk:hover, .chart .mk:focus-visible { filter: brightness(1.12); outline: none; }
.tbl { overflow-x: auto; }
.tbl table { border-collapse: collapse; width: 100%; font-size: 14px; }
.tbl th, .tbl td { text-align: right; padding: 6px 10px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); }
.tbl th { color: var(--text-3); font-weight: 500; }
details.tv > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--link); font-size: 14px; }
.empty { background: var(--surface-2); border-radius: 10px; padding: 22px; text-align: left; color: var(--text-2); display: grid; gap: 10px; justify-items: start; }
.empty b { color: var(--text); }
.tip { position: fixed; z-index: 60; pointer-events: none; background: var(--text); color: var(--bg); font-size: 14px; line-height: 1.5; padding: 8px 12px; border-radius: 8px; max-width: 260px; box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.tip[hidden] { display: none; }

/* データの状態 */
.meter { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--surface-3); gap: 2px; }
.meter i { display: block; height: 100%; }
.mk-api { background: var(--navy-mid); } .mk-file { background: var(--c-actual); opacity: .62; } .mk-man { background: var(--c-prior); } .mk-miss { background: repeating-linear-gradient(45deg, var(--line-strong) 0 4px, transparent 4px 8px); }
.mix { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; margin-top: 8px; color: var(--text-2); }
.mix b { color: var(--text); font-weight: 600; }
.rows { list-style: none; margin: 0; padding: 0; display: grid; }
.rows li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.rows li:first-child { border-top: 0; }
.rows .t { font-weight: 600; }
.rows .s { font-size: 14px; color: var(--text-2); }
.rows .lost { font-size: 14px; color: var(--critical); }
.rows.chg li { grid-template-columns: minmax(0, 1fr) auto; }
.jump { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.jcard { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px 18px; text-align: left; border: 0; cursor: pointer; display: grid; gap: 6px; min-width: 0; }
.jcard:hover { background: var(--surface-2); }
.jcard .jt { font-weight: 600; font-size: 16px; }
.jcard .js { font-size: 14px; color: var(--text-2); }

/* 優先度マップ・ダイアログ */
dialog { border: 0; border-radius: 16px; padding: 0; max-width: min(560px, calc(100vw - 32px)); width: 100%; background: var(--surface); color: var(--text); box-shadow: 0 12px 48px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(8,14,22,.55); }
.dlg { padding: 22px; display: grid; gap: 14px; }
.dlg header { display: flex; gap: 12px; align-items: start; }
.dlg header h2 { flex: 1; }
.route { text-align: left; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; padding: 14px 16px; cursor: pointer; display: grid; gap: 2px; min-height: 44px; width: 100%; }
.route[data-rec="1"] { border: 2px solid var(--navy); }
.route:hover { background: var(--surface-2); }
.route span { font-size: 14px; color: var(--text-2); }

/* 下部ナビ(スマホ) */
@container app (max-width: 899px) {
  .g2 { display: flex; flex-direction: column; gap: 16px; align-items: stretch; }
  .g2 > .stack { display: contents; }
  .g2 > .stack > * { order: 2; }
  .g2 > .stack > .notices { order: 0; margin-bottom: 4px; }
  .g2 > .stack > .acthead { order: 1; margin-bottom: 0 !important; }
  .g2 > .stack > [data-rank="1"] { order: 2; }
  .g2 > .stack > .kpihead { order: 3; }
  .g2 > .stack > .kpis { order: 4; }
  .g2 > .stack > .acthead2 { order: 5; display: flex; }
  .g2 > .stack > [data-rank="2"], .g2 > .stack > [data-rank="3"] { order: 6; }
  .notices { gap: 8px; margin-bottom: 0; }
  .notice { padding: 12px 14px; }
    .notice .cat, .notices .nfoot { display: none; }
  .notice.open .cat { display: block; }
  .notices:has(.notice.open) .nfoot { display: block; }
  .notice { grid-template-columns: auto minmax(0, 1fr) auto !important; gap: 8px 10px; }
  .notice > div { grid-column: 2 / 4; }
  .notice > .btn[data-ack] { grid-column: 1 / 3; }
  .notice > .btn[data-nmore] { grid-column: 3; padding-inline: 12px; }
  .notice > .btn:only-of-type { grid-column: 1 / -1; }
}
.acthead2 { display: none; }
h1, h2, h3, .take, .na .why, .effect, .btn, .chip, .kpi .d { word-break: auto-phrase; }
.nsum { display: none; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 8px 12px; border-radius: var(--r); border: 2px solid var(--critical-line); background: var(--critical-soft); color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.nsum .ni { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--critical); color: var(--surface); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.nsum .nt { flex: 1; min-width: 0; line-height: 1.5; }
.nsum b { color: var(--critical); }
.nsum .nm { flex: none; color: var(--text-2); font-weight: 600; }
@container app (max-width: 899px) {
  .nsum { display: flex; }
  .notices.cmp:not(.open) .notice, .notices.cmp:not(.open) .nfoot { display: none; }
}
@container app (max-width: 520px) {
  .acthead .cap { display: none; }
  .na .na-top .due { flex-basis: auto; margin-left: 0; }
  .fab { min-height: 48px; padding: 8px 14px; gap: 6px; }
  .fab .fl { font-size: 0; }
  .fab .fl::after { content: "相談"; font-size: 15px; }
  .top { margin-bottom: 14px; }
  .mini .mh { min-height: 0; }
  .mini { padding: 12px 14px; }
  .na { padding: 14px 16px; gap: 8px; }
}
.mini .mv .big.txt { font-size: 17px; white-space: normal; line-height: 1.3; }
.anom { background: var(--caution-soft); color: var(--text); border: 2px solid var(--caution-line); border-radius: 10px; padding: 10px 14px; font-size: 14px; line-height: 1.6; }
.anom b { color: var(--caution); }
.anom.ok { border-color: var(--line-strong); background: var(--surface-2); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.dock { display: none; position: sticky; bottom: 0; z-index: 5; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
.dock nav { display: grid; grid-template-columns: repeat(5, 1fr); }
.dock nav button { min-height: 58px; border: 0; background: transparent; color: var(--text-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 14px; cursor: pointer; padding: 6px 2px; }
.dock nav button[aria-current="page"] { color: var(--navy); font-weight: 600; }
.fab { position: absolute; right: 16px; bottom: calc(100% + 12px); min-height: 52px; padding: 10px 20px; border-radius: 26px; border: 0; background: var(--navy); color: var(--navy-ink); font-weight: 600; font-size: 16px; display: inline-flex; gap: 8px; align-items: center; box-shadow: 0 3px 12px rgba(0,0,0,.28); cursor: pointer; }
.only-m { display: none; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(20px, env(safe-area-inset-bottom, 0px)); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 70; max-width: calc(100vw - 32px); }
.toast[hidden] { display: none; }

@container app (max-width: 1099px) {
  .jump { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@container app (max-width: 899px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .main { padding: 16px 16px 28px; }
  .g2, .g2e { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .dock { display: block; }
  .only-pc { display: none !important; }
  .only-m { display: inline-flex; }
  h1 { font-size: 23px; }
  .card { padding: 18px 16px; }
  .kpi .v { font-size: 28px; }
  .jump { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .na-act .btn { flex: 1 1 130px; }
  .na-top .due { margin-left: 0; flex-basis: 100%; }
  .notice { grid-template-columns: auto minmax(0, 1fr); }
  .notice .btn { grid-column: 1 / -1; }
}
@container app (max-width: 520px) {
  .kpis, .kpis3 { grid-template-columns: minmax(0, 1fr); }
  .jump { grid-template-columns: minmax(0, 1fr); }
  .rows li { grid-template-columns: auto minmax(0, 1fr); }
  .rows li .btn { grid-column: 1 / -1; }
}
/* --- UX テストモード(合成データ専用。模擬操作は実機能ではない) --- */
@container app (max-width: 520px) {
  .card-h { margin-bottom: 6px; }
  .notice { padding: 10px 12px; }
  .top { gap: 6px 12px; margin-bottom: 10px; }
  .notices { gap: 6px; }
  .na { padding: 12px 14px; gap: 6px; }
  .na + .na { margin-top: 10px; }
  .na-top { gap: 4px 8px; }
  .subtabs { margin-bottom: 10px; }
  .cf { gap: 10px; }
  .take { line-height: 1.5; padding: 8px 12px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---- Web 版の追加 ---- */
body { padding: 0; }
#root { container-type: inline-size; container-name: app; min-height: 100vh; }
.shell { min-height: 100vh; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side a.nav { text-decoration: none; }
.main { max-width: 1180px; }
a.btn { text-decoration: none; }
.dock nav a { min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-2); font-size: 14px; padding: 6px 2px; }
.dock nav a[aria-current="page"] { color: var(--navy); font-weight: 600; }
.jcard, .kpi { text-decoration: none; }
@media (max-width: 899px) { .shell { grid-template-columns: minmax(0, 1fr); } .side { display: none; } .main { padding: 16px 16px 90px; } .dock { display: block !important; position: fixed; left: 0; right: 0; bottom: 0; } .jump { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g2 { display: flex; flex-direction: column; } }
@media (max-width: 520px) { .kpis3 { grid-template-columns: 1fr; } }
@media (max-width: 899px) { .g2 > .stack > .later { order: 7; margin-top: 0 !important; } }

/* ---- 共通デザインシステム(2026-11): KPI カード・スパークライン・並べ替えのできる表 ----
   方針: 現在の値を、いちばん大きく。対象期間・比較の基準・単位を、必ず添える。状態(注意・要確認)は、色だけでなく、言葉でも示す。
   数字は、桁をそろえる(等幅の数字)。表の数字は、右揃え。文字は 14px 未満にしない。 */
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.kc { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px 18px 14px; display: grid; gap: 4px; min-width: 0; text-decoration: none; color: inherit; border: 2px solid transparent; align-content: start; }
a.kc:hover { background: var(--surface-2); }
.kc .lh { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.kc .l { font-size: 14px; color: var(--text-2); font-weight: 600; }
.kc .per { font-size: 14px; color: var(--text-3); }
.kc .v { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; font-size: 34px; line-height: 1.2; font-weight: 600; letter-spacing: -.01em; overflow-wrap: anywhere; }
.kc .v small { font-size: 16px; font-weight: 500; color: var(--text-2); margin-left: 4px; }
.kc .v.na { font-size: 17px; line-height: 1.5; font-weight: 500; color: var(--text-2); letter-spacing: 0; }
.kc .cmp { font-size: 14px; display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; }
.kc .cmp .basis { color: var(--text-3); font-weight: 400; }
.kc .nt { font-size: 14px; color: var(--text-3); }
.kc .sp { margin-top: 4px; display: block; line-height: 0; }
.kc .spark { max-width: 100%; height: 36px; }
.kc .stw { font-size: 14px; font-weight: 700; padding: 0 8px; border-radius: 999px; }
.kc .stw[data-s="caution"] { background: var(--caution-soft); color: var(--caution); }
.kc .stw[data-s="critical"] { background: var(--critical-soft); color: var(--critical); }
.kc[data-status="caution"] { border-color: var(--caution-line); }
.kc[data-status="critical"] { border-color: var(--critical-line); background: var(--critical-soft); }
.kc[data-status="na"], .kc[data-status="hidden"] { background: var(--surface-2); box-shadow: none; }
.kpis3 + .card, .kpis3 + .cf, .kpis3 + section, .kpis3 + .subtabs { margin-top: 20px; }
.kpis .kc .v { font-size: 30px; }
/* 表: 数字は右揃え・桁そろえ。見出しは、押すと並べ替え。差の強調は、文字(−)も残す */
.dt { display: grid; gap: 8px; }
.dt .tbl table { font-size: 14px; }
.dt th.num, .dt td.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-num); }
.dt thead th { background: var(--surface); color: var(--text-2); font-weight: 600; }
.dt tbody th[scope="row"] { font-weight: 600; color: var(--text); text-align: left; white-space: nowrap; }
.dt td { white-space: nowrap; }
.dt td:not(.num) { text-align: left; }
.dt tbody tr:hover td, .dt tbody tr:hover th { background: var(--surface-2); }
.dt tr.attn td, .dt tr.attn th { background: var(--caution-soft); }
.dt tr.attn th[scope="row"] { box-shadow: inset 4px 0 0 var(--caution-line); }
.dt .neg { color: var(--critical); font-weight: 700; }
.sorter { border: 0; background: transparent; padding: 6px 4px; min-height: 44px; min-width: 44px; cursor: pointer; font: inherit; font-weight: 600; color: var(--text-2); display: inline-flex; align-items: center; gap: 4px; }
.sorter:hover { color: var(--text); }
.sorter .arr::after { content: "↕"; color: var(--text-3); font-size: 14px; }
th[aria-sort="ascending"] .arr::after { content: "▲"; color: var(--navy); }
th[aria-sort="descending"] .arr::after { content: "▼"; color: var(--navy); }
.tfilter { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--text-2); }
.tfilter input { min-height: 44px; padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-size: 16px; min-width: 0; flex: 1 1 200px; max-width: 360px; }
@container app (max-width: 520px) { .kc .v { font-size: 30px; } .kc { padding: 14px 16px 12px; } }

/* ---- アシスタント(右下の起動ボタン・サイドパネル / スマホは下からのシート) ---- */
.asst-fab { position: fixed; right: 20px; bottom: 20px; z-index: 40; min-height: 48px; padding: 8px 16px 8px 12px; border-radius: 26px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--navy); font-weight: 600; font-size: 15px; display: inline-flex; gap: 8px; align-items: center; box-shadow: 0 3px 14px rgba(20,32,46,.22); cursor: pointer; }
.asst-fab:hover { background: var(--navy-soft); }
.asst-fab .fi { width: 28px; height: 28px; border-radius: 50%; background: var(--navy); color: var(--navy-ink); display: grid; place-items: center; font-size: 16px; font-weight: 700; }
.asst-fab .fb { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--critical); color: #fff; font-size: 14px; display: grid; place-items: center; }
.asst-panel { position: fixed; right: 20px; bottom: 80px; z-index: 41; width: min(400px, calc(100vw - 32px)); max-height: min(680px, calc(100vh - 110px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 16px; box-shadow: 0 12px 40px rgba(20,32,46,.3); overflow: hidden; }
.asst-panel.min { max-height: none; }
.a-h { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.a-ht { display: grid; min-width: 0; }
.a-ht b { font-size: 16px; }
.a-hb { display: flex; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
.a-hb .btn { min-height: 44px; padding: 4px 10px; font-size: 14px; }
.a-body { flex: 1 1 auto; overflow-y: auto; padding: 12px 14px; display: grid; gap: 12px; align-content: start; }
.a-log { display: grid; gap: 12px; }
.a-resp { display: grid; gap: 8px; background: var(--surface); }
.a-resp h3 { font-size: 16px; }
.a-resp p, .a-resp li { font-size: 15px; line-height: 1.65; }
.a-resp[data-tone="refusal"] { border-left: 4px solid var(--caution-line); padding-left: 10px; }
.a-resp[data-tone="insufficient"] { border-left: 4px solid var(--line-strong); padding-left: 10px; }
.a-resp[data-tone="notfound"] { border-left: 4px solid var(--line-strong); padding-left: 10px; }
.a-sub { font-size: 14px; color: var(--text-3); display: block; }
.a-note { font-size: 14px; color: var(--text-2); display: block; flex-basis: 100%; }
.a-warn { font-size: 14px; color: var(--caution); font-weight: 600; display: block; }
.a-bl { margin: 0; padding-left: 20px; display: grid; gap: 2px; }
.a-facts { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.a-facts ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.a-facts li { font-size: 14px; overflow-wrap: anywhere; }
.a-sa { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.a-sa .btn, .a-chips .btn { min-height: 44px; padding: 6px 14px; font-size: 14px; }
.a-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chipbtn { border-radius: 999px; background: var(--navy-soft); color: var(--navy); border-color: transparent; }
.a-user { justify-self: end; max-width: 90%; background: var(--navy); color: var(--navy-ink); border-radius: 14px 14px 4px 14px; padding: 8px 14px; font-size: 15px; overflow-wrap: anywhere; }
.a-ev summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--link); font-size: 14px; }
.a-ev ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14px; }
.a-guide { background: var(--navy-soft); border: 2px solid var(--navy-mid); border-radius: 12px; padding: 12px; display: grid; gap: 6px; }
.a-guide.paused { border-style: dashed; }
.a-ob, .a-sg { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; }
.a-sgs { display: grid; gap: 8px; }
.a-obh { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 8px; font-size: 15px; }
.a-bar { height: 10px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.a-bar i { display: block; height: 100%; background: var(--good); }
.a-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.a-steps li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; align-items: start; padding-top: 8px; border-top: 1px solid var(--line); }
.a-steps li:first-child { border-top: 0; padding-top: 0; }
.a-steps .a-sa { grid-column: 1 / -1; }
.a-st { display: grid; font-size: 15px; }
.a-form { display: flex; gap: 8px; padding: 10px 14px 4px; border-top: 1px solid var(--line); }
.a-form input { flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-size: 16px; }
.a-foot { margin: 0; padding: 2px 14px 10px; font-size: 14px; color: var(--text-3); line-height: 1.5; }
.a-fb { display: flex; gap: 4px; }
.a-fb .btn { min-height: 44px; font-size: 14px; }
.asst-hl { outline: 4px solid var(--navy-mid) !important; outline-offset: 4px; border-radius: 8px; box-shadow: 0 0 0 8px var(--navy-soft) !important; position: relative; z-index: 2; }
@media (max-width: 899px) {
  .asst-fab { right: 12px; bottom: calc(70px + env(safe-area-inset-bottom, 0px)); min-height: 48px; padding: 8px 14px 8px 10px; }
  .asst-fab .fl { font-size: 14px; }
  .asst-panel { left: 8px; right: 8px; width: auto; bottom: calc(66px + env(safe-area-inset-bottom, 0px)); max-height: 62vh; border-radius: 16px 16px 12px 12px; }
}

/* ---- 横幅の根本対策(2026-11): 折れない長い文字(SHA・ファイル名・コード)と、折り返さないチップが、ページ全体を押し広げていた ----
   原因: .rows li の中の .t/.s に、40 桁の SHA のような途中で折れない文字列。nowrap のチップ(ID)が、列の幅を超える。
   対策: 文章の領域は、折り返してよい(overflow-wrap:anywhere)・グリッド/flex の子は、縮められる(min-width:0)。表(.tbl)は、従来どおり、枠の中だけで横にスクロール。 */
.main, .card, .stack, .g2 > *, .na, .notice, .kc, .cf, .empty { min-width: 0; }
.rows li > *, .na-top, .legend span { min-width: 0; }
.rows .t, .rows .s, .rows .lost, .cap, .take, .uncert, .why, .effect, .notice p, .empty span, .kc .nt, .kc .cmp, .top .hello, .chips { overflow-wrap: anywhere; }
.rows .chip, .card .chip { white-space: normal; max-width: 100%; text-align: left; }
.a-resp, .a-resp p, .a-resp li, .a-facts li, .a-sg, .a-guide, .a-ob { overflow-wrap: anywhere; min-width: 0; }

/* ---- アシスタントの配置(2026-11): ドック型(右の列・内容を左へ詰める)/ 可変シート型(下から・出している間は画面の下に余白) ----
   切替の基準は、layout.mjs(ドックで狭めた後の内容の幅が、PC の 2 列構成を保てる 900px 以上 → ドック)。 */
body.asst-docked #root { margin-right: var(--asst-panel-w, 380px); }
body.asst-sheet #root { padding-bottom: var(--asst-h, 0px); }
.asst-panel[data-mode="dock"] { top: 0; bottom: 0; right: 0; left: auto; width: var(--asst-panel-w, 380px); max-height: none; border-radius: 0; border-width: 0 0 0 1px; box-shadow: -6px 0 18px rgba(20,32,46,.12); }
.asst-panel[data-mode="sheet"] { top: auto; left: 8px; right: 8px; width: auto; bottom: var(--asst-bottom, 0px); max-height: var(--asst-max-h, 46vh); border-radius: 16px 16px 0 0; box-shadow: 0 -4px 18px rgba(20,32,46,.22); }
@media (min-width: 900px) { .asst-panel[data-mode="sheet"] { left: auto; right: 12px; width: min(720px, calc(100vw - 24px)); } }
.asst-panel[data-compact="1"] .a-body { padding-top: 8px; padding-bottom: 8px; }
.asst-pill .fl { font-size: 14px; }
.a-gh { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; justify-content: space-between; }
.a-now, .a-next { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; margin: 0; font-size: 15px; line-height: 1.6; align-items: start; }
.a-next { color: var(--text-2); }
.a-tag { font-size: 14px; font-weight: 700; background: var(--navy); color: var(--navy-ink); border-radius: 6px; padding: 0 8px; min-width: 2.2em; text-align: center; }
.a-next .a-tag { background: var(--surface-3); color: var(--text-2); }
.a-guide .a-sa .btn { min-height: 44px; }

/* シートの手順の案内中(コンパクト表示): 見出しを 1 行にし、「いま」「次」「ボタン」が、必ず見えるようにする */
.asst-panel[data-compact="1"] .a-ht .a-sub, .asst-panel[data-compact="1"] .a-hb button[data-asst="hide"], .asst-panel[data-compact="1"] .a-ok { display: none; }
.asst-panel[data-compact="1"] .a-h { padding: 4px 8px 4px 14px; }
.asst-panel[data-compact="1"] .a-ht b { font-size: 15px; }
.asst-panel[data-compact="1"] .a-guide { padding: 8px 10px; gap: 4px; }
.asst-panel[data-compact="1"] .a-now, .asst-panel[data-compact="1"] .a-next { line-height: 1.45; }

/* ---- 予算の入力画面 ---- */
.bsel { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 8px; }
.bsel label { display: grid; gap: 4px; font-size: 14px; color: var(--text-2); }
.bsel select, .bi input { min-height: 44px; padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-size: 16px; min-width: 0; }
.bform { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; margin: 10px 0; }
.bf { display: grid; gap: 4px; align-content: start; min-width: 0; }
.bf > label { font-size: 15px; }
.bi { display: flex; gap: 8px; align-items: center; min-width: 0; }
.bi input { flex: 1 1 auto; font-variant-numeric: tabular-nums; text-align: right; }
.bi input[data-bud-new="name"] { text-align: left; }
.bi .u { color: var(--text-2); font-size: 14px; white-space: nowrap; }
.bi input[aria-invalid="true"] { border-color: var(--critical); border-width: 2px; }
.bi input:disabled, .bsel select:disabled { background: var(--surface-2); color: var(--text-3); }
.berr { color: var(--critical); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.bnote .rows li { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
@container app (max-width: 640px) { .bsel { grid-template-columns: minmax(0, 1fr); } .bform { grid-template-columns: minmax(0, 1fr); } }

/* ---- スマホの表示の改善(2026-11・P1): 最重要の数字を先に。カードを、コンパクトに(情報は、減らさない) ----
   ・先頭のカード = 最重要(全幅)。2 枚目以降は、2 列のコンパクト表示(値・期間・比較・推移・注記は、そのまま)
   ・ホーム: 資金の最低残高と売上を、次の一手より先に。稼働率・単価は「ほかの数字」(開けば、すべて見られる) */
@container app (max-width: 520px) {
  .kpis3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpis3 > .kc:first-child { grid-column: 1 / -1; }
  .kpis3 > .kc:not(:first-child) { padding: 12px 12px 10px; }
  .kpis3 > .kc:not(:first-child) .v { font-size: 24px; }
  .kpis3 > .kc:not(:first-child) .v small { font-size: 14px; }
  .kpis3 > .kc:not(:first-child) .v.na { font-size: 15px; }
  .kpis .kc { padding: 12px 12px 10px; }
  .kpis .kc .v { font-size: 26px; }
  .kmore { margin-top: 10px; }
  .kmore > summary { width: 100%; justify-content: flex-start; background: var(--surface-2); border-radius: 10px; }
  .kmore > .kpis { margin-top: 10px; }
}
@container app (max-width: 899px) {
  .g2 > .stack > .kpihead { order: 1; }
  .g2 > .stack > .kpis, .g2 > .stack > .kmore { order: 1; }
  .g2 > .stack > .acthead { order: 2; margin-top: 8px; }
  .g2 > .stack > [data-rank="1"] { order: 3; }
  .g2 > .stack > [data-rank="2"], .g2 > .stack > [data-rank="3"] { order: 6; }
}

/* コンパクト(手順の案内中のシート)の足元: ボタンは、いつも見える */
.a-gfoot { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: var(--surface); }
.a-gfoot .btn { min-height: 44px; padding: 6px 12px; font-size: 14px; flex: 1 1 auto; }
.a-gfoot .btn.pri { flex: 2 1 90px; }
.asst-panel[data-compact="1"] .a-body { min-height: 0; }

/* パネルの中: 説明の領域(.a-body)は、縮められる(min-height: 0)。入力欄・足元のボタンが、見えている高さの外へ押し出されない(フォントが違う環境でも) */
.asst-panel { min-height: 0; }
.asst-panel .a-body { min-height: 0; }
.asst-panel .a-form, .asst-panel .a-foot, .asst-panel .a-h, .asst-panel .a-gfoot { flex: none; }

/* 見えている高さが低い(キーボードが出ている)とき: 見出しの補足と注意書きを畳み、入力欄・閉じるボタン・本文が、必ず入るようにする */
@media (max-height: 520px) {
  .asst-panel .a-ht .a-sub, .asst-panel .a-foot { display: none; }
  .asst-panel .a-h { padding-top: 2px; padding-bottom: 2px; }
  .asst-panel .a-form { padding-top: 6px; padding-bottom: 6px; }
}

/* 取込前の「金額と単位の確認」(import-screen.mjs の amountHtml) */
.amt { display: grid; gap: 12px; margin-top: 12px; border: 2px solid var(--line-strong); border-radius: 12px; padding: 12px 14px; }
.amt h4 { margin: 0; font-size: 16px; }
.amt-col { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.amt-col h5 { margin: 0; font-size: 15px; }
.amt-col p { margin: 0; }
.amt-unit { font-size: 18px; }
.amt-check { display: flex; gap: 12px; align-items: flex-start; padding: 6px 0; cursor: pointer; font-size: 15px; line-height: 1.6; }
.amt-check input { flex: 0 0 44px; width: 44px; height: 44px; margin: 0; accent-color: var(--navy, #1f3a5f); }
.amt-check span { min-width: 0; overflow-wrap: anywhere; }
.amt-main { background: var(--navy-soft, #e8eef7); border-radius: 10px; padding: 8px 12px; }
