/* 製造。style.css・flow.css・fm.css の上に重ねる（接頭辞 fa-） */
.fa-lead { margin: 0 0 8px; font-size: 13px; color: var(--ink2); }
.fa-intro { margin: 10px 0; font-size: 13.5px; color: var(--ink2); background: var(--line2); border-radius: 10px; padding: 8px 12px; }
.fa-note { margin: 8px 0 0; font-size: 12.5px; color: var(--ink2); background: var(--line2); border-radius: 8px; padding: 6px 10px; }
.fa-judge { margin: 8px 0 0; font-size: 13px; font-weight: 700; border-radius: 8px; padding: 7px 10px; }
.fa-judge.ok { background: #f0fdf4; color: #14532d; }
.fa-judge.ng { background: #fef2f2; color: #7f1d1d; }
.fa-judge.mid { background: #fffbeb; color: #78350f; }
.fa-flbl { margin: 10px 0 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.fa-box > .fa-flbl:first-child { margin-top: 0; }
.fa-chk { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--ink); cursor: pointer; margin-top: 8px; }
.fa-chk input { width: 17px; height: 17px; flex: none; margin: 1px 0 0; accent-color: #0d9488; cursor: pointer; }
.fa-gap { margin-top: 8px; }
.fa-good { color: #15803d; font-weight: 700; }
.fa-bad { color: #b91c1c; font-weight: 700; }
.fa-mid { color: #92400e; font-weight: 700; }
.fa-st0 { color: var(--muted); }
.fa-em { font-weight: 700; color: var(--ink); }
.fa-cast small { display: block; margin-top: 2px; font-size: 12px; font-weight: 700; color: #0f766e; }

/* 業務の流れ */
.fa-flow { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 14px; align-items: start; margin-bottom: 6px; }
.fa-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.fa-step { appearance: none; width: 100%; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; align-items: center; text-align: left; font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; cursor: pointer; }
.fa-step:hover { border-color: #94a3b8; }
.fa-step.on { border-color: #0d9488; background: #f0fdfa; }
.fa-sn { width: 26px; height: 26px; border-radius: 50%; background: var(--line2); color: var(--ink2); font: 600 12.5px/26px var(--latin); text-align: center; display: inline-block; flex: none; }
.fa-step.on .fa-sn { background: #0d9488; color: #fff; }
.fa-st { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.fa-st b { font-size: 14px; }
.fa-st small { font-size: 12px; color: var(--muted); }
.fa-panel { position: sticky; top: 12px; padding: 14px 16px; min-width: 0; }
.fa-panel > p { margin: 0 0 6px; font-size: 13.5px; color: var(--ink2); }
.fa-k { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--muted); }
.fa-panel .fa-k .fa-sn { background: #0d9488; color: #fff; }
.fa-panel h3 { margin: 6px 0; font-size: 17px; }
.fa-dl { margin: 0; display: grid; grid-template-columns: 7.5em minmax(0, 1fr); gap: 6px 12px; font-size: 13.5px; }
.fa-dl dt { font-size: 12px; font-weight: 700; color: var(--muted); padding-top: 2px; }
.fa-dl dd { margin: 0; color: var(--ink2); }
.fa-nav { display: flex; gap: 6px; margin-top: 12px; }
.fa-nav button { appearance: none; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 5px 13px; cursor: pointer; }
.fa-nav button[disabled] { color: #94a3b8; cursor: default; }

/* 計算の箱（共通） */
.fa-box { padding: 12px 14px; min-width: 0; }
.fa-box > h3 { margin: 0 0 8px; font-size: 15px; }
.fa-box .pills + .pills { margin-top: 6px; }
.fa-fields { display: grid; gap: 8px; margin-top: 10px; }
.fa-fields.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fa-fields.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fa-fields label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; font-weight: 700; color: var(--ink2); min-width: 0; }
.fa-fields input { font: inherit; font-size: 15px; font-weight: 500; color: var(--ink); background: #f8fafc; border: 1px solid #cbd5e1; border-radius: 9px; padding: 6px 9px; min-width: 0; width: 100%; box-sizing: border-box; }
.fa-sumdl { margin: 10px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.fa-sumdl > div { background: #f8fafc; border-radius: 8px; padding: 6px 8px; min-width: 0; }
.fa-sumdl dt { font-size: 11px; font-weight: 700; color: var(--muted); }
.fa-sumdl dd { margin: 0; font-size: 13.5px; font-weight: 700; overflow-wrap: anywhere; }
.fa-tag { display: inline-block; font-size: 10.5px; font-weight: 700; border-radius: 5px; padding: 0 5px; margin-right: 5px; vertical-align: 1px; white-space: nowrap; }
.fa-tag.make { background: #e0f2fe; color: #075985; }
.fa-tag.buy { background: #fef3c7; color: #92400e; }

/* 所要量の計算 */
.fa-mrp { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) minmax(0, .85fr); gap: 10px; align-items: start; }
.fa-mrptab { margin-top: 10px; }
.fa-tree { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.fa-tree ul { list-style: none; margin: 2px 0 2px 10px; padding: 0 0 0 10px; border-left: 2px solid var(--line2); }
.fa-tree li { margin: 3px 0; }
.fa-tn { display: block; color: var(--ink2); }
.fa-tn b { color: var(--ink); }
.fa-tn small { display: block; font-size: 11px; color: var(--muted); }
.fa-tsame { color: var(--muted); font-size: 11.5px; }
.fa-mrpt th, .fa-mrpt td { font-size: 12.5px; }
.fa-mrpt td.n, .fa-mrpt thead th.n { text-align: right; white-space: nowrap; font-family: var(--latin); }
.fa-mrpt tbody th { min-width: 11em; }
.fa-mrpt td small { max-width: 11em; margin-left: auto; }
.fa-mrpt small { display: block; font: 500 11px var(--sans); color: var(--muted); white-space: normal; }
.fa-sum2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.fa-sum2 > div { min-width: 0; }
.fa-ol { margin: 0; padding-left: 1.2em; font-size: 13px; display: grid; gap: 2px; }
.fa-ol span { margin-left: 6px; font-size: 12px; color: var(--muted); }
.fa-ol span.fa-bad { color: #b91c1c; }
#faMrpSum h3 { margin: 0 0 4px; font-size: 15px; }

/* 工程と進み具合 */
.fa-proc { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 10px; align-items: start; margin-top: 10px; }
.fa-board th, .fa-board td { font-size: 13px; }
.fa-board td.n, .fa-board thead th.n { text-align: right; font-family: var(--latin); white-space: nowrap; }
#faProcOut h3, #faTrOut h3 { margin: 0 0 6px; font-size: 15px; }

/* ロットをたどる */
.fa-trbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.fa-legend { margin: 0; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; }
.fa-dot { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 2px; vertical-align: -1px; border: 2px solid; }
.fa-dot.start { background: #fef9c3; border-color: #ca8a04; }
.fa-dot.hit { background: #e0f2fe; border-color: #0284c7; }
.fa-dot.pick { background: #fff; border-color: #7c3aed; }
.fa-graph { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.fa-col { background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 8px; min-width: 0; }
.fa-colh { margin: 0 0 6px; font-size: 12px; font-weight: 700; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.fa-colh span { font-size: 10.5px; color: #6d28d9; background: #ede9fe; border-radius: 5px; padding: 0 6px; }
.fa-nodes { display: grid; gap: 6px; }
.fa-node { appearance: none; width: 100%; font: inherit; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 1px; border: 1px solid var(--line); background: var(--paper); border-radius: 10px; padding: 6px 9px; color: var(--ink); min-width: 0; }
.fa-node b { font: 600 12.5px var(--latin); }
.fa-node span { font-size: 12px; color: var(--ink2); }
.fa-node small { font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.fa-node:hover { border-color: #94a3b8; }
.fa-node.start { background: #fef9c3; border-color: #ca8a04; }
.fa-node.hit { background: #e0f2fe; border-color: #0284c7; }
.fa-node.pick { box-shadow: 0 0 0 2px #7c3aed inset; }
.fa-node.focus { outline: 2px dashed #64748b; outline-offset: 2px; }
.fa-node.ok::after, .fa-node.miss::after, .fa-node.extra::after { font-size: 11px; font-weight: 700; margin-top: 2px; }
.fa-node.ok::after { content: "○ 正しく選んだ"; color: #15803d; }
.fa-node.miss::after { content: "✕ 選び漏れ"; color: #b91c1c; }
.fa-node.extra::after { content: "✕ 余分"; color: #b91c1c; }
.fa-sql { margin: 10px 0 0; background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: 10px 12px; font: 500 12px/1.6 var(--latin); white-space: pre-wrap; overflow-wrap: anywhere; }

/* 原価 */
.fa-cost { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 10px; align-items: start; }
.fa-rules { margin: 10px 0 0; padding-left: 1.2em; font-size: 12px; color: var(--ink2); display: grid; gap: 3px; }
.fa-costt th, .fa-costt td { font-size: 13px; }
.fa-costt td.n, .fa-costt thead th.n { text-align: right; font-family: var(--latin); white-space: nowrap; }
.fa-costt small { display: block; font-size: 11px; color: var(--muted); }
.fa-costt tr.tot th, .fa-costt tr.tot td { font-weight: 700; border-top: 2px solid var(--line); }

/* 工場の層 */
.fa-lvwrap { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 14px; align-items: start; margin-bottom: 10px; }
.fa-levels { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.fa-lv { appearance: none; width: 100%; font: inherit; text-align: left; cursor: pointer; display: grid; grid-template-columns: 5.2em minmax(0, 1fr); gap: 8px; align-items: center; border: 1px solid var(--line); background: var(--paper); border-radius: 12px; padding: 8px 12px; color: var(--ink); }
.fa-lv span { font: 600 12px var(--latin); color: var(--muted); }
.fa-lv b { font-size: 13.5px; }
.fa-lv:hover { border-color: #94a3b8; }
.fa-lv[aria-pressed="true"] { border-color: #0d9488; background: #f0fdfa; }
.fa-levels li:nth-child(1) .fa-lv { margin-right: 0; }
.fa-levels li:nth-child(2) .fa-lv { width: 96%; margin-left: 4%; }
.fa-levels li:nth-child(3) .fa-lv { width: 92%; margin-left: 8%; }
.fa-levels li:nth-child(4) .fa-lv { width: 88%; margin-left: 12%; }
.fa-levels li:nth-child(5) .fa-lv { width: 84%; margin-left: 16%; }

/* 人数の境目 */
.fa-heads { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: start; margin-top: 10px; }
.fa-headt th, .fa-headt td { font-size: 13px; }
.fa-headt td.n, .fa-headt thead th.n { text-align: right; white-space: nowrap; }
.fa-headt small { display: block; font-size: 11px; color: var(--muted); }

/* データの形 */
.fa-tbl dl { margin: 6px 0 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 10px; font-size: 12.5px; }
.fa-tbl dt { font: 600 12px var(--latin); color: var(--ink); overflow-wrap: anywhere; }
.fa-tbl dd { margin: 0; color: var(--ink2); }
#faDataNotes { margin-top: 10px; }

.fa-step:focus-visible, .fa-nav button:focus-visible, .fa-fields input:focus-visible, .fa-chk input:focus-visible, .fa-node:focus-visible, .fa-lv:focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }
@media (max-width: 1100px) {
  .fa-flow, .fa-mrp, .fa-proc, .fa-cost, .fa-lvwrap, .fa-heads { grid-template-columns: minmax(0, 1fr); }
  .fa-panel { position: static; }
  .fa-graph { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .fa-dl { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .fa-dl dd { margin-bottom: 6px; }
  .fa-fields.three, .fa-fields.two, .fa-sum2, .fa-sumdl { grid-template-columns: minmax(0, 1fr); }
  .fa-graph { grid-template-columns: minmax(0, 1fr); }
  .fa-levels li .fa-lv { width: 100% !important; margin-left: 0 !important; }
  /* 表は 1 行ずつのカードに */
  .fa-mrpt thead, .fa-board thead, .fa-costt thead, .fa-headt thead { display: none; }
  .fa-mrpt tr, .fa-board tr, .fa-costt tr, .fa-headt tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 10px; border-bottom: 1px solid var(--line); padding: 6px 0; }
  .fa-mrpt tbody th, .fa-board tbody th, .fa-costt tbody th, .fa-headt tbody th { grid-column: 1 / -1; min-width: 0; border: 0; padding: 2px 4px; }
  .fa-mrpt td, .fa-board td, .fa-costt td, .fa-headt td { border: 0; padding: 2px 4px; text-align: left !important; white-space: normal !important; }
  .fa-mrpt td[data-l]::before, .fa-board td[data-l]::before, .fa-costt td[data-l]::before, .fa-headt td[data-l]::before { content: attr(data-l); display: block; font: 700 11px var(--sans); color: var(--muted); }
  .fa-costt tr.tot { border-top: 2px solid var(--line); }
  .fa-mrpt tr { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fa-mrpt td small { max-width: none; margin-left: 0; }
}
