/* 板倉製作所 業務フロー資料 — shared stylesheet (SSOT for all pages) */
:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --ink: #1f2430;
  --ink-soft: #5a6270;
  --line: #d9dee6;
  --accent: #0b5fa5;      /* 受注→出荷 order-to-cash */
  --accent2: #8a5a00;     /* 発注→支払 procure-to-pay */
  --ok: #1e7d46;
  --warn: #b25e09;
  --danger: #b3261e;
  --code-bg: #eef1f5;
  --mark: #fff3c4;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --panel: #1d2026;
    --ink: #e6e9ee;
    --ink-soft: #a4adba;
    --line: #363c46;
    --accent: #66aadd;
    --accent2: #d8a54a;
    --ok: #5fbe8a;
    --warn: #e0a05f;
    --danger: #e2857f;
    --code-bg: #262b33;
    --mark: #4a4020;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Noto Sans CJK JP", "Yu Gothic", Meiryo, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.75;
  font-size: 15.5px;
}
/* ---- layout: fixed sidebar + content ---- */
.layout { display: flex; min-height: 100vh; }
nav.sidebar {
  width: 250px; flex: 0 0 250px;
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 18px 14px 40px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
nav.sidebar .site-title {
  font-weight: 700; font-size: 15px; line-height: 1.4;
  margin-bottom: 4px;
}
nav.sidebar .site-sub { font-size: 11.5px; color: var(--ink-soft); margin-bottom: 14px; }
nav.sidebar a {
  display: block; padding: 5px 9px; border-radius: 6px;
  color: var(--ink); text-decoration: none; font-size: 13.5px;
}
nav.sidebar a:hover { background: var(--code-bg); }
nav.sidebar a.current { background: var(--accent); color: #fff; font-weight: 600; }
nav.sidebar .nav-group {
  font-size: 11px; letter-spacing: .08em; color: var(--ink-soft);
  margin: 14px 4px 4px; text-transform: uppercase;
}
main.content { flex: 1 1 auto; min-width: 0; padding: 34px 48px 90px; max-width: 1020px; }
@media (max-width: 900px) {
  .layout { display: block; }
  nav.sidebar { position: static; width: auto; height: auto; border-right: none; border-bottom: 1px solid var(--line); }
  main.content { padding: 20px 18px 60px; }
}
/* ---- typography ---- */
h1 { font-size: 27px; line-height: 1.35; margin: 0 0 6px; }
p.lead { color: var(--ink-soft); margin-top: 0; font-size: 15px; }
h2 {
  font-size: 20px; margin: 44px 0 12px; padding: 6px 0 6px 12px;
  border-left: 5px solid var(--accent);
}
h3 { font-size: 16.5px; margin: 28px 0 8px; }
h4 { font-size: 15px; margin: 20px 0 6px; color: var(--ink-soft); }
a { color: var(--accent); }
code, .pgm {
  font-family: "SFMono-Regular", Consolas, "Noto Sans Mono CJK JP", monospace;
  background: var(--code-bg); border-radius: 4px; padding: 1px 5px; font-size: .88em;
}
mark { background: var(--mark); color: inherit; padding: 0 3px; border-radius: 3px; }
/* ---- cards / callouts ---- */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 16px 20px; margin: 14px 0;
}
.callout { border-left: 5px solid var(--accent); border-radius: 6px; padding: 10px 16px; margin: 14px 0; background: var(--panel); border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.callout.warn { border-left-color: var(--warn); }
.callout.danger { border-left-color: var(--danger); }
.callout.ok { border-left-color: var(--ok); }
.callout .co-title { font-weight: 700; font-size: 13.5px; margin-bottom: 2px; }
/* ---- flow steps ---- */
ol.flow { counter-reset: step; list-style: none; padding-left: 0; }
ol.flow > li {
  counter-increment: step;
  position: relative; padding: 10px 14px 10px 52px; margin: 8px 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
}
ol.flow > li::before {
  content: counter(step);
  position: absolute; left: 12px; top: 12px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
ol.flow.p2p > li::before { background: var(--accent2); }
ol.flow .who { font-size: 12px; color: var(--ink-soft); }
/* ---- value stream boxes ---- */
.stream { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; margin: 12px 0; }
.stream .node {
  flex: 1 1 110px; min-width: 105px;
  background: var(--panel); border: 1.5px solid var(--accent); border-radius: 8px;
  padding: 8px 10px; font-size: 12.5px; text-align: center; position: relative;
}
.stream .node b { display: block; font-size: 13.5px; }
.stream .node small { color: var(--ink-soft); }
.stream.p2p .node { border-color: var(--accent2); }
.stream .arrow { align-self: center; color: var(--ink-soft); font-size: 16px; flex: 0 0 auto; }
.stream .node a { text-decoration: none; color: inherit; }
/* ---- tables ---- */
.tablewrap { overflow-x: auto; margin: 12px 0; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; background: var(--panel); }
th, td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; }
th { background: var(--code-bg); font-size: 12.5px; white-space: nowrap; }
tr:nth-child(even) td { background: color-mix(in srgb, var(--panel) 92%, var(--line)); }
/* ---- badges ---- */
.badge {
  display: inline-block; font-size: 11px; font-weight: 700; border-radius: 999px;
  padding: 1px 9px; vertical-align: middle; margin-left: 4px;
}
.badge.as400 { background: var(--code-bg); color: var(--ink-soft); border: 1px solid var(--line); }
.badge.excel { background: color-mix(in srgb, var(--ok) 18%, var(--panel)); color: var(--ok); }
.badge.special { background: color-mix(in srgb, var(--warn) 18%, var(--panel)); color: var(--warn); }
.badge.dead { background: color-mix(in srgb, var(--danger) 15%, var(--panel)); color: var(--danger); }
/* ---- glossary ---- */
dl.glossary dt { font-weight: 700; margin-top: 14px; }
dl.glossary dd { margin: 2px 0 0 0; color: var(--ink); }
dl.glossary dd .src { font-size: 11.5px; color: var(--ink-soft); }
/* ---- misc ---- */
.pagefoot {
  margin-top: 60px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--ink-soft);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
}
.toc { font-size: 13.5px; }
.toc a { text-decoration: none; }
details { margin: 10px 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; }
details summary { cursor: pointer; font-weight: 600; }
/* ---- sidebar search ---- */
.nav-search { position: relative; margin: 4px 0 10px; }
.nav-search input {
  width: 100%; padding: 6px 9px; font-size: 13px;
  border: 1px solid var(--line); border-radius: 7px;
  background: var(--bg); color: var(--ink); outline: none;
}
.nav-search input:focus { border-color: var(--accent); }
.nav-search .hits {
  position: absolute; z-index: 30; left: 0; right: -40px; top: 100%;
  max-height: 60vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,.18); display: none;
}
.nav-search .hits.show { display: block; }
.nav-search .hits a {
  display: block; padding: 6px 10px; font-size: 12.5px; border-radius: 0;
  border-bottom: 1px solid var(--line);
}
.nav-search .hits a:last-child { border-bottom: none; }
.nav-search .hits .hit-page { color: var(--ink-soft); font-size: 11px; display: block; }
.nav-search .hits .none { padding: 8px 10px; font-size: 12px; color: var(--ink-soft); }
/* ---- illustrations ---- */
figure.illust { margin: 18px 0 22px; }
figure.illust img {
  width: 100%; height: auto; display: block;
  border-radius: 12px; border: 1px solid var(--line);
}
figure.illust figcaption {
  font-size: 12.5px; color: var(--ink-soft); text-align: center; margin-top: 7px;
}
/* ---- page TL;DR ---- */
.tldr { border-left-color: var(--ok); }
.tldr ul { margin: 4px 0 2px; padding-left: 20px; }
/* ---- back to top ---- */
#backtop {
  position: fixed; right: 22px; bottom: 22px; z-index: 40;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--panel); color: var(--accent);
  font-size: 19px; cursor: pointer; display: none;
  box-shadow: 0 3px 12px rgba(0,0,0,.15);
}
#backtop.show { display: block; }
#backtop:hover { background: var(--code-bg); }
/* ---- hearing sheet meta line ---- */
.sheet-meta {
  display: flex; gap: 24px; flex-wrap: wrap; font-size: 13px;
  border: 1px dashed var(--line); border-radius: 8px; padding: 8px 14px; margin: 10px 0 4px;
  color: var(--ink-soft);
}
.sheet-meta .blank {
  display: inline-block; min-width: 130px; border-bottom: 1px solid var(--ink-soft);
}
/* ER図（mermaid）— assets/mermaid.min.js が pre.mermaid の中身をSVGに描き換える。
   描画前は元のソースがそのまま見える（JSが動かない環境でも情報は失われない）。 */
.mermaid-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 12px 10px; margin: 10px 0 6px; }
pre.mermaid { margin: 0; text-align: center; }
pre.mermaid:not([data-processed]) { text-align: left; white-space: pre-wrap;
  font-size: 11.5px; line-height: 1.5; color: var(--ink-soft); }
/* 図は縮小せず原寸で描き、はみ出す分は .mermaid-wrap を横スクロールさせる。
   縮小して収めると項目名が読めなくなるため、可読性を優先する。 */
pre.mermaid svg { height: auto; }
.diagram-hint { margin: 0 0 14px; font-size: 12px; color: var(--ink-soft); }

@media print {
  nav.sidebar, #backtop, .nav-search { display: none !important; }
  main.content { padding: 0; max-width: none; }
  body { background: #fff; color: #000; font-size: 12px; }
  .card, .callout, ol.flow > li, dl.glossary > div, tr, .mermaid-wrap { break-inside: avoid; }
  h2 { break-after: avoid; }
  details { display: block; }
  a { color: inherit; text-decoration: none; }
}
