.targets .target { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.targets .target:first-child { padding-top: 0; }
.targets .target:last-child { border-bottom: 0; }
.targets .target > .name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
.targets .target.active { padding: 10px; border: 1px solid #385b55; border-radius: 10px; background: #1b3333; }
.targets .target + .target.active { margin-top: 8px; }
.targets .target button.name { justify-content: flex-start; padding: 0; border: 0; background: none; color: inherit; text-align: left; white-space: normal; }
.targets .target button.name:hover { color: var(--accent); }
.targets .target > button.danger { width: 30px; height: 30px; min-height: 30px; padding: 0; border-color: transparent; background: transparent; color: var(--muted); font-size: 20px; }
.targets .target > button.danger:hover { background: #3b2c30; color: var(--danger); }
.targets .target > .order { display: inline-flex; gap: 2px; }
.targets .target > .order button { width: 26px; height: 26px; min-height: 26px; padding: 0; border-color: transparent; background: transparent; color: var(--muted); font-size: 13px; }
.targets .target > .order button:hover:not(:disabled) { color: var(--accent); border-color: #466463; }
.name { display: inline-flex; align-items: center; gap: 8px; }
.empty { padding: 22px 16px; border: 1px dashed #3c5359; border-radius: 10px; color: var(--muted); font-size: 12px; line-height: 1.7; text-align: center; }

.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
table.steps { width: 100%; border-collapse: collapse; font-size: 12px; }
.steps th, .steps td { padding: 12px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.steps th { padding-top: 10px; padding-bottom: 10px; background: var(--input); color: var(--muted); font-size: 10px; font-weight: 400; white-space: nowrap; }
.steps tbody tr:last-child td { border-bottom: 0; }
.steps tbody tr:hover { background: #1b2b30; }
.steps td:first-child { width: 34px; color: var(--accent); font: 11px var(--mono); }
.steps .name { min-width: 140px; }
.steps .name > span:not(.icon):not(.badge) { max-width: 230px; }
.steps th.num, .steps td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.steps td.actions { text-align: right; }
.badge { border: 1px solid #6e5940; border-radius: 4px; padding: 0 5px; color: var(--warm); background: #3a332b; font-size: 9px; }
.machine { margin-top: 6px; padding-left: 32px; color: var(--muted); font-size: 10px; }
select.recipe { min-height: 25px; max-width: 220px; padding: 2px 5px; border-color: transparent; border-radius: 5px; background: var(--input); color: var(--muted); font-size: 10px; }
select.recipe:hover { border-color: var(--border); color: var(--text); }
.ingr { display: inline-flex; align-items: center; gap: 3px; margin: 3px 6px 3px 0; color: #bdcdce; font-size: 11px; white-space: nowrap; }
#sm-steps-info { margin-top: 10px; font: 10px/1.5 var(--mono); }
#sm-steps-info:empty { display: none; }
.stock { display: flex; flex-wrap: wrap; gap: 8px; }
.stock .item { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--input); color: var(--muted); font-size: 11px; }
.stock .item b { color: var(--text); font-size: 13px; font-weight: 500; }
.warnings > div { margin-bottom: 12px; padding: 10px 12px; border: 1px solid #6e5940; border-radius: 8px; background: #3a332b; color: var(--warm); font-size: 12px; }
.warnings:empty { display: none; }

.preview-canvas { border: 1px solid var(--border); border-radius: 10px; background-color: var(--input); background-image: radial-gradient(#344b51 .7px, transparent .7px); background-size: 16px 16px; }

.fields { display: flex; flex-wrap: wrap; align-items: end; gap: 18px; margin-top: 16px; }
.fields > label:not(.check) { display: grid; gap: 7px; color: var(--muted); font-size: 11px; }
.fields input[type="number"] { width: 110px; }
.fields .check { align-self: center; margin: 20px 0 0; }
.preview-canvas { margin-top: 22px; padding: 16px 18px; }
.preview-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.preview-heading h3 { margin: 0; color: var(--muted); font-size: 10px; font-weight: 400; text-transform: uppercase; letter-spacing: .1em; }
.preview-scale { color: var(--muted); font: 10px var(--mono); }
.gauge-preview { display: flex; align-items: center; gap: 12px; min-height: 32px; }
.gauge-preview > span:last-child:not(.icon) { color: var(--text); font: 16px var(--mono); }
.gauge-bar { position: relative; flex-shrink: 1; width: calc(var(--cells, 22) * 11px); max-width: 100%; height: 18px; overflow: hidden; border-radius: 3px; background-color: var(--panel2); background-image: radial-gradient(var(--muted) .8px, transparent .9px); background-size: 4px 4px; }
.gauge-bar .fill { position: absolute; top: 0; bottom: 0; left: 0; transition: width .12s; }

@media (min-width: 981px) and (max-width: 1200px), (max-width: 640px) {
  .targets .target { display: grid; grid-template-columns: 32px minmax(0, 1fr) 76px 30px; gap: 10px 8px; }
  .targets .target > .name { grid-column: 2; }
  .targets .target > .quality { grid-column: 2; grid-row: 2; justify-self: start; }
  .targets .target > .order { grid-column: 3 / -1; grid-row: 2; justify-self: end; }
  .targets .target > input { grid-column: 3; grid-row: 1; width: 76px; }
  .targets .target > button.danger { grid-column: 4; grid-row: 1; }
  #g-signal .target { grid-template-columns: 32px minmax(0, 1fr); }
  #g-signal .target > .quality { grid-column: 2; }
}

@media (max-width: 640px) {
  .fields { gap: 14px; }
  .fields .check { width: 100%; margin-top: 0; }
  .preview-canvas { padding: 14px; }
  .table-scroll { margin-right: -2px; }
  .steps th, .steps td { padding: 10px 8px; }
}

.codec { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
.codec textarea { min-height: 360px; }
.codec textarea.json { white-space: pre; overflow: auto; overflow-wrap: normal; tab-size: 4; }
.codec .export-actions button + button { margin-left: 0; }
button.flip .ui-icon { transform: scaleX(-1); }

@media (max-width: 980px) {
  .codec { grid-template-columns: 1fr; gap: 20px; }
}

@media (max-width: 640px) {
  .codec { gap: 16px; }
  .codec textarea { min-height: 240px; }
}

/* Parameters tab: result and report below the two inputs */
.stack { display: grid; gap: 24px; margin-top: 24px; }
.param { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 4px; background: #5b2d8a; color: #fff; font: 11px var(--mono); }
.steps td.usage { font: 10px/1.6 var(--mono); color: var(--muted); white-space: nowrap; }
.steps tr.new td { background: #2b2a1f; }
.steps tr.unused td { color: var(--muted); }
.missing h3 { margin: 14px 0 4px; font-size: 12px; }
.missing ul { margin: 0; padding-left: 18px; font-size: 12px; line-height: 1.7; }
.missing p { margin: 12px 0 0; font-size: 12px; }
@media (max-width: 640px) { .stack { gap: 16px; margin-top: 16px; } }
.steps input[type="text"] { width: 110px; min-height: 26px; padding: 2px 6px; font-size: 12px; }
.steps select { max-width: 150px; min-height: 26px; padding: 2px 4px; font-size: 11px; }
.steps .dependency, .steps .formula { display: inline-flex; align-items: center; gap: 4px; }
.steps .row-actions { display: inline-flex; gap: 2px; }
.steps .row-actions button, .missing button.small { padding: 1px 6px; min-height: 22px; font-size: 11px; }

/* Compressor tab: tier buttons and the tile preview */
.fields > .tier { display: grid; gap: 7px; color: var(--muted); font-size: 11px; }
.cmp-preview { margin-top: 16px; overflow-x: auto; }
.cmp-preview svg { display: block; max-width: 100%; height: auto; }
.cmp-svg .belt { fill: var(--panel2); stroke: var(--border); }
.cmp-svg .belt.in { stroke: var(--accent); }
.cmp-svg .belt.out { stroke: #e0b55a; }
.cmp-svg .splitter { fill: var(--accent-soft); stroke: var(--accent); }
.cmp-svg .arrow { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.cmp-svg .splitter + .arrow { stroke: var(--accent); }
.cmp-info { margin: 12px 0 0; font: 11px var(--mono); }

/* Trains tab: info line under the Madzuri fields */
.tr-info { margin: 12px 0 0; font: 11px var(--mono); }
