/* ===========================================================================
   /services/manufacturing/ (ja, vi, en) -- diagrams drawn in HTML/CSS: data flow (hero),
   shared product core with a per-factory layer (approach), data and security,
   and the icon tiles of the solution cards. Each diagram is role="img" with a
   single aria-label, so screen readers hear one sentence, not every box.
   Colours reuse the tokens of manufacturing-module-screens.css.
   =========================================================================== */

.mfd { container-type: inline-size; padding: clamp(16px, 2.6vw, 28px); border-radius: 14px; background: var(--mfs-stage); font-family: 'Noto Sans JP', sans-serif; font-size: 14px; line-height: 1.55; color: var(--ink); }
.mfd :where(p, ul) { margin: 0; }
.mfd ul { padding: 0; list-style: none; }
.mfd-i { flex: none; width: 20px; height: 20px; color: var(--blue); }
.mfd-tag { margin-bottom: 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; color: var(--muted); }

/* ---- hero: shop floor -> NAL software -> using the data ---------------------- */
.mfd-tier { padding: 14px; border-radius: 10px; background: var(--white); box-shadow: 0 6px 18px rgba(16, 42, 67, 0.08); }
.mfd-src { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mfd-out { display: grid; gap: 8px; }
.mfd-src li { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 8px 10px; border: 1px solid var(--mfs-hair); border-radius: 6px; font-size: 13px; font-weight: 700; color: var(--navy); }
.mfd-tier--core { background: var(--navy); }
.mfd-tier--core .mfd-tag { color: var(--blue-pale); }
.mfd-mods { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mfd-mods li { display: flex; align-items: center; justify-content: center; padding: 12px 6px; border-radius: 6px; background: var(--white); text-align: center; font-size: 15px; font-weight: 700; color: var(--navy); }
.mfd-base { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 8px; padding: 9px 12px; border-radius: 6px; background: var(--blue); font-size: 14px; font-weight: 700; color: var(--white); }
.mfd-base .mfd-i { color: var(--white); }
.mfd-out li { display: flex; align-items: flex-start; gap: 10px; min-width: 0; padding: 10px 12px; border-left: 3px solid var(--blue); border-radius: 0 6px 6px 0; background: #EEF5FB; }
.mfd-out .mfd-i { margin-top: 2px; }
.mfd-out span { display: flex; flex-direction: column; min-width: 0; font-size: 12px; color: var(--muted); }
.mfd-out b { font-size: 14px; color: var(--navy); }
.mfd-link { display: grid; grid-template-columns: minmax(0, 1fr) 14px minmax(0, 1fr); align-items: center; height: 40px; }
.mfd-link i { position: relative; grid-column: 2; grid-row: 1; justify-self: center; width: 2px; height: 100%; background: var(--blue); }
.mfd-link i::after { content: ""; position: absolute; left: 50%; bottom: 0; border: 6px solid transparent; border-top: 8px solid var(--blue); border-bottom: 0; transform: translateX(-50%); }
.mfd-link span { grid-column: 3; grid-row: 1; padding-left: 10px; font-size: 12px; font-weight: 700; color: var(--blue); }

/* ---- approach: one custom layer per factory on the shared product core ------- */
.mfd--stack { display: grid; gap: 14px; }
.mfd-facs { display: grid; gap: 12px; }
.mfd-facs li { display: grid; gap: 8px; min-width: 0; }
.mfd-fac { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--navy); }
.mfd-cust { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px 14px; border: 2px dashed var(--blue); border-radius: 8px; background: var(--white); font-weight: 700; color: var(--navy); }
.mfd-pill { padding: 1px 8px; border-radius: 999px; background: #EEF5FB; font-size: 12px; color: var(--blue); }
.mfd-corebar { padding: 16px; border-radius: 10px; background: var(--navy); color: var(--white); }
.mfd-corebar__h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 12px; }
.mfd-corebar__h b { font-size: 17px; }
.mfd-corebar__h span { font-size: 13px; color: var(--blue-pale); }
.mfd-corebar ul { display: flex; flex-wrap: wrap; gap: 8px; }
.mfd-corebar li { padding: 6px 14px; border: 1px solid rgba(255, 255, 255, 0.28); border-radius: 6px; background: rgba(255, 255, 255, 0.08); font-size: 14px; font-weight: 700; }

/* ---- data and security: role matrix, where data lives, log, AI scope --------- */
.mfd-grid { display: grid; gap: 12px; }
.mfd-card { min-width: 0; padding: 12px; border-radius: 10px; background: var(--white); box-shadow: 0 6px 18px rgba(16, 42, 67, 0.08); }
.mfd-h { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 15px; font-weight: 700; color: var(--navy); }
/* The scroll box only matters at about 320px or with large text: the table then
   scrolls inside its card instead of widening the whole page. */
.mfd-scroll { overflow-x: auto; }
.mfd-perm table { width: 100%; border-collapse: collapse; font-size: 13px; }
/* overflow-wrap: normal -- the page-wide "anywhere" would split short headers
   ("Kho" -> "Kh/o", "Cost" -> "Cos/t") once the table hits its min width.
   hyphens: auto lets long English headers break as "Produc-tion" instead. */
.mfd-perm th, .mfd-perm td { padding: 8px 2px; border-bottom: 1px solid var(--mfs-hair); text-align: center; overflow-wrap: normal; }
.mfd-perm thead th { font-size: 11px; color: var(--muted); hyphens: auto; -webkit-hyphens: auto; }
.mfd-perm tbody th { text-align: left; color: var(--navy); }
.mfd-perm tbody tr:last-child > * { border-bottom: 0; }
.mfd-yes, .mfd-no { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; vertical-align: middle; }
.mfd-yes { background: var(--blue); }
.mfd-yes .mfd-i { width: 14px; height: 14px; color: var(--white); stroke-width: 2.6; }
.mfd-no { background: var(--mfs-track); box-shadow: inset 0 0 0 1px #C9D3DD; }
.mfd-no::after { content: ""; width: 8px; height: 2px; border-radius: 1px; background: var(--muted); }
.mfd-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.mfd-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.mfd-legend .mfd-yes, .mfd-legend .mfd-no { width: 16px; height: 16px; }
.mfd-legend .mfd-yes .mfd-i { width: 10px; height: 10px; }
/* Where the data lives: one block only -- every module runs on the factory's
   own server, and the green tag states that the data never leaves it. */
.mfd-opt { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 10px; border: 1px solid var(--mfs-hair); border-radius: 8px; text-align: center; }
.mfd-opt .mfd-i { width: 28px; height: 28px; }
.mfd-opt b { font-size: 14px; color: var(--navy); }
.mfd-opt span { font-size: 12px; color: var(--muted); }
.mfd-stay { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 4px 12px; border-radius: 999px; background: #EAF5EF; font-size: 13px; color: var(--mfs-run); }
.mfd-stay .mfd-i { width: 16px; height: 16px; color: var(--mfs-run); }
.mfd-log li { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--mfs-hair); font-size: 13px; }
.mfd-log li:last-child { border-bottom: 0; }
.mfd-t { grid-row: span 2; font-variant-numeric: tabular-nums; color: var(--muted); }
.mfd-log b { color: var(--navy); }
.mfd-ai { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-left: 4px solid var(--mfs-run); border-radius: 10px; background: var(--white); font-weight: 700; color: var(--mfs-run); }
.mfd-ai .mfd-i { color: var(--mfs-run); }

/* ---- solution cards: icon tile next to the card number ----------------------- */
.mfd-ico { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 10px; background: #EEF5FB; }
.mfd-ico .mfd-i { width: 26px; height: 26px; }

/* ---- wider diagrams --------------------------------------------------------- */
@container (min-width: 460px) {
  .mfd-src { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .mfd-out { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mfd-src li { flex-direction: column; justify-content: center; gap: 6px; padding: 10px 6px; text-align: center; }
  .mfd-card { padding: 16px; }
  .mfd-perm th, .mfd-perm td { padding: 8px 4px; }
  .mfd-perm thead th { font-size: 12px; }
}
@container (min-width: 560px) {
  .mfd-facs { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .mfd-facs li { position: relative; grid-template-rows: auto 1fr; }
  .mfd-facs li::after { content: ""; position: absolute; left: 50%; bottom: -14px; width: 2px; height: 14px; background: var(--blue); }
  .mfd-corebar ul { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .mfd-corebar li { text-align: center; }
}
@container (min-width: 640px) {
  .mfd-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); grid-template-areas: "perm place" "perm log" "ai ai"; }
  .mfd-perm { grid-area: perm; }
  .mfd-place { grid-area: place; }
  .mfd-log { grid-area: log; }
  .mfd-ai { grid-area: ai; }
}
