:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --line: #d8e0e3;
  --text: #172024;
  --muted: #5d6b71;
  --accent: #1f7a6b;
  --accent-strong: #14584d;
  --warn: #b74835;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Yu Gothic UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
.file-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 7px 12px;
  cursor: pointer;
}

button:hover,
.file-button:hover {
  border-color: var(--accent);
}

button.active {
  border-color: var(--accent);
  background: #eef8f5;
  color: var(--accent-strong);
  font-weight: 700;
}

button.saved-pulse {
  animation: button-saved-pulse 0.75s ease-out;
}

@keyframes button-saved-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(31, 122, 107, 0.42);
  }
  65% {
    box-shadow: 0 0 0 8px rgba(31, 122, 107, 0);
    border-color: var(--accent);
    background: #eef8f5;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(31, 122, 107, 0);
  }
}

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #172024;
}

.primary:hover {
  background: var(--accent-strong);
}

.file-button input {
  display: none;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 28px;
  background: #162428;
  color: #fff;
}

.app-header h1 {
  margin: 2px 0 0;
  font-size: 28px;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0;
  color: #a9c8c1;
  font-size: 13px;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.language-control {
  display: inline-grid;
  grid-template-columns: auto 148px;
  align-items: center;
  gap: 6px;
  color: #d5e5e2;
  font-size: 13px;
}

.language-control select {
  min-height: 36px;
  padding: 7px 10px;
}

.layout {
  display: grid;
  gap: 12px;
  padding: 18px 24px;
  max-width: 2560px;
  margin: 0 auto;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  align-items: end;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 14px;
}

.header-actions .status-line {
  color: #a9c8c1;
}

.field label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
}

.status-line {
  color: var(--muted);
  text-align: right;
  min-width: 160px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.legacy-summary-store {
  display: none !important;
}

.display-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 0;
}

.display-controls label {
  display: grid;
  grid-template-columns: auto 110px;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.display-controls .checkbox-control {
  grid-template-columns: auto auto;
  gap: 7px;
}

.checkbox-control input {
  width: auto;
}

.trade-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 14px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.trade-inputs {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}

.trade-inputs label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.trade-inputs .trade-preset-control {
  grid-column: 1 / -1;
  grid-template-columns: minmax(180px, 260px) minmax(240px, 420px) minmax(260px, 1fr);
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid #8fc7b8;
  border-left: 4px solid var(--accent);
  background: #eef8f5;
  color: var(--text);
}

.trade-inputs .checkbox-control {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  align-content: start;
}

.trade-preset-control span {
  font-weight: 700;
}

.trade-preset-control small {
  color: #45615b;
  font-size: 12px;
}

.trade-result {
  border: 1px solid var(--line);
  background: #f7fbfa;
  padding: 12px;
}

.trade-result span,
.trade-result small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.trade-hourly-comparison {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin: 4px 0;
}

.trade-hourly-comparison strong {
  margin: 0;
}

.trade-hourly-comparison small {
  display: inline;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
}

.trade-comparison-operator {
  display: inline;
  color: var(--muted);
  font-size: 18px;
  font-weight: 800;
}

#tradeBestNote {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: center;
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.45;
}

.trade-result .trade-usage-label {
  display: inline;
  white-space: nowrap;
  font-weight: 700;
  color: var(--text);
}

.trade-result .trade-usage-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.trade-result .trade-usage-item {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  white-space: nowrap;
}

.trade-result .trade-usage-value {
  display: inline-flex;
  gap: 1px;
  align-items: baseline;
  white-space: nowrap;
}

.trade-result .trade-usage-under {
  display: inline-block;
  padding: 1px 4px;
  border-radius: 4px;
  background: #fff1d6;
  color: #b45309;
  font-weight: 700;
}

.trade-result strong {
  display: block;
  margin: 4px 0;
  font-size: 28px;
}

.trade-hourly-comparison.trade-value-good strong,
.trade-hourly-comparison.trade-value-good .trade-comparison-operator {
  color: #047857;
}

.trade-hourly-comparison.trade-value-bad strong,
.trade-hourly-comparison.trade-value-bad .trade-comparison-operator {
  color: #dc2626;
}

.trade-limit-input {
  width: 72px;
  min-width: 0;
  padding: 5px 6px;
  text-align: right;
}

.trade-reuse-value-list {
  display: grid;
  gap: 3px;
  min-width: 84px;
}

.trade-reuse-value-list span {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  white-space: nowrap;
}

.trade-reuse-value-list img {
  width: 20px;
  height: 20px;
}

.trade-reuse-value-list b {
  color: var(--accent-strong);
  font-size: 12px;
}

th.trade-recommended-count-head,
td.trade-recommended-count {
  background: rgba(238, 248, 245, 0.78);
}

th.trade-recommended-count-head {
  color: var(--accent-strong);
  font-weight: 800;
}

td.trade-recommended-count {
  color: var(--accent-strong);
  font-size: 15px;
  font-weight: 800;
  text-align: right;
}

tr:not(.target-row) td.trade-recommended-count {
  color: #6b7b7c;
  font-weight: 700;
}

.tab-bar {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.tab-button {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  color: var(--muted);
}

.tab-button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.view {
  display: grid;
  gap: 16px;
}

.view[hidden] {
  display: none;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 8px 10px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.metric strong {
  display: block;
  margin-top: 2px;
  font-size: 20px;
  line-height: 1.22;
}

.metric-lines {
  white-space: pre-line;
  font-size: 16px;
  line-height: 1.28;
}

.metric-subline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 7px;
  align-items: center;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
}

.metric .metric-subline,
.metric .metric-subline > span {
  display: flex;
}

.metric-power-top {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.diff-body {
  display: grid;
  gap: 12px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
}

.diff-body[hidden] {
  display: none;
}

.diff-open-button {
  justify-self: start;
}

.diff-overlay {
  position: fixed;
  inset: 44px 24px auto 24px;
  z-index: 60;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: calc(100vh - 88px);
  box-shadow: 0 16px 36px rgba(22, 34, 39, 0.2);
}

.diff-overlay[hidden] {
  display: none;
}

.diff-overlay .diff-body {
  overflow: auto;
  min-height: 0;
}

.diff-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
}

.diff-section h3,
.diff-table-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.diff-metric {
  border: 1px solid var(--line);
  background: #f8fbfb;
  padding: 8px 10px;
}

.diff-metric span,
.diff-metric em {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.diff-metric strong {
  display: block;
  margin: 2px 0;
  font-size: 18px;
}

.diff-metric-details {
  margin-top: 6px;
  border-top: 1px solid var(--line);
  padding-top: 5px;
}

.diff-metric-details summary {
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.diff-metric-details dl {
  display: grid;
  gap: 3px;
  margin: 6px 0 0;
}

.diff-metric-details div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: baseline;
}

.diff-metric-details dt,
.diff-metric-details dd {
  margin: 0;
  font-size: 12px;
}

.diff-metric-details dt {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.diff-metric-details dd {
  font-weight: 700;
  white-space: nowrap;
}

.diff-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.diff-table-card {
  min-width: 0;
}

.diff-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.diff-table th,
.diff-table td {
  border: 1px solid var(--line);
  padding: 6px 7px;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.diff-table tr[data-diff-focus-type] {
  cursor: pointer;
}

.diff-table tr[data-diff-focus-type]:hover td {
  background: #fff8e8;
}

#facilityBody tr[data-facility-focus] {
  cursor: pointer;
}

#facilityBody tr[data-facility-focus]:hover td {
  background: #fff8e8;
}

.facility-consistency-warning td {
  background: #fff8e8;
}

.facility-diagram-count {
  display: grid;
  gap: 2px;
  justify-items: start;
}

.facility-consistency {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.facility-consistency.ok,
.facility-consistency-summary.ok {
  color: #047857;
}

.facility-consistency.warn,
.facility-consistency-summary.warn {
  color: #b45309;
}

.diff-table th {
  background: #eaf1f3;
  color: #45565d;
  font-weight: 700;
}

.diff-empty {
  border: 1px dashed var(--line);
  background: #f8fbfb;
  color: var(--muted);
  padding: 10px;
  font-size: 13px;
}

.diff-feedback {
  border: 1px solid #8fc7b8;
  border-left: 4px solid var(--accent);
  background: #eef8f5;
  color: #14584d;
  padding: 9px 10px;
  font-size: 13px;
  font-weight: 700;
}

.diff-timestamps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  color: var(--muted);
  font-size: 12px;
}

.diff-timestamps strong {
  color: var(--text);
  font-weight: 700;
}

.diff-metric.positive em,
.diff-table .positive {
  color: #047857;
  font-weight: 700;
}

.diff-metric.negative em,
.diff-table .negative {
  color: var(--warn);
  font-weight: 700;
}

.diff-metric.neutral em,
.diff-table .neutral {
  color: var(--muted);
}

.water-row.fluid {
  box-shadow: inset 3px 0 0 #188d8f;
}

.water-row.waste {
  box-shadow: inset 3px 0 0 #7d6ab0;
}

.water-row {
  cursor: pointer;
}

.water-row.focused {
  outline: 2px solid rgba(214, 139, 0, 0.45);
  outline-offset: -2px;
  background: rgba(255, 244, 220, 0.55);
}

.water-row.focus-pulse {
  animation: water-row-focus-pulse 0.55s ease-out 2;
}

@keyframes water-row-focus-pulse {
  0% {
    background: rgba(255, 244, 220, 0.4);
  }
  48% {
    background: rgba(255, 222, 150, 0.95);
  }
  100% {
    background: rgba(255, 244, 220, 0.55);
  }
}

.water-flow-cell {
  display: grid;
  gap: 2px;
}

.water-flow-cell .muted {
  font-size: 12px;
}

.water-link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 150px;
}

.water-link-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 210px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  font-size: 12px;
}

.water-link-chip .image-label {
  min-width: 0;
}

.water-link-chip .image-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.water-link-chip .image-label img {
  width: 24px;
  height: 24px;
}

.water-reuse-control {
  display: grid;
  gap: 4px;
  min-width: 190px;
}

.water-reuse-control select {
  width: 100%;
  max-width: 260px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

.byproduct-audit-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 10px;
  padding: 12px;
}

.empty-note {
  margin: 0;
  color: var(--muted);
}

.byproduct-audit-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.94);
  padding: 10px;
  box-shadow: 0 2px 10px rgba(23, 32, 36, 0.06);
}

.byproduct-audit-card.fluid {
  box-shadow: inset 3px 0 0 #188d8f, 0 2px 10px rgba(23, 32, 36, 0.06);
}

.byproduct-audit-card.waste {
  box-shadow: inset 3px 0 0 #7d6ab0, 0 2px 10px rgba(23, 32, 36, 0.06);
}

.byproduct-audit-card.focused {
  outline: 2px solid rgba(214, 139, 0, 0.45);
  outline-offset: -2px;
  background: rgba(255, 244, 220, 0.55);
}

.byproduct-audit-card.focus-pulse {
  animation: water-row-focus-pulse 0.55s ease-out 2;
}

.byproduct-audit-main {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) max-content minmax(0, 1.3fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.byproduct-audit-compact-summary {
  display: grid;
  grid-template-columns: minmax(150px, 1.1fr) minmax(110px, 0.8fr) minmax(190px, 1.2fr) repeat(4, minmax(78px, 0.5fr));
  gap: 8px 10px;
  align-items: center;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid rgba(31, 122, 107, 0.14);
  border-radius: 7px;
  background: rgba(248, 252, 251, 0.82);
}

.byproduct-audit-compact-summary > span {
  min-width: 0;
}

.byproduct-audit-flow {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.byproduct-audit-compact-summary > span:not(.byproduct-audit-title):not(.byproduct-audit-flow):not(.byproduct-audit-source) {
  display: grid;
  gap: 2px;
}

.byproduct-audit-compact-summary small,
.byproduct-audit-source.compact small {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
}

.byproduct-audit-compact-summary b {
  color: var(--text);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.byproduct-audit-compact-summary .warn b {
  color: var(--warn);
}

.byproduct-audit-compact-summary .ok b {
  color: var(--accent-strong);
}

.byproduct-audit-title,
.byproduct-audit-source {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.byproduct-audit-title .image-label span,
.byproduct-audit-source .image-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.byproduct-audit-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.byproduct-audit-metrics span {
  display: grid;
  gap: 2px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f9fbfb;
  padding: 6px 8px;
}

.byproduct-audit-metrics small {
  color: var(--muted);
  font-size: 11px;
}

.byproduct-audit-metrics b {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.byproduct-audit-metrics .warn b {
  color: var(--warn);
}

.byproduct-audit-metrics .ok b {
  color: var(--accent-strong);
}

.byproduct-audit-metrics .image-label {
  min-width: 0;
}

.byproduct-audit-metrics .image-label img {
  width: 22px;
  height: 22px;
}

.byproduct-reuse-candidates {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px dashed rgba(0, 112, 92, 0.28);
  border-radius: 7px;
  background: rgba(0, 112, 92, 0.04);
}

.byproduct-reuse-candidates > strong {
  color: var(--accent-strong);
  font-size: 12px;
}

.byproduct-reuse-candidates > p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.byproduct-reuse-candidate-list {
  display: grid;
  gap: 5px;
}

.byproduct-reuse-candidate {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.75);
}

.byproduct-reuse-candidate.active {
  border-color: rgba(0, 112, 92, 0.35);
  background: rgba(0, 112, 92, 0.08);
}

.byproduct-reuse-candidate-main {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 8px;
  align-items: center;
  min-width: 0;
}

.byproduct-reuse-candidate-main .image-label span {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.byproduct-reuse-candidate button {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 12px;
}

.byproduct-generation-trace {
  margin-top: 6px;
}

.byproduct-generation-formula {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 8px;
  align-items: center;
  margin: 6px 0;
  padding: 7px 8px;
  border: 1px solid rgba(31, 122, 107, 0.18);
  border-radius: 7px;
  background: rgba(255, 250, 238, 0.72);
  font-size: 12px;
}

.byproduct-generation-formula > span:first-child {
  color: var(--accent-strong);
  font-weight: 700;
}

.byproduct-generation-formula .image-label img {
  width: 22px;
  height: 22px;
}

.byproduct-generation-formula b {
  color: var(--accent-strong);
  font-size: 14px;
}

.byproduct-route-flow {
  display: grid;
  gap: 8px;
  padding: 9px;
  border: 1px solid rgba(0, 112, 92, 0.22);
  border-radius: 7px;
  background: rgba(248, 252, 251, 0.92);
}

.byproduct-route-flow-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: baseline;
}

.byproduct-route-flow-head strong {
  color: var(--accent-strong);
  font-size: 12px;
}

.byproduct-route-flow-head span {
  color: var(--muted);
  font-size: 11px;
}

.byproduct-route-flow-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}

.byproduct-route-option {
  position: relative;
  display: grid;
  gap: 5px;
  align-content: start;
  min-height: 64px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  text-align: left;
}

.byproduct-route-option-table {
  display: grid;
  gap: 6px;
}

.byproduct-route-option-table .byproduct-route-option-row {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) repeat(4, 92px);
  gap: 6px;
  align-items: center;
}

.byproduct-route-option-table .byproduct-route-option-head {
  display: grid;
  padding: 0 8px 0 10px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
}

.byproduct-route-option-table .byproduct-route-option {
  min-height: 44px;
  gap: 8px;
  align-content: center;
}

.byproduct-route-option-table .byproduct-route-option > small,
.byproduct-route-option-table .byproduct-route-option > b {
  display: none;
}

.byproduct-route-option-table .byproduct-route-option .blueprint-reuse-preview,
.byproduct-route-option-table .byproduct-route-option .blueprint-reuse-preview-grid {
  display: contents;
}

.byproduct-route-option-table .blueprint-reuse-preview {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.byproduct-route-option-table .blueprint-reuse-preview-metric {
  justify-self: start;
  width: 100%;
}

.byproduct-route-option-table .blueprint-reuse-preview-metric > small {
  display: none;
}

.byproduct-route-option-table .blueprint-reuse-preview-metric > strong {
  justify-content: flex-start;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.byproduct-route-option-table .byproduct-trade-equivalent {
  grid-column: 1 / 2;
  grid-row: 2;
  align-self: start;
}

.byproduct-route-option-table .byproduct-route-overflow {
  grid-column: 2 / -1;
  grid-row: 2;
  align-self: start;
}

.byproduct-route-option:not(.disabled):hover {
  border-color: rgba(0, 112, 92, 0.38);
  background: #fffdf5;
}

.byproduct-route-option.selected {
  border-color: var(--accent);
  background: rgba(20, 132, 120, 0.09);
  box-shadow: inset 3px 0 0 var(--accent);
}

.byproduct-route-option .blueprint-reuse-preview {
  margin-top: 3px;
  padding: 6px;
  background: rgba(240, 250, 248, 0.72);
}

.byproduct-route-option .blueprint-reuse-preview-grid {
  grid-template-columns: minmax(90px, max-content) max-content;
  gap: 3px 10px;
}

.byproduct-route-option.disabled {
  color: var(--muted);
  cursor: default;
  opacity: 0.72;
}

.byproduct-route-option-title {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  min-width: 0;
}

.byproduct-route-option-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  border-radius: 5px;
  background: #eef3f3;
}

.byproduct-route-option b {
  color: var(--accent-strong);
  font-size: 14px;
}

.byproduct-route-option small {
  color: var(--muted);
  font-size: 11px;
}

.byproduct-route-overflow {
  margin: 0;
  color: var(--warn);
  font-size: 11px;
  font-weight: 700;
}

.byproduct-audit-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: start;
}

.byproduct-audit-links.compact {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.byproduct-audit-links.compact > span {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  min-width: 0;
}

.byproduct-audit-links > div {
  display: grid;
  gap: 5px;
}

.byproduct-audit-links strong {
  color: var(--muted);
  font-size: 12px;
}

.diagram-link {
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--accent-strong);
}

.diagram-link.water-link-chip {
  min-height: 28px;
  padding: 3px 6px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  min-width: 0;
}

.blueprint-panel {
  position: relative;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 17px;
}

.blueprint-heading {
  justify-content: flex-start;
}

.blueprint-heading-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.blueprint-heading .panel-actions {
  flex: 1 1 auto;
  justify-content: flex-start;
  min-width: 0;
}

.blueprint-heading .display-rate-control {
  margin-left: auto;
  order: 20;
}

.blueprint-heading #facilityOverlayButton,
.blueprint-heading #recipeTracerButton,
.blueprint-heading #byproductAuditButton {
  order: 1;
  display: none;
}

.blueprint-insight-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(128px, 1fr));
  gap: 5px;
  flex: 1 1 auto;
  min-width: 320px;
  max-width: min(1320px, 100%);
  order: 1;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.recipe-tracer-overlay {
  position: fixed;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  z-index: 50;
  width: min(1320px, calc(100vw - 20px));
  height: min(680px, calc(100vh - 20px));
  max-height: min(680px, calc(100vh - 20px));
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(252, 254, 254, 0.96);
  box-shadow: 0 14px 34px rgba(31, 54, 69, 0.18);
  backdrop-filter: blur(8px);
}

.recipe-tracer-overlay[hidden] {
  display: none !important;
}

.byproduct-audit-overlay {
  width: min(1280px, calc(100vw - 20px));
  height: min(620px, calc(100vh - 20px));
  max-height: min(620px, calc(100vh - 20px));
}

.recipe-tracer-overlay.attention {
  animation: facility-overlay-attention 0.9s ease-out;
}

.recipe-tracer-overlay.dragging {
  user-select: none;
}

.recipe-tracer-overlay.resizing,
.facility-overlay.resizing {
  user-select: none;
}

.recipe-tracer-resize-handle {
  display: none;
}

.recipe-tracer-overlay.floating-insight-panel .recipe-tracer-resize-handle,
.facility-overlay.floating-insight-panel .recipe-tracer-resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  display: block;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
}

.recipe-tracer-overlay.floating-insight-panel .recipe-tracer-resize-handle::after,
.facility-overlay.floating-insight-panel .recipe-tracer-resize-handle::after {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 9px;
  height: 9px;
  border-right: 2px solid #8aa0a6;
  border-bottom: 2px solid #8aa0a6;
  content: "";
}

.recipe-tracer-top-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  min-width: 0;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.recipe-tracer-top-resource {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text);
  white-space: nowrap;
}

.recipe-tracer-top-resource .image-label {
  grid-template-columns: 18px minmax(0, auto);
  gap: 4px;
}

.recipe-tracer-top-resource .image-label img {
  width: 18px;
  height: 18px;
}

.recipe-tracer-top-resource b {
  color: var(--text);
  font-size: 12px;
}

.recipe-tracer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  cursor: move;
}

.recipe-tracer-warning {
  margin: 8px 10px 0;
  padding: 6px 8px;
  border: 1px solid #f2c88f;
  background: #fff8e8;
  color: #8a4b00;
  font-size: 12px;
  font-weight: 700;
}

.recipe-tracer-body {
  grid-row: 4;
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  min-height: 0;
  max-height: none;
  min-width: 0;
}

.recipe-tracer-items {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: rgba(246, 250, 250, 0.72);
}

.recipe-tracer-left-header {
  display: grid;
  gap: 7px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(203, 216, 221, 0.75);
}

.recipe-tracer-subhead {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.recipe-tracer-item-list,
.recipe-tracer-detail {
  min-height: 0;
  overflow: auto;
}

.recipe-tracer-item-list {
  max-height: none;
}

.recipe-tracer-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  width: 100%;
  gap: 4px 8px;
  align-items: center;
  min-height: 48px;
  padding: 6px 8px;
  border: 0;
  border-top: 1px solid rgba(203, 216, 221, 0.75);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.recipe-tracer-item:hover,
.recipe-tracer-item.active {
  background: rgba(20, 132, 120, 0.09);
}

.recipe-tracer-item.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.recipe-tracer-item .image-label {
  min-width: 0;
}

.recipe-tracer-item-rate {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.recipe-tracer-badges {
  display: flex;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  gap: 4px;
}

.recipe-tracer-badges span {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
}

.recipe-tracer-detail {
  padding: 10px;
  min-width: 0;
  min-height: 0;
}

.recipe-tracer-filter {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-start;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
}

.recipe-tracer-filter input {
  flex: 0 0 auto;
  width: auto;
  margin: 0;
  padding: 0;
}

.recipe-tracer-filter span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
}

.recipe-tracer-resource-summary {
  display: grid;
  gap: 5px;
  margin: 0 0 8px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbfb;
}

.recipe-tracer-resource-summary strong {
  color: var(--muted);
  font-size: 11px;
}

.recipe-tracer-resource-summary span {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.recipe-tracer-resource-summary b {
  color: var(--accent-strong);
  font-size: 12px;
  white-space: nowrap;
}

.recipe-tracer-target {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.byproduct-audit-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 8px 0 4px;
}

.byproduct-audit-summary span {
  display: inline-flex;
  gap: 5px;
  align-items: baseline;
  min-width: 0;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f9fbfb;
}

.byproduct-audit-summary small {
  color: var(--muted);
  font-size: 11px;
}

.byproduct-audit-summary b {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.byproduct-audit-summary .warn b {
  color: var(--warn);
}

.byproduct-audit-summary .ok b {
  color: var(--accent-strong);
}

.byproduct-material-balance {
  display: grid;
  gap: 5px;
  margin: 6px 0 8px;
  padding: 6px 8px;
  border: 1px solid rgba(31, 122, 107, 0.18);
  border-radius: 7px;
  background: rgba(238, 248, 245, 0.55);
}

.byproduct-material-balance-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--accent-strong);
  font-size: 12px;
}

.byproduct-material-balance-title span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.byproduct-material-balance-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 8px;
}

.byproduct-material-balance-cell {
  display: inline-flex;
  gap: 5px;
  align-items: baseline;
  min-width: 0;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
}

.byproduct-material-balance-cell small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.byproduct-material-balance-cell b {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.byproduct-material-balance-cell.warn b {
  color: var(--warn);
}

.byproduct-material-balance-cell.ok b {
  color: var(--accent-strong);
}

.byproduct-material-balance-cell.manual b {
  color: #6d5a9f;
}

.byproduct-material-balance-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  color: var(--muted);
  font-size: 11px;
}

.byproduct-consumer-breakdown {
  display: grid;
  gap: 5px;
  margin: 6px 0 10px;
  padding: 6px 8px;
  border: 1px solid rgba(31, 122, 107, 0.18);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.72);
}

.byproduct-consumer-breakdown-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--accent-strong);
  font-size: 12px;
}

.byproduct-consumer-breakdown-title span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.byproduct-consumer-breakdown-list {
  display: grid;
  gap: 2px;
}

.byproduct-consumer-breakdown-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content max-content max-content;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 3px 5px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.byproduct-consumer-breakdown-row:hover {
  background: rgba(0, 112, 92, 0.07);
}

.byproduct-consumer-breakdown-row.active {
  background: rgba(0, 112, 92, 0.1);
  box-shadow: inset 3px 0 0 var(--accent);
}

.byproduct-consumer-node {
  display: flex;
  gap: 4px;
  align-items: center;
  min-width: 0;
}

.byproduct-edge-endpoint {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  min-width: 0;
}

.byproduct-consumer-node .byproduct-inline-label {
  display: inline-grid;
  grid-template-columns: 22px auto;
  gap: 4px;
  align-items: center;
  min-width: 0;
}

.byproduct-consumer-node .byproduct-inline-label img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  border-radius: 4px;
  background: #eef3f3;
}

.byproduct-consumer-node .byproduct-inline-label span {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.byproduct-edge-endpoint .byproduct-inline-label + .byproduct-inline-label span {
  max-width: 86px;
  color: var(--muted);
  font-size: 11px;
}

.byproduct-consumer-rate {
  color: var(--accent-strong);
  font-weight: 700;
  white-space: nowrap;
}

.byproduct-consumer-routes {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.byproduct-audit-top-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
  background: #f8fbfb;
}

.byproduct-audit-top-metric {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.byproduct-audit-top-metric small,
.byproduct-audit-top-metric span,
.byproduct-audit-top-metric em {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.byproduct-audit-top-metric b {
  color: var(--text);
  font-size: 14px;
}

.byproduct-audit-top-metric em {
  min-width: 0;
  font-style: normal;
}

.byproduct-constrained-summary {
  display: grid;
  gap: 5px;
  padding: 7px;
  border: 1px solid rgba(183, 72, 53, 0.22);
  border-radius: 6px;
  background: rgba(183, 72, 53, 0.05);
}

.byproduct-constrained-summary strong {
  color: var(--muted);
  font-size: 11px;
}

.byproduct-constrained-summary > span {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.byproduct-constrained-summary .image-label {
  min-width: 0;
}

.byproduct-constrained-summary .image-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.byproduct-constrained-summary b {
  color: var(--warn);
  font-size: 12px;
  white-space: nowrap;
}

.byproduct-trade-equivalent {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-width: 0;
  color: var(--accent-strong);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}

.byproduct-trade-equivalent .image-label {
  min-width: 0;
}

.byproduct-trade-equivalent .image-label img {
  width: 20px;
  height: 20px;
}

.byproduct-trade-equivalent .image-label span {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.byproduct-audit-item-section {
  display: grid;
  gap: 5px;
}

.byproduct-audit-item-section + .byproduct-audit-item-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.byproduct-audit-item-section-title {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 3px 6px;
  border-radius: 5px;
  background: rgba(244, 248, 248, 0.94);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.byproduct-audit-route-head {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin: 12px 0 6px;
  color: var(--muted);
  font-size: 12px;
}

.byproduct-audit-route-head strong {
  color: var(--text);
  font-size: 13px;
}

.recipe-tracer-route-list {
  display: grid;
  gap: 6px;
  margin: 0 0 10px;
}

.recipe-tracer-route {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border: 1px solid var(--line);
  background: #fff;
  text-align: left;
}

.recipe-tracer-route span {
  overflow-wrap: anywhere;
  white-space: normal;
}

.recipe-tracer-route .byproduct-audit-route-label {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
}

.byproduct-audit-route-index {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #eef5f4;
  color: var(--accent-strong);
  font-size: 12px;
  line-height: 1;
}

.recipe-tracer-route .byproduct-audit-route-side {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  width: auto;
  white-space: nowrap;
}

.byproduct-audit-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fbfb;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

.byproduct-audit-status.unused {
  border-color: rgba(183, 72, 53, 0.35);
  background: rgba(183, 72, 53, 0.08);
  color: var(--warn);
}

.byproduct-audit-status.partial {
  border-color: rgba(214, 139, 0, 0.35);
  background: rgba(214, 139, 0, 0.1);
  color: #9a6100;
}

.byproduct-audit-status.reused {
  border-color: rgba(0, 112, 92, 0.3);
  background: rgba(0, 112, 92, 0.08);
  color: var(--accent-strong);
}

.byproduct-audit-status.manual {
  border-color: rgba(88, 111, 124, 0.35);
  background: rgba(88, 111, 124, 0.08);
  color: var(--muted);
}

.recipe-tracer-route em {
  display: inline-flex;
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 999px;
  background: #fff8e8;
  color: #8a4b00;
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}

.recipe-tracer-route.active {
  border-color: var(--accent);
  background: rgba(20, 132, 120, 0.08);
}

.recipe-tracer-conclusion {
  display: grid;
  gap: 5px;
  margin: 0 0 10px;
  padding: 8px 10px 8px 12px;
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  background: #f7faf9;
}

.recipe-tracer-conclusion-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  min-width: 0;
}

.recipe-tracer-conclusion-part {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--text);
  font-size: 12px;
}

.recipe-tracer-conclusion-part > span:first-child {
  color: var(--accent-strong);
  font-weight: 800;
}

.recipe-tracer-conclusion-result .image-label img {
  width: 28px;
  height: 28px;
}

.recipe-tracer-conclusion-part b {
  color: var(--accent-strong);
  font-size: 18px;
}

.recipe-tracer-conclusion-result b {
  font-size: 20px;
}

.recipe-tracer-conclusion-path {
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.recipe-tracer-conclusion-path > span:first-child {
  color: var(--accent-strong);
  font-weight: 800;
}

.recipe-tracer-conclusion-path .image-label {
  grid-template-columns: 20px minmax(0, auto);
}

.recipe-tracer-conclusion-path .image-label img {
  width: 20px;
  height: 20px;
}

.recipe-tracer-steps {
  display: block;
  gap: 8px;
  overflow-x: auto;
}

.recipe-tracer-step-table {
  width: auto;
  max-width: max-content;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
}

.recipe-tracer-step-table th {
  padding: 3px 8px;
  color: var(--muted);
  font-size: 11px;
  text-align: left;
  white-space: nowrap;
}

.tooltip-recipe-table.recipe-tracer-step-table th:nth-child(1) {
  width: 96px;
}

.tooltip-recipe-table.recipe-tracer-step-table th:nth-child(2) {
  width: 190px;
}

.tooltip-recipe-table.recipe-tracer-step-table th:nth-child(3) {
  width: 220px;
}

.tooltip-recipe-table.recipe-tracer-step-table th:nth-child(4) {
  width: 116px;
}

.tooltip-recipe-table.recipe-tracer-step-table th:nth-child(5) {
  width: 220px;
}

.tooltip-recipe-table.recipe-tracer-step-table th:nth-child(6) {
  width: 72px;
}

.tooltip-recipe-table.recipe-tracer-step-table th:nth-child(7) {
  width: 80px;
}

.facility-overlay-trace-details .tooltip-recipe-table.recipe-tracer-step-table th:nth-child(2) {
  width: 170px;
}

.facility-overlay-trace-details .tooltip-recipe-table.recipe-tracer-step-table th:nth-child(3),
.facility-overlay-trace-details .tooltip-recipe-table.recipe-tracer-step-table th:nth-child(4) {
  width: 96px;
}

.facility-overlay-trace-details .tooltip-recipe-table.recipe-tracer-step-table th:nth-child(5) {
  width: 112px;
}

.facility-overlay-trace-details .tooltip-recipe-table.recipe-tracer-step-table th:nth-child(6) {
  width: 220px;
}

.facility-overlay-trace-details .tooltip-recipe-table.recipe-tracer-step-table th:nth-child(7) {
  width: 116px;
}

.facility-overlay-trace-details .tooltip-recipe-table.recipe-tracer-step-table th:nth-child(8) {
  width: 220px;
}

.facility-overlay-trace-details .tooltip-recipe-table.recipe-tracer-step-table th:nth-child(9) {
  width: 72px;
}

.recipe-tracer-step-row td {
  padding: 4px 5px;
}

.recipe-tracer-rate-cell {
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.recipe-tracer-step-row .tooltip-material.highlighted {
  padding: 3px 4px;
  border: 1px solid rgba(31, 122, 107, 0.28);
  border-radius: 8px;
  background: rgba(31, 122, 107, 0.1);
  box-shadow: 0 1px 0 rgba(31, 122, 107, 0.08);
}

.recipe-tracer-step-conversion,
.recipe-tracer-step-formula,
.recipe-tracer-step-line-count {
  min-width: 0;
  white-space: nowrap;
}

.recipe-tracer-step-conversion-inner {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  justify-content: center;
}

.recipe-tracer-step-no {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.recipe-tracer-icon-only {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 5px;
  background: #eef3f3;
}

.recipe-tracer-icon-only img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.recipe-tracer-step-formula-inner {
  display: flex;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 5px;
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
}

.recipe-tracer-step-formula-inner b {
  color: var(--accent-strong);
  font-size: 13px;
}

.recipe-tracer-step-formula-inner .recipe-tracer-formula-result {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(31, 122, 107, 0.09);
}

.recipe-tracer-step-formula-inner .recipe-tracer-formula-anchor {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.recipe-tracer-step-formula-inner small {
  color: var(--muted);
  font-size: 11px;
}

.recipe-tracer-step-line-count {
  color: var(--text);
  font-size: 13px;
  text-align: center;
}

.recipe-tracer-step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
}

.recipe-tracer-step-index {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.recipe-tracer-step-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.recipe-tracer-step-title {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.recipe-tracer-step-card {
  display: grid;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid #dce7e9;
  border-radius: 7px;
  background: #fbfdfd;
}

.recipe-tracer-step-result {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.recipe-tracer-step-result b {
  color: var(--accent-strong);
  font-size: 18px;
}

.recipe-tracer-step-operator {
  color: var(--text);
  font-weight: 700;
}

.recipe-tracer-step-meta,
.recipe-tracer-recipe-compact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 10px;
  color: var(--muted);
  font-size: 12px;
}

.recipe-tracer-step-meta > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.recipe-tracer-step-meta .image-label {
  grid-template-columns: 18px minmax(0, auto);
}

.recipe-tracer-step-meta .image-label img {
  width: 18px;
  height: 18px;
}

.recipe-tracer-compact-label {
  color: var(--muted);
  font-weight: 700;
}

.recipe-tracer-compact-materials {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.recipe-tracer-compact-material {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  color: var(--muted);
}

.recipe-tracer-compact-material.active {
  color: var(--accent-strong);
  font-weight: 700;
}

.recipe-tracer-compact-material .image-label {
  grid-template-columns: 18px minmax(0, auto);
  gap: 2px;
}

.recipe-tracer-compact-material .image-label img {
  width: 18px;
  height: 18px;
}

.recipe-tracer-compact-material .image-label span {
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recipe-tracer-arrow {
  color: var(--muted);
}

.byproduct-audit-popup-body {
  grid-template-columns: minmax(250px, 310px) minmax(0, 1fr);
}

.byproduct-audit-popup-body .byproduct-audit-card {
  box-shadow: inset 3px 0 0 #188d8f, 0 2px 10px rgba(23, 32, 36, 0.06);
}

.byproduct-audit-empty {
  padding: 10px;
}

.insight-dock {
  display: block;
  padding: 8px;
  background: rgba(255, 255, 255, 0.98);
}

.insight-dock-tabs {
  display: none;
}

.insight-dock-tabs button {
  min-height: 32px;
  padding: 5px 9px;
  font-size: 12px;
  white-space: nowrap;
}

.insight-dock-body {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 7px;
  min-width: 0;
}

.blueprint-insight-cards .insight-dock-card {
  min-height: 42px;
  padding: 5px 6px;
}

.blueprint-insight-cards .insight-dock-card strong {
  font-size: 12px;
}

.blueprint-insight-cards .insight-dock-card span {
  font-size: 10.5px;
}

.insight-dock-card {
  display: grid;
  gap: 3px;
  align-content: start;
  min-width: 0;
  min-height: 0;
  padding: 7px 9px;
  text-align: left;
  border: 1px solid #d5e1e3;
  background: #f8fbfb;
  cursor: pointer;
}

.insight-dock-card:hover,
.insight-dock-card.active {
  border-color: var(--accent);
  background: #eef8f5;
}

.insight-dock-card.disabled:hover {
  border-color: #d5e1e3;
  background: #f8fbfb;
}

.insight-dock-card strong,
.insight-dock-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.insight-dock-card strong {
  color: var(--accent-strong);
  font-size: 12px;
}

.insight-dock-card span {
  color: var(--text);
  font-size: 11px;
}

.insight-dock-card > span,
.insight-dock-summary-line {
  color: var(--text);
  font-weight: 500;
  line-height: 1.5;
}

.insight-dock-value {
  color: #075c55;
  font-weight: 800;
}

.insight-item-metric {
  display: inline-flex;
  gap: 3px;
  align-items: center;
  white-space: nowrap;
}

.insight-item-metric img {
  width: 17px;
  height: 17px;
  object-fit: contain;
  border-radius: 3px;
  background: #eef3f3;
}

.insight-dock-card .insight-dock-subline {
  display: block;
  min-width: 0;
}

.insight-dock-card.disabled {
  opacity: 0.72;
  cursor: default;
}

.blueprint-insight-cards .insight-dock-card.disabled {
  opacity: 1;
}

.insight-dock .docked-insight-panel {
  position: relative;
  inset: auto;
  z-index: 1;
  width: 100%;
  height: auto;
  max-height: none;
  margin-top: 8px;
  border-radius: 8px;
  box-shadow: none;
  backdrop-filter: none;
}

.insight-dock .facility-overlay.docked-insight-panel,
.insight-dock .recipe-tracer-overlay.docked-insight-panel {
  display: grid;
}

.insight-dock .docked-insight-panel .facility-overlay-header,
.insight-dock .docked-insight-panel .recipe-tracer-header {
  cursor: grab;
  user-select: none;
}

.insight-dock .docked-insight-panel .facility-overlay-close,
.insight-dock .docked-insight-panel .recipe-tracer-close {
  display: none;
}

.insight-dock .floating-insight-panel {
  position: fixed;
}

.insight-panel-float-in {
  animation: insight-panel-float-in 0.26s ease-out;
}

.insight-panel-dock-in {
  animation: insight-panel-dock-in 0.24s ease-out;
}

@keyframes insight-panel-float-in {
  0% {
    opacity: 0.72;
    transform: translateY(18px) scale(0.985);
    box-shadow: 0 6px 18px rgba(29, 45, 53, 0.08);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes insight-panel-dock-in {
  0% {
    opacity: 0.78;
    transform: translateY(-10px) scale(1.008);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .insight-panel-float-in,
  .insight-panel-dock-in {
    animation: none;
  }
}

@media (max-width: 860px) {
  .recipe-tracer-body {
    grid-template-columns: 1fr;
  }

  .recipe-tracer-items {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .recipe-tracer-item-list {
    max-height: 190px;
  }

  body {
    padding-bottom: 0;
  }

  .insight-dock {
    padding: 8px;
  }

  .insight-dock-body {
    display: flex;
    overflow-x: auto;
  }

  .insight-dock-card {
    min-width: 210px;
  }
}

.display-rate-control {
  display: grid;
  grid-template-columns: auto 110px;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.optional-panel {
  padding: 0;
}

.optional-panel summary {
  cursor: pointer;
  padding: 12px 14px;
  color: var(--accent-strong);
  font-weight: 700;
}

.optional-heading {
  border-top: 1px solid var(--line);
}

.target-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.table-wrap {
  overflow-x: auto;
}

.large-table {
  max-height: 58vh;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f9fbfb;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th.trade-group-start,
td.trade-group-start {
  border-left: 1px solid #bfd0d5;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

td input,
td select {
  min-width: 150px;
}

.image-label {
  display: inline-grid;
  grid-template-columns: 28px auto;
  align-items: center;
  gap: 8px;
  min-height: 30px;
}

.image-label img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 4px;
  background: #eef3f3;
}

.rich-tooltip {
  position: fixed;
  z-index: 50;
  width: min(620px, calc(100vw - 20px));
  min-width: 260px;
  min-height: 180px;
  max-width: calc(100vw - 20px);
  max-height: min(620px, calc(100vh - 20px));
  overflow: auto;
  resize: both;
  border: 1px solid rgba(105, 128, 135, 0.38);
  border-radius: 8px;
  background: rgba(252, 254, 254, 0.94);
  box-shadow: 0 12px 32px rgba(22, 34, 39, 0.18);
  backdrop-filter: blur(8px);
  padding: 10px;
  pointer-events: auto;
}

.rich-tooltip.pinned {
  border-color: #8fc7b8;
  box-shadow: 0 14px 34px rgba(22, 34, 39, 0.22), 0 0 0 2px rgba(31, 122, 107, 0.08);
}

.rich-tooltip[hidden] {
  display: none;
}

.rich-tooltip-close {
  position: sticky;
  top: 0;
  float: right;
  z-index: 1;
  width: 24px;
  height: 24px;
  margin: -3px -3px 3px 8px;
  border-color: transparent;
  border-radius: 999px;
  background: rgba(247, 250, 250, 0.92);
  color: var(--muted);
  padding: 0;
  font-size: 17px;
  line-height: 1;
}

.rich-tooltip-close:hover {
  border-color: #cbdadd;
  color: var(--accent-strong);
}

.rich-tooltip-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  margin-bottom: 8px;
}

.rich-tooltip-title {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.rich-tooltip img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 5px;
  background: #eef3f3;
}

.rich-tooltip-heading strong {
  display: block;
  font-size: 14px;
}

.rich-tooltip-heading span,
.tooltip-note,
.tooltip-muted {
  color: var(--muted);
  font-size: 11px;
}

.rich-tooltip-section {
  display: grid;
  gap: 5px;
  margin-top: 8px;
}

.tooltip-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.tooltip-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tooltip-chip {
  display: inline-grid;
  grid-template-columns: 20px auto;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  border: 1px solid #d7e2e5;
  border-radius: 6px;
  background: rgba(247, 250, 250, 0.9);
  padding: 3px 6px 3px 4px;
  font-size: 11px;
}

.tooltip-chip img {
  width: 20px;
  height: 20px;
}

.facility-port-meta {
  margin-top: 4px;
  opacity: 0.78;
}

.tooltip-constrained-resources {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.tooltip-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}

.tooltip-meta span {
  border-radius: 999px;
  background: #eef3f3;
  padding: 2px 7px;
}

.tooltip-meta .tooltip-warning {
  background: #fff3d8;
  color: #9a5a00;
  font-weight: 700;
}

.tooltip-action-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.tooltip-heading-action {
  flex: 0 0 auto;
  margin-top: 0;
}

.tooltip-action-row button {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  padding: 3px 5px;
  font-size: 10px;
  font-weight: 500;
  opacity: 0.72;
}

.tooltip-action-row button:hover {
  border-color: #cbdadd;
  background: #f7fbfb;
  color: var(--accent-strong);
  opacity: 1;
}

.external-supply-panel > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.external-supply-panel > summary span:first-child {
  font-weight: 700;
}

.external-supply-panel[open] > summary {
  border-bottom: 1px solid var(--line);
}

.external-supply-tools {
  display: flex;
  justify-content: flex-end;
  padding: 8px 14px 0;
}

.external-supply-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid #8fc7b8;
  border-radius: 999px;
  background: #eef8f5;
  color: var(--accent-strong);
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
}

.external-supply-row.inactive td {
  color: var(--muted);
  background: #fafafa;
}

.transport-tooltip-meta span:last-child {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid #8fc7b8;
  background: #eef8f5;
  color: var(--accent-strong);
  font-weight: 700;
}

.transport-tooltip-meta img {
  width: 18px;
  height: 18px;
}

.transport-flow-structure {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.transport-flow-section {
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid rgba(31, 122, 107, 0.18);
  border-radius: 8px;
  background: rgba(239, 248, 246, 0.72);
}

.transport-flow-section-title {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.transport-flow-row {
  display: grid;
  grid-template-columns: minmax(118px, 1fr) max-content;
  gap: 10px;
  align-items: center;
  min-width: 0;
  min-height: 23px;
}

.transport-flow-row small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.transport-flow-row.child {
  margin-left: 5px;
  padding-left: 10px;
  border-left: 2px solid rgba(31, 122, 107, 0.18);
}

.transport-flow-row.muted {
  opacity: 0.48;
}

.transport-flow-row.muted .transport-flow-value {
  font-weight: 600;
}

.transport-flow-row.group {
  margin-top: 2px;
}

.transport-flow-row.group .transport-flow-value {
  display: none;
}

.transport-flow-row.total .transport-flow-value,
.transport-flow-row.adjusted .transport-flow-value {
  color: var(--accent-strong);
  font-weight: 800;
}

.transport-flow-row.negative .transport-flow-value {
  color: #b84432;
}

.transport-flow-value {
  min-width: 0;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
}

.transport-flow-value.rich {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  text-align: right;
}

.transport-origin-card {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding: 8px;
  border: 1px solid rgba(31, 122, 107, 0.18);
  border-radius: 8px;
  background: rgba(239, 248, 246, 0.72);
}

.transport-origin-card.compact {
  background: rgba(255, 250, 238, 0.76);
}

.transport-origin-row {
  display: grid;
  grid-template-columns: minmax(84px, max-content) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.transport-origin-row small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.transport-origin-row > span {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  min-width: 0;
}

.transport-origin-note {
  padding-top: 5px;
  border-top: 1px dashed rgba(31, 122, 107, 0.2);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
}

.transport-summary-overlay {
  min-width: min(760px, calc(100vw - 16px));
}

.transport-summary-top {
  gap: 16px;
}

.transport-summary-body {
  min-height: 360px;
}

.transport-summary-filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 6px;
  border-bottom: 1px solid var(--line);
}

.transport-summary-filter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border: 1px solid #ccdadd;
  border-radius: 999px;
  background: #fff;
  color: #344b52;
  font-size: 11px;
  font-weight: 700;
}

.transport-summary-filter.active {
  border-color: var(--accent);
  background: #e6f5f1;
  color: var(--accent-strong);
}

.transport-summary-row {
  grid-template-columns: minmax(112px, 1fr) max-content;
  align-items: start;
}

.transport-summary-route {
  grid-column: 1 / -1;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transport-summary-tag {
  border-color: #d4e1e4;
}

.transport-summary-tag.good {
  color: var(--accent-strong);
  background: #edf8f5;
}

.transport-summary-tag.warn {
  color: #8a5e19;
  background: #fff5df;
}

.transport-summary-tag.danger {
  color: #9e2f25;
  background: #fff0ee;
}

.transport-summary-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 7px;
  margin: 8px 0;
}

.transport-summary-metric {
  display: grid;
  gap: 5px;
  padding: 8px;
  border: 1px solid #d5e2e5;
  border-radius: 6px;
  background: #fbfdfd;
}

.transport-summary-metric small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.transport-summary-metric b {
  color: var(--ink);
  font-size: 14px;
}

.transport-summary-metric.danger b {
  color: #9e2f25;
}

.transport-summary-section {
  display: grid;
  gap: 7px;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid rgba(31, 122, 107, 0.16);
  border-radius: 7px;
  background: rgba(239, 248, 246, 0.56);
}

.transport-summary-flow-table {
  display: grid;
  grid-template-columns: repeat(5, minmax(92px, 1fr));
  gap: 5px;
}

.transport-summary-flow-row {
  display: grid;
  gap: 4px;
  padding: 6px;
  border: 1px solid #d8e4e7;
  border-radius: 6px;
  background: #fff;
}

.transport-summary-flow-row span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.transport-summary-flow-row b {
  color: var(--accent-strong);
}

.transport-summary-flow-row.muted {
  opacity: 0.45;
}

.transport-summary-connection {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 10px;
  align-items: center;
}

.transport-summary-connection > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.transport-summary-connection > b {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.tooltip-recipes {
  margin-top: 9px;
}

.tooltip-recipes summary,
.tooltip-recipe-heading {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.tooltip-recipes summary {
  cursor: pointer;
}

.tooltip-recipe-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  margin-top: 4px;
  font-size: 10px;
}

.tooltip-recipe-table th,
.tooltip-recipe-table td {
  border: 1px solid #d7e2e5;
  background: rgba(239, 246, 248, 0.72);
  padding: 3px;
  vertical-align: middle;
}

.tooltip-recipe-table th {
  background: rgba(226, 236, 239, 0.82);
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.tooltip-recipe-row.selected td {
  background: rgba(20, 128, 120, 0.08);
}

.tooltip-recipe-row.selected td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

.tooltip-recipe-table th:nth-child(1),
.tooltip-recipe-table th:nth-child(3) {
  width: 36%;
}

.tooltip-recipe-table th:nth-child(2) {
  width: 18%;
}

.tooltip-recipe-table th:nth-child(4) {
  width: 10%;
}

.tooltip-recipe-facility {
  text-align: center;
}

.tooltip-recipe-materials {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 4px;
  justify-content: center;
}

.tooltip-material {
  display: inline-grid;
  grid-template-rows: 24px 24px;
  justify-items: center;
  align-items: start;
  gap: 2px;
  width: 56px;
  min-height: 50px;
  color: #1f3f6d;
  font-size: 9px;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
}

.tooltip-material span {
  display: -webkit-box;
  min-height: 21px;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.tooltip-material.highlighted {
  font-weight: 700;
  color: var(--accent);
}

.tooltip-material img {
  width: 24px;
  height: 24px;
}

.tooltip-facility-cell {
  display: grid;
  grid-template-rows: 26px auto;
  justify-items: center;
  gap: 2px;
  width: 64px;
  margin: 0 auto;
  font-size: 9px;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
}

.tooltip-facility-cell img {
  width: 26px;
  height: 26px;
}

.tooltip-recipe-choice {
  display: inline-grid;
  grid-template-columns: 64px 16px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  min-height: 42px;
  margin: 0 auto;
  padding: 0;
  font-size: 9px;
  line-height: 1.15;
  text-align: center;
  cursor: pointer;
}

.tooltip-recipe-choice input {
  position: static;
  justify-self: center;
  margin: 0;
}

.tooltip-recipe-choice-facility {
  display: grid;
  grid-template-rows: 26px auto;
  justify-items: center;
  gap: 2px;
  width: 64px;
  margin: 0 auto;
}

.tooltip-recipe-choice-facility span {
  max-width: 64px;
  overflow-wrap: anywhere;
}

.tooltip-recipe-choice-facility img {
  width: 26px;
  height: 26px;
}

.tooltip-recipe-time {
  text-align: center;
  font-size: 10px;
  white-space: nowrap;
}

.tooltip-recipe-trial td {
  background: rgba(255, 248, 232, 0.9);
  border-top-style: dashed;
}

.tooltip-recipe-trial-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 6px;
  align-items: center;
  color: var(--muted);
  font-size: 10px;
}

.tooltip-recipe-trial-grid span {
  font-weight: 700;
}

.tooltip-recipe-trial-grid b {
  font-weight: 700;
}

.tooltip-recipe-trial-grid .positive {
  color: #047857;
}

.tooltip-recipe-trial-grid .negative {
  color: var(--warn);
}

.tooltip-recipe-trial-grid .neutral {
  color: var(--muted);
}

.target-product {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.target-selector {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.target-selector-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.target-product-palette {
  display: grid;
  grid-template-columns: repeat(auto-fill, 94px);
  justify-content: start;
  gap: 10px 4px;
  max-height: 270px;
  overflow: auto;
  padding: 2px 4px 4px 2px;
}

.target-product-card {
  position: relative;
  display: grid;
  place-items: start center;
  aspect-ratio: 1 / 1;
  min-height: 86px;
  overflow: hidden;
  padding: 4px 4px 20px;
  border-color: transparent;
  text-align: center;
  background: #fbfdfd;
  box-shadow: inset 0 0 0 1px var(--line);
}

.target-product-card img {
  width: min(82px, 94%);
  height: min(70px, calc(100% - 16px));
  object-fit: contain;
  border-radius: 0;
  background: transparent;
  transition: transform 0.12s ease-out;
}

.target-product-card:hover img {
  transform: scale(1.06);
}

.target-product-card:hover {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.target-product-name {
  position: absolute;
  right: 4px;
  bottom: 3px;
  left: 4px;
  z-index: 1;
  display: -webkit-box;
  overflow: hidden;
  color: #101820;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.18;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95),
    1px 0 0 rgba(255, 255, 255, 0.95),
    -1px 0 0 rgba(255, 255, 255, 0.95),
    0 -1px 0 rgba(255, 255, 255, 0.95);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.target-product-card.selected {
  z-index: 1;
  border-color: transparent;
  background: linear-gradient(180deg, #eef8f5, #f9fdfc);
  box-shadow: inset 0 0 0 2px var(--accent);
  color: var(--accent-strong);
  font-weight: 700;
}

.row-pick-button {
  min-height: 30px;
  padding: 5px 9px;
  color: var(--muted);
  font-size: 12px;
}

.active-target-row {
  background: #f0faf7;
}

.active-target-row td {
  color: #10262d;
}

#targetBody .target-product .image-label {
  font-weight: 800;
}

#targetBody .target-product .image-label span {
  color: #082f2a;
  font-size: 13px;
  font-weight: 850;
}

#targetBody input,
#targetBody select {
  border-color: rgba(0, 112, 92, 0.28);
  background: #fff;
  color: #071f24;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(0, 112, 92, 0.04);
}

#targetBody input:focus,
#targetBody select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 128, 112, 0.14);
  outline: none;
}

#targetBody .row-pick-button {
  color: #28585b;
  font-weight: 700;
}

.icon-button {
  width: 34px;
  min-height: 34px;
  padding: 0;
}

.raw-row {
  background: #fffaf4;
}

.target-row {
  background: #f3fbf8;
}

.muted {
  color: var(--muted);
}

.cultivation-summary {
  display: grid;
  gap: 2px;
  line-height: 1.35;
}

.cultivation-summary .muted {
  font-size: 12px;
}

.negative {
  color: var(--warn);
  font-weight: 700;
}

.blueprint {
  position: relative;
  min-height: 280px;
  overflow: auto;
  background:
    linear-gradient(#edf2f3 1px, transparent 1px),
    linear-gradient(90deg, #edf2f3 1px, transparent 1px),
    #fbfcfc;
  background-size: 24px 24px;
}

.facility-overlay {
  position: fixed;
  top: 72px;
  right: auto;
  z-index: 50;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(1240px, calc(100vw - 20px));
  height: min(620px, calc(100vh - 20px));
  max-height: min(620px, calc(100vh - 20px));
  overflow: hidden;
  border: 1px solid #b8ccd1;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 34px rgba(29, 45, 53, 0.18);
  backdrop-filter: blur(5px);
}

.facility-overlay.attention {
  animation: facility-overlay-attention 0.9s ease-out;
}

@keyframes facility-overlay-attention {
  0% {
    box-shadow: 0 0 0 0 rgba(31, 122, 107, 0.42), 0 14px 34px rgba(29, 45, 53, 0.18);
    transform: translateY(-4px);
  }
  45% {
    box-shadow: 0 0 0 8px rgba(31, 122, 107, 0.12), 0 18px 42px rgba(29, 45, 53, 0.24);
    border-color: var(--accent);
    transform: translateY(0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(31, 122, 107, 0), 0 14px 34px rgba(29, 45, 53, 0.18);
    transform: translateY(0);
  }
}

.facility-overlay.dragging {
  user-select: none;
}

.facility-overlay[hidden] {
  display: none !important;
}

.facility-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(234, 244, 245, 0.92);
  cursor: grab;
}

.facility-overlay.dragging .facility-overlay-header {
  cursor: grabbing;
}

.facility-overlay-close {
  width: 26px;
  min-height: 26px;
  padding: 0;
}

.facility-overlay-total {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.facility-overlay-total-main,
.facility-overlay-power-top {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.facility-overlay-total b {
  color: var(--text);
}

.facility-overlay-body {
  grid-row: 3;
  min-height: 0;
}

.facility-overlay-list {
  display: grid;
  max-height: 420px;
  overflow: auto;
}

.facility-overlay-row {
  display: grid;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 6px 9px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.facility-overlay-row:hover {
  background: #fff8e8;
}

.facility-overlay-main .image-label {
  min-width: 0;
}

.facility-overlay-main .image-label img {
  width: 28px;
  height: 28px;
}

.facility-overlay-main .image-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.facility-overlay-metrics {
  display: grid;
  gap: 1px;
  justify-items: end;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.facility-overlay-metrics b {
  color: var(--accent-strong);
  font-size: 13px;
}

.facility-overlay-detail {
  min-width: 0;
}

.facility-overlay-node-detail {
  grid-template-columns: minmax(0, 1fr);
}

.facility-overlay-node-meta {
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--line);
  background: #f9fbfb;
  color: var(--muted);
  font-size: 12px;
}

.facility-overlay-info {
  display: grid;
  gap: 8px;
  margin: 8px 0;
  padding: 8px;
  border: 1px solid var(--line);
  background: rgba(249, 251, 251, 0.78);
}

.facility-overlay-info .tooltip-meta {
  margin: 0;
}

.facility-overlay-trace-details {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 8px;
  border: 1px dashed rgba(31, 122, 107, 0.28);
  border-radius: 7px;
  background: rgba(248, 252, 251, 0.72);
}

.facility-overlay-trace-details > summary {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.facility-overlay-trace-details[open] > summary {
  margin-bottom: 8px;
}

.facility-overlay-trace-route-list {
  display: grid;
  gap: 5px;
  margin-bottom: 8px;
}

.facility-overlay-trace-route {
  grid-template-columns: minmax(0, 1fr) auto;
  background: rgba(255, 255, 255, 0.74);
}

.facility-overlay-trace-route span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.facility-overlay-lcr-candidates {
  display: grid;
  gap: 8px;
  margin: 8px 0;
  padding: 8px;
  border: 1px dashed rgba(125, 106, 176, 0.38);
  border-radius: 7px;
  background: rgba(248, 244, 255, 0.45);
}

.facility-overlay-lcr-candidates > strong {
  color: #6b5d91;
  font-size: 12px;
}

.facility-overlay-lcr-candidate {
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px solid rgba(125, 106, 176, 0.22);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.78);
}

.facility-overlay-lcr-head,
.facility-overlay-lcr-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
}

.facility-overlay-lcr-head {
  color: var(--muted);
  font-size: 12px;
}

.facility-overlay-lcr-head b {
  color: var(--accent-strong);
}

.facility-overlay-lcr-reactions .image-label img {
  width: 22px;
  height: 22px;
}

.facility-overlay-lcr-candidate dl {
  display: grid;
  gap: 5px;
  margin: 0;
  font-size: 12px;
}

.facility-overlay-lcr-candidate dl > div {
  display: grid;
  grid-template-columns: minmax(120px, max-content) minmax(0, 1fr);
  gap: 8px;
}

.facility-overlay-lcr-candidate dt {
  color: var(--accent-strong);
  font-weight: 700;
}

.facility-overlay-lcr-candidate dd {
  min-width: 0;
  margin: 0;
  color: var(--muted);
}

.facility-overlay-node-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.facility-overlay-node-metrics span {
  display: grid;
  gap: 2px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f9fbfb;
  padding: 7px 8px;
}

.facility-overlay-node-metrics small {
  color: var(--muted);
  font-size: 11px;
}

.facility-overlay-node-metrics b {
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.facility-overlay-node-metrics em {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.facility-overlay-node-metrics .facility-overlay-product {
  display: block;
  font-size: 13px;
}

.facility-overlay-product .image-label {
  min-width: 0;
}

.facility-overlay-product .image-label img {
  width: 26px;
  height: 26px;
}

.facility-overlay-product .image-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.facility-overlay-loop-note {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border: 1px dashed #b8ccd1;
  border-radius: 6px;
  background: #fbfdfd;
  color: var(--muted);
  font-size: 12px;
}

.facility-overlay-loop-note strong {
  color: var(--accent-strong);
  font-size: 13px;
}

.facility-overlay-cultivation-detail {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px dashed #b8ccd1;
  border-radius: 6px;
  background: #fbfdfd;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.facility-detail-line {
  display: grid;
  grid-template-columns: minmax(150px, max-content) minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
}

.facility-detail-line b {
  color: var(--accent-strong);
  font-weight: 700;
}

.facility-detail-line > span {
  min-width: 0;
}

.facility-overlay-empty {
  padding: 10px;
}

.blueprint-empty {
  padding: 18px;
  color: var(--muted);
}

.blueprint svg {
  position: absolute;
  inset: 0;
  pointer-events: auto;
}

.blueprint-group-frame {
  fill: rgba(125, 106, 176, 0.045);
  stroke: rgba(125, 106, 176, 0.55);
  stroke-width: 1.5;
  stroke-dasharray: 8 6;
}

.blueprint-group.active .blueprint-group-frame {
  fill: rgba(235, 248, 245, 0.5);
  stroke: var(--accent);
  stroke-dasharray: none;
}

.blueprint-group-hitbox {
  fill: rgba(255, 255, 255, 0.001);
  stroke: transparent;
  cursor: pointer;
  pointer-events: fill;
}

.blueprint-group text {
  fill: #6b5d91;
  font-size: 10px;
  font-weight: 600;
  paint-order: stroke;
  stroke: #fbfcfc;
  stroke-width: 3px;
  stroke-linejoin: round;
}

.blueprint-group-label {
  cursor: pointer;
  pointer-events: all;
}

.blueprint-group-label:hover {
  fill: var(--accent-strong);
  text-decoration: underline;
}

.blueprint-group.active .blueprint-group-label {
  fill: var(--accent-strong);
}

.lcr-toggle-button.active {
  border-color: var(--accent);
  background: #eaf8f5;
  color: var(--accent-strong);
}

.blueprint-legend {
  position: sticky;
  left: 8px;
  top: 8px;
  z-index: 2;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: calc(100% - 16px);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.6);
  padding: 5px 7px;
  color: var(--muted);
  font-size: 11px;
  backdrop-filter: blur(3px);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.legend-line {
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: #607d8b;
}

.legend-line.mineral {
  background: #8a6f47;
}

.legend-line.powder {
  background: #c2872d;
}

.legend-line.component {
  background: #2f6fba;
}

.legend-line.fluid {
  background: #188d8f;
}

.legend-line.organic {
  background: #6a8f2a;
}

.legend-line.waste {
  background: #7d6ab0;
}

.flow-line {
  fill: none;
  stroke: #607d8b;
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.78));
}

.flow-line.mineral {
  stroke: #8a6f47;
  stroke-width: 4;
}

.flow-line.powder {
  stroke: #c2872d;
  stroke-width: 4;
}

.flow-line.component {
  stroke: #2f6fba;
  stroke-width: 4;
}

.flow-line.fluid {
  stroke: #188d8f;
  stroke-width: 4.4;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.86)) drop-shadow(0 0 2px rgba(24, 141, 143, 0.18));
}

.flow-line.organic {
  stroke: #6a8f2a;
  stroke-width: 4;
}

.flow-line.waste {
  stroke: #7d6ab0;
  stroke-width: 4.2;
  stroke-dasharray: 7 5;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.84)) drop-shadow(0 0 2px rgba(125, 106, 176, 0.18));
}

.flow-line.shortcut {
  stroke-width: 3.2;
  stroke-dasharray: 3 4;
}

.flow-line.mineral,
.flow-line.powder,
.flow-line.component,
.flow-line.organic {
  stroke-linecap: butt;
}

.blueprint-edge:not(.blueprint-edge-jump) .flow-line.mineral,
.blueprint-edge:not(.blueprint-edge-jump) .flow-line.powder,
.blueprint-edge:not(.blueprint-edge-jump) .flow-line.component,
.blueprint-edge:not(.blueprint-edge-jump) .flow-line.organic {
  stroke-dasharray: 18 3;
}

.blueprint-edge.flow-provisional .flow-line {
  stroke: #c98522;
  stroke-width: 4.2;
  stroke-dasharray: 8 4;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.86)) drop-shadow(0 0 3px rgba(201, 133, 34, 0.22));
}

.blueprint-edge.flow-reused .flow-line.reference,
.blueprint-edge.flow-reused .flow-line.shortcut {
  stroke: #7d6ab0;
  stroke-width: 3.8;
  stroke-dasharray: 7 3 2 3;
}

.blueprint-edge.flow-disposal .flow-line,
.blueprint-edge.flow-manual-discard .flow-line {
  stroke: #7d6ab0;
  stroke-width: 4;
  stroke-dasharray: 6 5;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.86)) drop-shadow(0 0 3px rgba(125, 106, 176, 0.2));
}

.blueprint-edge.flow-manual-discard .flow-line {
  stroke: #586f7c;
  stroke-dasharray: 8 3 2 3;
}

.flow-label {
  fill: #455a64;
  font-size: 11px;
  paint-order: normal;
  stroke: none;
}

.flow-label-bg {
  fill: rgba(252, 254, 254, 0.9);
  stroke: rgba(143, 167, 174, 0.45);
  stroke-width: 1px;
}

.blueprint-edge,
.blueprint-edge .flow-label,
.blueprint-edge .flow-label-bg,
.blueprint-edge .flow-line,
.blueprint-edge-jump,
.blueprint-node .node-main[data-blueprint-jump-node] {
  cursor: pointer;
}

.blueprint-edge {
  pointer-events: auto;
}

.blueprint-edge .flow-line {
  pointer-events: stroke;
}

.blueprint-edge-input-ingress {
  pointer-events: none;
}

.flow-line.input-ingress {
  stroke-width: 4;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.86));
}

.blueprint-edge-jump {
  pointer-events: auto;
}

.blueprint-edge-jump .flow-line {
  pointer-events: stroke;
}

.blueprint-edge .flow-label {
  pointer-events: bounding-box;
}

.blueprint-edge .flow-label-bg {
  pointer-events: all;
}

.blueprint-edge-jump .flow-label {
  text-decoration: underline;
  text-decoration-style: dotted;
}

.blueprint-edge-jump .flow-label-bg {
  fill: rgba(248, 244, 255, 0.82);
  stroke: rgba(125, 106, 176, 0.34);
}

.blueprint-edge-jump .flow-label {
  fill: #6f5ca2;
}

.blueprint-edge-reuse-selectable .flow-line.reference {
  stroke-dasharray: 7 3 2 3;
  stroke-width: 3.2;
}

.blueprint-edge-reuse-selectable .flow-label-bg {
  fill: rgba(255, 250, 238, 0.96);
  stroke: rgba(198, 126, 24, 0.52);
  stroke-width: 1.2px;
}

.blueprint-edge-reuse-selectable .flow-label {
  fill: #8a5a12;
  font-weight: 700;
  text-decoration: none;
}

.blueprint-edge-reuse-selectable:hover .flow-label-bg {
  fill: rgba(255, 244, 221, 0.98);
  stroke: rgba(198, 126, 24, 0.78);
}

.blueprint-edge-reuse-selectable:hover .flow-label {
  fill: #6f4300;
}

.blueprint-edge-jump:hover .flow-line {
  stroke-width: 3.5;
}

.blueprint-edge.focus-pulse .flow-line {
  animation: blueprint-edge-focus-pulse 0.55s ease-out 2;
}

.blueprint-edge.focus-pulse .flow-label {
  animation: blueprint-label-focus-pulse 0.55s ease-out 2;
}

.blueprint-edge .flow-label:hover,
.blueprint-edge .flow-label-bg:hover + .flow-label,
.blueprint-edge-jump:hover .flow-label,
.blueprint-node .node-main[data-blueprint-jump-node]:hover {
  color: var(--accent-strong);
  fill: var(--accent-strong);
}

.blueprint.reuse-pick-mode .blueprint-node {
  opacity: 0.38;
}

.blueprint.reuse-pick-mode .blueprint-edge {
  opacity: 0.28;
}

.blueprint.reuse-pick-mode .blueprint-node.reuse-pick-candidate,
.blueprint.reuse-pick-mode .blueprint-node.reuse-pick-source,
.blueprint.reuse-pick-mode .blueprint-node.focused {
  opacity: 1;
}

.blueprint.reuse-pick-mode .blueprint-edge.focus-pulse {
  opacity: 1;
}

.blueprint-node.reuse-pick-candidate {
  cursor: crosshair;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 128, 112, 0.16), 0 10px 22px rgba(22, 60, 64, 0.14);
}

.blueprint-node.reuse-pick-source {
  box-shadow: 0 0 0 2px rgba(125, 106, 176, 0.18), 0 8px 18px rgba(22, 60, 64, 0.12);
}

.blueprint-reuse-picker {
  position: fixed;
  z-index: 90;
  width: min(760px, calc(100vw - 32px));
  min-width: min(620px, calc(100vw - 32px));
  min-height: 180px;
  padding: 10px;
  border: 1px solid rgba(0, 128, 112, 0.32);
  border-radius: 8px;
  background: rgba(252, 254, 254, 0.96);
  box-sizing: border-box;
  box-shadow: 0 14px 30px rgba(32, 53, 58, 0.18);
}

.blueprint-reuse-picker-head,
.blueprint-reuse-picker-target {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.blueprint-reuse-picker-head {
  margin: -4px -4px 0;
  padding: 4px;
  border-radius: 6px;
  cursor: move;
  user-select: none;
}

.blueprint-reuse-picker-head:hover,
.blueprint-reuse-picker.dragging .blueprint-reuse-picker-head {
  background: rgba(0, 128, 112, 0.06);
}

.blueprint-reuse-picker-head strong {
  color: var(--accent-strong);
}

.blueprint-reuse-picker-target {
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(0, 128, 112, 0.08);
}

.blueprint-reuse-picker p {
  margin: 8px 0;
  color: var(--muted);
  font-size: 12px;
}

.blueprint-reuse-picker-actions {
  display: grid;
  gap: 6px;
}

.blueprint-reuse-flow-slice .byproduct-route-flow {
  margin-top: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.blueprint-reuse-flow-slice .byproduct-route-flow-head span {
  display: none;
}

.blueprint-reuse-flow-slice .byproduct-route-flow-grid {
  grid-template-columns: 1fr;
  gap: 6px;
}

.blueprint-reuse-flow-slice .byproduct-route-option-row {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) repeat(4, 92px);
  gap: 6px;
  align-items: center;
}

.blueprint-reuse-flow-slice .byproduct-route-option-head {
  display: grid;
  align-items: end;
  padding: 0 8px 0 10px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
}

.blueprint-reuse-flow-slice .byproduct-route-option {
  min-height: 48px;
  gap: 8px;
}

.blueprint-reuse-flow-slice .byproduct-route-option .blueprint-reuse-preview,
.blueprint-reuse-flow-slice .byproduct-route-option .blueprint-reuse-preview-grid {
  display: contents;
}

.blueprint-reuse-flow-slice .byproduct-route-option .byproduct-trade-equivalent {
  grid-column: 1 / 2;
  grid-row: 2;
  align-self: start;
}

.blueprint-reuse-flow-slice .byproduct-route-option .byproduct-route-overflow {
  grid-column: 2 / -1;
  grid-row: 2;
  align-self: start;
}

.blueprint-reuse-flow-slice .byproduct-route-option > small,
.blueprint-reuse-flow-slice .byproduct-route-option > b {
  display: none;
}

.blueprint-reuse-picker-actions button {
  justify-content: space-between;
  min-height: 34px;
  text-align: left;
}

.blueprint-reuse-choice-main {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.blueprint-reuse-choice-hint {
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(0, 128, 112, 0.08);
  color: var(--accent-strong);
  font-size: 11px;
  white-space: nowrap;
}

.blueprint-reuse-picker-actions button.selected {
  border-color: var(--accent);
  background: rgba(0, 128, 112, 0.1);
  color: var(--accent-strong);
}

.blueprint-reuse-preview {
  margin-top: 8px;
  padding: 8px;
  border: 1px dashed rgba(0, 128, 112, 0.28);
  border-radius: 6px;
  background: rgba(240, 250, 248, 0.86);
}

.blueprint-reuse-preview-title {
  margin-bottom: 5px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
}

.blueprint-reuse-preview-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  align-items: center;
  font-size: 12px;
}

.blueprint-reuse-preview-grid strong.good,
.blueprint-reuse-preview-hints span {
  color: var(--accent-strong);
}

.blueprint-reuse-preview-grid strong.warn {
  color: var(--danger);
}

.blueprint-reuse-preview-grid strong {
  display: inline-flex;
  gap: 4px;
  align-items: baseline;
  justify-content: flex-end;
  white-space: nowrap;
}

.blueprint-reuse-preview-grid strong small {
  font-size: 10px;
  font-weight: 700;
}

.blueprint-reuse-preview-grid strong small.good {
  color: var(--accent-strong);
}

.blueprint-reuse-preview-grid strong small.warn {
  color: var(--danger);
}

.blueprint-reuse-preview-metric {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.blueprint-reuse-preview-metric > small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.blueprint-reuse-preview-grid .blueprint-reuse-preview-metric > strong {
  justify-content: flex-start;
}

.blueprint-reuse-flow-slice .blueprint-reuse-preview-grid,
.byproduct-route-option .blueprint-reuse-preview-grid {
  grid-template-columns: repeat(4, minmax(70px, max-content));
  gap: 4px 12px;
  align-items: start;
}

.blueprint-reuse-flow-slice .blueprint-reuse-preview {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.blueprint-reuse-flow-slice .blueprint-reuse-preview-metric {
  justify-self: start;
}

.blueprint-reuse-flow-slice .blueprint-reuse-preview-metric > small {
  display: none;
}

.blueprint-reuse-preview-overflow {
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px dashed rgba(0, 128, 112, 0.22);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.blueprint-reuse-preview-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.blueprint-reuse-preview-hints span {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(0, 128, 112, 0.08);
  font-size: 11px;
  font-weight: 700;
}

.blueprint-reuse-resize-handle {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
}

.blueprint-reuse-resize-handle::before {
  content: "";
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 8px;
  height: 8px;
  border-right: 2px solid rgba(0, 128, 112, 0.45);
  border-bottom: 2px solid rgba(0, 128, 112, 0.45);
  border-radius: 1px;
}

.blueprint-reuse-picker.resizing {
  user-select: none;
}

.shortcut-label {
  font-size: 10px;
}

.reference-label {
  fill: #7a669f;
  font-size: 9px;
  font-weight: 600;
}

.flow-label-bg.reference-label {
  fill: rgba(250, 247, 255, 0.74);
  stroke: rgba(125, 106, 176, 0.28);
  stroke-dasharray: 2 2;
}

.blueprint-label-hover-layer {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}

.blueprint-hover-label {
  position: absolute;
  max-width: 260px;
  padding: 2px 7px;
  border: 1px solid rgba(31, 122, 107, 0.34);
  border-radius: 4px;
  background: rgba(252, 254, 254, 0.98);
  box-shadow: 0 5px 14px rgba(29, 45, 53, 0.18);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  transform: translate(-2px, -50%);
}

.blueprint-hover-label.reference {
  border-color: rgba(125, 106, 176, 0.36);
  background: rgba(250, 247, 255, 0.98);
  color: #6f5ca2;
}

.blueprint-node {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  border: 1px solid rgba(142, 168, 174, 0.86);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(226, 236, 236, 0.9) 0, rgba(243, 248, 247, 0.95) 20px, rgba(235, 242, 241, 0.95) 100%),
    linear-gradient(135deg, rgba(24, 64, 74, 0.09), rgba(255, 255, 255, 0) 58%),
    #edf4f3;
  padding: 0;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(44, 70, 76, 0.05),
    0 8px 18px rgba(23, 60, 72, 0.1);
  cursor: pointer;
  overflow: hidden;
}

.blueprint-node.raw {
  background:
    linear-gradient(180deg, rgba(239, 230, 216, 0.92) 0, rgba(251, 246, 238, 0.95) 20px, rgba(246, 238, 226, 0.95) 100%),
    linear-gradient(135deg, rgba(138, 111, 71, 0.14), rgba(255, 255, 255, 0) 58%),
    #f6eddf;
}

.blueprint-node.external-supply {
  border-color: #148078;
  background:
    linear-gradient(180deg, rgba(213, 235, 230, 0.92) 0, rgba(236, 248, 244, 0.95) 20px, rgba(224, 243, 238, 0.95) 100%),
    linear-gradient(135deg, rgba(20, 128, 120, 0.14), rgba(255, 255, 255, 0) 58%),
    #e4f4f0;
}

.blueprint-node.integrated-internal {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.82);
  opacity: 0.82;
}

.blueprint-node.target {
  border-color: var(--accent);
  background:
    linear-gradient(180deg, rgba(210, 234, 228, 0.92) 0, rgba(236, 248, 244, 0.95) 20px, rgba(224, 243, 237, 0.95) 100%),
    linear-gradient(135deg, rgba(0, 128, 112, 0.15), rgba(255, 255, 255, 0) 58%),
    #e2f3ee;
}

.blueprint-node.focused {
  border-color: #d68b00;
  box-shadow: 0 0 0 3px rgba(214, 139, 0, 0.2), 0 10px 28px rgba(20, 41, 48, 0.16);
}

.blueprint-node.focus-pulse {
  animation: blueprint-focus-pulse 0.55s ease-out 2;
}

.blueprint-node.stop-impact-source {
  border-color: #b42318;
  background: #fff3f0;
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.16), 0 10px 28px rgba(20, 41, 48, 0.16);
}

.blueprint-node.stop-impact-affected {
  border-color: #d68b00;
  background: #fff8e8;
}

.blueprint-node.stop-impact-critical {
  border-color: #b42318;
  background: #fff0f0;
}

.blueprint-edge.stop-impact-edge .flow-line {
  stroke-width: 4;
  filter: drop-shadow(0 0 5px rgba(180, 35, 24, 0.45));
}

.blueprint-edge.stop-impact-edge .flow-label {
  fill: #8f1f15;
  font-weight: 800;
}

.blueprint-edge.stop-impact-edge .flow-label-bg {
  fill: #fff1ed;
  stroke: #e2a09a;
}

.blueprint-edge.stop-impact-limiting .flow-line {
  stroke: #b42318;
  stroke-width: 4.5;
  filter: drop-shadow(0 0 6px rgba(180, 35, 24, 0.48));
}

.blueprint-edge.stop-impact-limiting .flow-label {
  fill: #8f1f15;
  font-weight: 850;
}

.blueprint-edge.stop-impact-limiting .flow-label-bg {
  fill: #fff1ed;
  stroke: #d96a61;
}

.blueprint-edge.stop-impact-surplus .flow-line {
  stroke: #0f766e;
  stroke-width: 3.5;
  stroke-dasharray: 7 5;
  filter: drop-shadow(0 0 5px rgba(15, 118, 110, 0.32));
}

.blueprint-edge.stop-impact-surplus .flow-label {
  fill: #0f5f59;
  font-weight: 750;
}

.blueprint-edge.stop-impact-surplus .flow-label-bg {
  fill: #ecfdf7;
  stroke: #7dd3c7;
}

@keyframes blueprint-focus-pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(214, 139, 0, 0.55), 0 10px 28px rgba(20, 41, 48, 0.16);
  }
  48% {
    transform: scale(1.035);
    box-shadow: 0 0 0 8px rgba(214, 139, 0, 0.28), 0 14px 34px rgba(20, 41, 48, 0.2);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 3px rgba(214, 139, 0, 0.2), 0 10px 28px rgba(20, 41, 48, 0.16);
  }
}

@keyframes blueprint-edge-focus-pulse {
  0% {
    stroke-width: 2.5;
    filter: none;
  }
  48% {
    stroke-width: 6;
    filter: drop-shadow(0 0 6px rgba(214, 139, 0, 0.65));
  }
  100% {
    stroke-width: 2.5;
    filter: none;
  }
}

@keyframes blueprint-label-focus-pulse {
  0% {
    fill: currentColor;
  }
  48% {
    fill: #d68b00;
  }
  100% {
    fill: currentColor;
  }
}

.blueprint-node.waste {
  background:
    linear-gradient(180deg, rgba(229, 224, 244, 0.92) 0, rgba(247, 245, 253, 0.95) 20px, rgba(240, 236, 251, 0.95) 100%),
    linear-gradient(135deg, rgba(125, 106, 176, 0.14), rgba(255, 255, 255, 0) 58%),
    #f0ecfb;
  border-color: #b9acd8;
}

.blueprint-node.shortcut-input {
  background:
    linear-gradient(180deg, rgba(226, 236, 236, 0.9) 0, rgba(243, 248, 247, 0.95) 20px, rgba(235, 242, 241, 0.95) 100%),
    linear-gradient(135deg, rgba(29, 71, 82, 0.09), rgba(255, 255, 255, 0) 58%),
    #edf4f3;
  border-color: rgba(142, 168, 174, 0.86);
}

.blueprint-node.missing-provider {
  border-color: #d68b00;
  background:
    linear-gradient(180deg, rgba(248, 230, 197, 0.92) 0, rgba(255, 247, 229, 0.95) 20px, rgba(251, 238, 211, 0.95) 100%),
    linear-gradient(135deg, rgba(214, 139, 0, 0.17), rgba(255, 255, 255, 0) 58%),
    #faebce;
  box-shadow: 0 2px 8px rgba(214, 139, 0, 0.14);
}

.blueprint-node.missing-provider .node-title {
  grid-template-columns: minmax(0, 1fr);
  color: #9a6500;
}

.blueprint-node.missing-provider .node-subdetail {
  color: #9a6500;
  font-size: 10px;
  font-weight: 700;
}

.blueprint-node.reuse-unassigned {
  border-color: #d68b00;
  background:
    linear-gradient(180deg, rgba(248, 232, 204, 0.92) 0, rgba(255, 249, 233, 0.95) 20px, rgba(252, 241, 219, 0.95) 100%),
    linear-gradient(135deg, rgba(214, 139, 0, 0.16), rgba(255, 255, 255, 0) 58%),
    #faefd8;
  box-shadow: 0 2px 8px rgba(214, 139, 0, 0.12);
}

.blueprint-node.reuse-unassigned .node-title {
  grid-template-columns: minmax(0, 1fr);
  color: #9a6500;
}

.blueprint-node.reuse-unassigned .node-subdetail {
  color: #9a6500;
  font-size: 10px;
  font-weight: 700;
}

.blueprint-node.assumed-external-supply {
  border-color: #d7c4a4;
  background: #fffaf1;
  box-shadow: 0 2px 8px rgba(138, 114, 78, 0.1);
  cursor: pointer;
}

.blueprint-node.assumed-external-supply .node-title,
.blueprint-node.assumed-external-supply .node-subdetail {
  color: #7a6040;
}

.blueprint-node.assumed-external-supply .node-title {
  grid-template-columns: 18px minmax(0, 1fr);
}

.blueprint-node .node-top {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  display: flex;
  min-width: 0;
  color: #48616a;
  font-size: 10px;
  pointer-events: auto;
}

.blueprint-node .node-title {
  display: inline-flex;
  align-items: center;
  max-width: 76px;
  padding: 2px 5px;
  border: 1px solid rgba(178, 199, 204, 0.72);
  border-radius: 999px;
  background: rgba(248, 251, 251, 0.88);
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.blueprint-node.raw .node-top {
  color: #73572f;
}

.blueprint-node.target .node-top,
.blueprint-node.external-supply .node-top {
  color: #0f665e;
}

.blueprint-node.waste .node-top {
  color: #5d4a8a;
}

.blueprint-node.missing-provider .node-top,
.blueprint-node.reuse-unassigned .node-top,
.blueprint-node.assumed-external-supply .node-top {
  color: #8a5e19;
}

.blueprint-node .node-badges {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  min-width: 0;
}

.blueprint-node .node-badge {
  display: inline-flex;
  align-items: center;
  max-width: 58px;
  padding: 1px 5px;
  border: 1px solid #d7b780;
  border-radius: 999px;
  background: rgba(255, 247, 225, 0.92);
  color: #7a5a22;
  font-size: 9px;
  font-weight: 750;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.blueprint-node.assumed-external-supply .node-badge.assumed {
  border-color: #c99a4a;
  background: rgba(255, 241, 207, 0.96);
  color: #7b5518;
}

.node-title-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  border-radius: 4px;
  background: #eef3f3;
}

.node-facility-corner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(178, 199, 204, 0.7);
  border-radius: 6px;
  background: rgba(248, 251, 251, 0.92);
  box-shadow: 0 1px 4px rgba(20, 41, 48, 0.08);
}

.node-facility-corner .node-title-icon {
  width: 20px;
  height: 20px;
}

.blueprint-node .node-main {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  min-width: 0;
  padding: 7px 5px 4px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  overflow: hidden;
}

.blueprint-node .node-main .image-label {
  position: relative;
  display: flex;
  min-height: 0;
  width: 100%;
  height: 100%;
  gap: 3px;
  flex-direction: column;
  justify-content: center;
}

.blueprint-node .node-main .image-label img {
  width: min(86px, 92%);
  height: min(86px, 92%);
  margin: 0 auto;
  border-radius: 8px;
  background: transparent;
  transform: scale(1.12);
  transform-origin: center;
}

.blueprint-node .node-main .image-label span {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 0;
  display: -webkit-box;
  max-width: calc(100% - 8px);
  padding: 1px 3px 2px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.7);
  color: #101820;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.08;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.94),
    1px 0 0 rgba(255, 255, 255, 0.82),
    -1px 0 0 rgba(255, 255, 255, 0.82);
}

.blueprint-node .node-status-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 0 6px 5px;
}

.blueprint-node .node-subdetail {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stop-impact-panel {
  margin-top: 8px;
  border: 1px solid #d7b4a8;
  border-radius: 6px;
  background: #fffaf7;
  box-shadow: 0 6px 18px rgba(36, 24, 20, 0.08);
  overflow: hidden;
}

.stop-impact-head,
.stop-impact-summary,
.stop-impact-section {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid #f0d8cf;
}

.stop-impact-head {
  justify-content: space-between;
  background: #fff4ee;
}

.stop-impact-head strong {
  margin-right: auto;
}

.stop-impact-head .small-button {
  padding: 4px 8px;
  border: 1px solid #d7b4a8;
  border-radius: 5px;
  background: #fff;
  color: #87513f;
  font-size: 12px;
  font-weight: 700;
}

.stop-impact-summary {
  justify-content: space-between;
  flex-wrap: wrap;
}

.stop-impact-summary > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.stop-impact-control {
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr) minmax(74px, auto);
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid #f0d8cf;
  color: #87513f;
  font-size: 12px;
  font-weight: 700;
}

.stop-impact-control input[type="range"] {
  width: 100%;
  accent-color: #b42318;
}

.stop-impact-control b {
  color: #8f1f15;
  text-align: right;
}

.stop-impact-control.compact {
  flex: 1;
  min-width: 260px;
  padding: 0;
  border-bottom: 0;
  background: transparent;
}

.stop-impact-scenario-list {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid #f0d8cf;
}

.stop-impact-scenario-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid #ecd0c5;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
}

.stop-impact-scenario-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 180px;
  max-width: 260px;
}

.stop-impact-scenario-item small {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stop-impact-label {
  color: #87513f;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.stop-impact-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.stop-impact-chip {
  display: inline-grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 2px 6px;
  padding: 4px 7px;
  border: 1px solid #ecd0c5;
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
}

.stop-impact-chip.critical {
  border-color: #e5a19a;
  background: #fff1ef;
}

.stop-impact-chip .image-label {
  grid-row: span 2;
}

.stop-impact-chip b {
  color: #8f1f15;
}

.stop-impact-chip small {
  color: var(--muted);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stop-impact-note,
.stop-impact-warning {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
}

.stop-impact-warning {
  color: #8f1f15;
  font-weight: 700;
}

.blueprint-solution {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  background: #fbfcfc;
  overflow: auto;
}

.blueprint-solution-heading {
  position: sticky;
  left: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.solver-canvas {
  position: relative;
  min-width: 100%;
  min-height: 240px;
  background:
    linear-gradient(#edf2f3 1px, transparent 1px),
    linear-gradient(90deg, #edf2f3 1px, transparent 1px),
    #fbfcfc;
  background-size: 34px 34px;
}

.solver-warning-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.solver-canvas svg {
  position: absolute;
  inset: 0;
  pointer-events: auto;
}

.solver-node {
  position: absolute;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 2px;
  min-width: 0;
  border: 1px solid #b9cbd0;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.94);
  padding: 5px;
  box-shadow: 0 2px 8px rgba(23, 32, 36, 0.08);
  cursor: pointer;
}

.solver-node.raw {
  background: #fffaf4;
}

.solver-node.target {
  border-color: var(--accent);
  background: #f3fbf8;
}

.solver-node.focused {
  border-color: #d68b00;
  box-shadow: 0 0 0 3px rgba(214, 139, 0, 0.2), 0 10px 28px rgba(20, 41, 48, 0.16);
}

.solver-node.focus-pulse {
  animation: blueprint-focus-pulse 0.55s ease-out 2;
}

.solver-node.shortcut-input {
  border-color: #a9c6df;
  background: #f7fbff;
}

.solver-node-title {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  color: #415158;
  font-size: 10px;
  font-weight: 700;
}

.solver-node-title.no-icon {
  grid-template-columns: minmax(0, 1fr);
}

.solver-node-title img,
.solver-node-item .image-label img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  border-radius: 4px;
  background: #eef3f3;
}

.solver-node-title span,
.solver-node-item .image-label span,
.solver-node-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.solver-node-item {
  display: flex;
  align-items: center;
  min-width: 0;
  font-size: 10px;
}

.solver-node-item .image-label {
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 4px;
  min-height: 20px;
  min-width: 0;
}

.solver-node-meta {
  color: var(--muted);
  font-size: 8px;
}

.solver-route-cell {
  fill: #607d8b;
  opacity: 0.78;
  cursor: pointer;
  pointer-events: all;
}

.solver-route-arrow {
  fill: #607d8b;
  opacity: 0.95;
  cursor: pointer;
  pointer-events: all;
}

.solver-route-cell.mineral,
.solver-route-arrow.mineral {
  fill: #8a6f47;
}

.solver-route-cell.powder,
.solver-route-arrow.powder {
  fill: #c2872d;
}

.solver-route-cell.component,
.solver-route-arrow.component {
  fill: #2f6fba;
}

.solver-route-cell.fluid,
.solver-route-arrow.fluid {
  fill: #188d8f;
}

.solver-route-cell.organic,
.solver-route-arrow.organic {
  fill: #6a8f2a;
}

.solver-route-cell.waste,
.solver-route-arrow.waste {
  fill: #7d6ab0;
}

.solver-route-cell.default,
.solver-route-arrow.default {
  fill: #607d8b;
}

.solver-flow-label {
  fill: #455a64;
  font-size: 10px;
  paint-order: stroke;
  stroke: #fbfcfc;
  stroke-width: 5px;
  stroke-linejoin: round;
  cursor: pointer;
  pointer-events: all;
}

.solver-edge.focus-pulse .solver-route-cell,
.solver-edge.focus-pulse .solver-route-arrow {
  animation: solver-route-focus-pulse 0.55s ease-out 2;
}

.solver-edge.focus-pulse .solver-flow-label {
  animation: blueprint-label-focus-pulse 0.55s ease-out 2;
}

@keyframes solver-route-focus-pulse {
  0% {
    filter: none;
  }
  48% {
    filter: drop-shadow(0 0 7px rgba(214, 139, 0, 0.78));
  }
  100% {
    filter: none;
  }
}

.reference-search {
  width: min(360px, 100%);
}

.reference-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 14px;
  padding: 14px;
}

.reference-card {
  min-width: 0;
}

.reference-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.reference-table {
  max-height: 42vh;
  overflow: auto;
  border: 1px solid var(--line);
}

.reference-chip-cell {
  max-width: 320px;
}

.reference-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-height: 62px;
  overflow: hidden;
}

.reference-chip {
  display: inline-grid;
  grid-template-columns: 18px auto;
  align-items: center;
  gap: 4px;
  max-width: 150px;
  border: 1px solid #d7e2e5;
  border-radius: 6px;
  background: #f7fafa;
  padding: 2px 5px 2px 3px;
  font-size: 11px;
}

.reference-chip img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  border-radius: 4px;
  background: #eef3f3;
}

.reference-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.reference-chip-more {
  align-self: center;
  color: var(--muted);
  font-size: 11px;
}

.reference-meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 4px;
}

.reference-meta-tags span {
  padding: 1px 5px;
  border: 1px solid rgba(0, 112, 92, 0.16);
  border-radius: 999px;
  background: rgba(238, 248, 245, 0.78);
  color: var(--accent-strong);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .layout {
    padding: 14px;
  }

  .app-header,
  .toolbar,
  .summary-grid,
  .reference-grid,
  .trade-layout,
  .trade-inputs,
  .diff-columns {
    grid-template-columns: 1fr;
  }

  .app-header {
    display: grid;
  }

  .header-actions {
    justify-content: start;
  }

  .status-line {
    text-align: left;
  }

  .target-product {
    grid-template-columns: 1fr;
  }

  .target-picker {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .trade-inputs .trade-preset-control {
    grid-template-columns: 1fr;
  }
}
