/* The drawing uses physical pixel coordinates shared by its cards and SVG paths. */
.production-panel {
  --pt-paper: #172628;
  --pt-trace: #91c4a9;
  --pt-build: #88adb8;
  container:production-panel / inline-size;
  min-width: 0;
  overflow: hidden;
}

.production-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  gap: 7px 12px;
  padding: 6px 14px;
  border-bottom: 1px solid #41514e;
  background: #242b2a;
}
.production-heading h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #eeede1;
  font: 700 20px/1.05 var(--display);
}
.production-heading h2 svg {
  width: 18px;
  height: 18px;
  color: var(--amber);
}
.work-view-tabs {
  display: inline-flex;
  align-items: stretch;
  gap: 2px;
  max-width: 100%;
  padding: 2px;
  border: 1px solid #424c47;
  border-radius: 4px;
  background: #19211f;
}
.work-view-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 31px;
  padding: 4px 9px;
  border: 1px solid transparent;
  border-radius: 2px;
  color: #b9c2b8;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.16;
}
.work-view-tabs svg {
  width: 14px;
  height: 14px;
}
.work-view-tabs button:is(.active, [aria-pressed='true']) {
  color: #f3d6ac;
  border-color: #877152;
  background: #3d392f;
}
.work-view-tabs button:focus-visible {
  outline: 2px solid #f9ca89;
  outline-offset: 1px;
}

.production-tree {
  position: relative;
  isolation: isolate;
  min-width: 0;
  max-width: 100%;
  max-height: 410px;
  overflow: auto;
  overscroll-behavior-inline: contain;
  touch-action: pan-x pan-y;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: #697f77 #202c2b;
  scrollbar-width: thin;
  background-color: var(--pt-paper);
  background-image:
    radial-gradient(circle at 1px 1px, #56706b91 1px, transparent 1.5px),
    linear-gradient(90deg, #88b1a20b 1px, transparent 1px),
    linear-gradient(#88b1a20b 1px, transparent 1px),
    linear-gradient(115deg, #2a4e4b38, transparent 78%);
  background-size:
    64px 64px,
    16px 16px,
    16px 16px,
    100% 100%;
  background-attachment: local;
}
.production-tree:focus-visible {
  outline: 2px solid var(--pt-build);
  outline-offset: -2px;
}
.pt-canvas {
  margin-inline:auto;
  position: relative;
  isolation: isolate;
}
.pt-lines {
  position: absolute;
  z-index: 0;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.pt-clearance, .pt-edge {
  fill: none;
  stroke-linecap: butt;
  stroke-linejoin: miter;
  vector-effect: non-scaling-stroke;
}
.pt-clearance {
  stroke: var(--pt-paper);
  stroke-width: 5px;
}
.pt-zone {
  position:absolute; z-index:-1; inset-inline:0;
  border-block:1px solid #78948725;
  background:linear-gradient(90deg,#20342f 0,#24413b55 50%,#1a2c290d);
  color:#acc7b3; pointer-events:none;
}
.pt-zone.zone-power {color:#e2c787;background:linear-gradient(90deg,#343328,#3a382532 50%,transparent)}
.pt-zone.zone-processing {color:#b7cdd3;background:linear-gradient(90deg,#253638,#2c3f4255 50%,transparent)}
.pt-zone.zone-assembly {color:#d4b193;background:linear-gradient(90deg,#37312b,#3e352e55 50%,transparent)}
.pt-tier {
  display:grid; align-content:center; justify-items:start; gap:4px;
  width:108px; padding:8px 6px 8px 11px; min-height:64px;
  font:600 13px/1.1 var(--display); overflow-wrap:anywhere;
}
.pt-canvas.compact .pt-tier {width:72px;padding-inline:5px;font-size:11px}
.pt-canvas.compact .pt-tier svg {width:14px;height:14px}
.pt-node.unrelated:not(:hover,:focus-visible) {border-color:#5c655b;background:#2a332f}

.pt-node {
  --pt-accent: #84aa93;
  --pt-body: #2c3731;
  --pt-seam: #607165;
  position: absolute;
  z-index: 2;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  box-sizing: border-box;
  width: 168px;
  height: 68px;
  padding: 4px;
  border: 1px solid var(--pt-seam);
  border-top: 2px solid var(--pt-accent);
  border-radius: 3px;
  box-shadow: 0 2px 0 #0c1718a6;
  background: var(--pt-body);
  color: #f0efe3;
  text-align: left;
  touch-action: manipulation;
}
.pt-node[data-kind='machine'] {
  --pt-accent: #c79869;
  --pt-body: #38352e;
  --pt-seam: #746a57;
}
/* Arrows terminate directly on the upper or lower edge of each card. */
.pt-canvas.compact .pt-node {grid-template-columns:22px minmax(0,1fr);gap:3px;padding:3px}
.pt-canvas.compact .pt-node> .sprite {width:22px;height:22px}
.pt-canvas.compact .pt-copy strong {font-size:13px}
.pt-canvas.compact .pt-copy small {font-size:9px}

.pt-node > :is(.sprite, svg) {
  display: block;
  width: 36px;
  height: 36px;
  object-fit: contain;
  image-rendering: pixelated;
}
.pt-node > svg {
  color: var(--pt-accent);
}
.pt-copy {
  display: grid;
  align-content: center;
  gap: 2px;
  min-width: 0;
}
.pt-copy strong {
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  hyphens: auto;
  color: #f1efe4;
  font: 700 14.5px/1.04 var(--display);
  letter-spacing: -0.015em;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.pt-copy small {
  overflow: hidden;
  color: #c0c9bc;
  font: 10px/1.18 var(--mono);
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pt-node.recent {
  box-shadow:
    0 0 0 1px var(--pt-trace),
    0 2px 0 #0c1718a6;
}
.pt-node:is(.selected, [aria-pressed='true']) {
  z-index: 3;
  outline: 2px solid #e9ad68;
  outline-offset: 2px;
}
.pt-node:focus-visible {
  z-index: 4;
  outline: 2px solid #fff1c9;
  outline-offset: 3px;
}
@media (hover: hover) {
  .work-view-tabs button:hover {
    background-color: #343c35;
  }
  .pt-node:hover {
    border-color: #c4c6ae;
  }
}

.pt-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px 13px;
  min-height: 38px;
  padding: 7px 13px;
  border-top: 1px solid #42524c;
  color: #c7d0c3;
  background: #222d29;
  font-size: 11px;
  line-height: 1.2;
}
@media (max-width: 620px) {
  .production-heading {
    gap: 5px 8px;
    padding: 5px 9px;
  }
  .production-heading h2 {
    gap: 5px;
    font-size: 18px;
  }
  .work-view-tabs button {
    min-height: 36px;
    padding: 4px 7px;
    font-size: 11px;
  }
  .production-tree {
    max-height: 350px;
  }
  .pt-legend {
    gap: 6px 10px;
    padding: 7px 9px;
    font-size: 10px;
  }

}
@media (forced-colors: active) {
  .pt-node {
    border: 1px solid ButtonText;
  }
  .pt-node:is(.selected, :focus-visible) {
    outline-color: Highlight;
  }
  .pt-edge {
    stroke: CanvasText !important;
  }
}
.pt-finder {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #c2cfc4;
  font-size: 11px;
}
.pt-finder select {
  max-width: min(148px, 40vw);
  min-height: 29px;
  color: #e6e8d8;
  background: #29342f;
  border: 1px solid #536458;
  border-radius: 3px;
}
.pt-copy small {
  display: flex;
  flex-wrap: wrap;
  gap: 0 5px;
  white-space: normal;
  line-height: 1.05;
}
.pt-copy small span {
  white-space: nowrap;
}
.pt-rate {
  color: #b6ceb6;
}
.pt-node:active {filter:brightness(1.15)}
.material-formula {margin-block:10px}
.material-formula h3 {margin:0 0 4px;font-size:13px}
.material-formula > div {display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.work-link {display:inline-flex;align-items:center;gap:6px;min-height:36px}
.catalog :is(.unavailable-order,.buildbtn):focus-visible {outline:2px solid #f2cc98;outline-offset:3px}
.work-scene {
  --stage-height:clamp(224px,min(53vw,58svh),540px);
  min-width:0;
  overflow:hidden;
}
.work-scene .production-heading {
  display:grid;grid-template-columns:minmax(0,1fr) auto;min-height:52px;
}
.work-scene .production-heading h2 {
  min-width:0;margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.work-scene .production-heading h2 span {overflow:hidden;text-overflow:ellipsis}
.work-scene .production-heading h2 svg {flex:none}
.work-stage {position:relative;height:var(--stage-height);isolation:isolate;overflow:hidden;min-width:0}
.tree-stage {display:grid;grid-template-rows:auto minmax(0,1fr);background:#172628}
.tree-stage > .production-tree {grid-row:2;min-height:0;max-height:none;height:100%}
.tree-stage .pt-legend {
  grid-row:1;flex-wrap:nowrap;justify-content:space-between;gap:6px;
  min-height:41px;padding:3px 8px;border:0;border-bottom:1px solid #45534d;
}
.pt-legend .pt-finder {margin:0;min-width:0}
.pt-legend .pt-finder select {
  max-width:100%; min-width:0; height:35px;
  padding-block:3px; padding-inline:12px 2.25em;
  text-align:start; text-overflow:ellipsis;
}
.pt-legend .pt-finder svg {flex:none;color:#adbdad}
.pt-empty {display:grid;gap:8px;place-content:center;justify-items:center;color:var(--soft);height:100%;margin:0}
.tree-stage:has(.pt-empty) {display:block}
.pt-filters .pt-inspector {display:inline-grid;place-items:center;flex:none;width:38px;min-height:38px;border:1px solid #57665a;border-radius:3px;background:#2b3631;color:var(--ink)}
.pt-filters .pt-inspector:focus-visible {outline:2px solid var(--amber)}
@media(max-width:620px) {
  .work-scene .production-heading {min-height:48px}
  .work-scene .production-heading h2 {font-size:16px}
  .work-scene .production-heading h2 svg {display:none}
  .pt-legend .pt-finder select {max-width:37vw}
}

/* CSS container units refer to the drawing viewport, not the page. */
.production-tree {container:network / size;direction:ltr;scroll-padding:20px}
.pt-node {scroll-margin:8px}
.pt-plane {width:max-content;margin-inline:auto;box-sizing:content-box}
.pt-node.found {
  z-index:3;outline:3px solid #ffdc94;outline-offset:2px;
  box-shadow:inset 4px 0 #ffdc94,0 2px 0 #0c1718a6;
}
.pt-node.found:focus-visible {outline:3px double #fff2d3;outline-offset:3px}
.pt-filters,.pt-route-key,.pt-route-key li {display:flex;align-items:center}
.pt-filters {gap:8px;min-width:0;max-width:100%}
.pt-legend .pt-finder {flex:1 1 auto}
.pt-route-key {list-style:none;gap:4px 12px;padding:0;margin:0;flex-wrap:wrap;justify-content:flex-end}
.pt-route-key li {gap:4px;color:#dce4d5;font-size:11px;white-space:nowrap}
.pt-route-key svg {flex:none}
/* The chart and key use the same links, inks, dash periods and arrow definitions.
   Motion only advances their stroke phase. A paused view keeps the same reading. */
.route-material {--route-ink:#9bcfaf;--rest-ink:#82998c;--dash:12 4;--period:-16}
.route-power {--route-ink:#f0d47f;--rest-ink:#ab9e72;--dash:3 3;--period:-6}
.route-idle {--route-ink:var(--rest-ink)}
.pt-edge {stroke:var(--route-ink);stroke-width:2px;stroke-dasharray:var(--dash)}
.pt-edge.route-live {stroke-width:2.5px}
.pt-edge.route-idle {stroke-width:1.5px}
.pt-arrow {fill:var(--route-ink)}
@keyframes pt-current { to {stroke-dashoffset:var(--period)} }
@media(prefers-reduced-motion:no-preference){
  html:not([data-motion='reduce']):not([data-paused='true']) .pt-edge.route-live {animation:pt-current 1.6s linear infinite}
}
@container production-panel (max-width: 900px) {
  .tree-stage .pt-legend {align-items:stretch;flex-direction:column;gap:4px;padding:4px 7px}
  .pt-filters {width:min(100%,32rem)}
  .pt-legend .pt-finder select {max-width:100%}
  .pt-filters .pt-finder {flex:1 1 0}
  .pt-finder select {width:100%}
  .pt-route-key {justify-content:flex-start}
  .pt-route-key li {font-size:11px}
}
@container production-panel (max-width:450px) {
  .pt-filters .pt-finder > svg {display:none}
  .pt-filters {display:flex;gap:6px}
  .pt-legend .pt-filters select,.pt-filters .pt-inspector {min-height:44px}
}
@media(forced-colors:active){
  .pt-node.found {outline-color:Highlight}
  .pt-arrow {fill:CanvasText}
}
