.balanced-line:empty {
  display: none;
}

[data-table-panel][data-stale],
[data-stats][data-stale] {
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 150ms ease;
}

.reaction-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

.reaction-table th {
  padding: 0 10px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.reaction-table .group-head th:first-child {
  padding-left: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.reaction-table tbody + tbody .group-head th {
  padding-top: var(--space-6);
}

.reaction-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.reaction-table td:first-child {
  padding-left: 0;
}

.reaction-table td:last-child {
  padding-right: 0;
}

.reaction-table tbody tr:last-child td {
  border-bottom: 0;
}

.reaction-table .number {
  text-align: right;
  white-space: nowrap;
}

.reaction-table td small {
  display: block;
  color: var(--text-subtle);
  font-size: 12px;
}

.species-cell {
  width: 24%;
  min-width: 190px;
}

.species-formula {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 600;
}

.species-formula sub,
.species-formula sup {
  font-size: 0.68em;
  line-height: 0;
}

.species-formula .coefficient {
  margin-right: 2px;
  color: var(--accent-text);
}

.reaction-table .match-input {
  height: 30px;
  font-size: 13px;
}

.match-note {
  display: block;
  margin-top: 4px;
  color: var(--warning);
  font-size: 12px;
  line-height: 1.4;
}

.reaction-table .input-group {
  min-width: 150px;
}

.reaction-table [name="density"] {
  min-width: 96px;
  padding-right: 44px;
}

.status-cell {
  width: 17%;
  min-width: 150px;
}

.status-cell .badge {
  white-space: nowrap;
}

.reaction-table tr.is-limiting td {
  background: var(--accent-soft);
}

.reaction-table tr.is-limiting td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
  padding-left: 10px;
}

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

.yield-high {
  color: var(--warning);
}

[data-table-panel] .panel-header {
  flex-wrap: wrap;
}

@media (max-width: 560px) {
  [data-stats] .stat:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .reaction-table .input-group,
  .reaction-table [name="density"] {
    min-width: 0;
  }

  .reaction-table,
  .reaction-table tbody,
  .reaction-table td {
    display: block;
  }

  .reaction-table .group-head {
    display: block;
  }

  .reaction-table .group-head th {
    display: none;
  }

  .reaction-table .group-head th:first-child {
    display: block;
    padding: 0 0 var(--space-3);
    border: 0;
  }

  .reaction-table tbody + tbody .group-head th:first-child {
    padding-top: var(--space-5);
  }

  .reaction-table tr[data-species] {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-flow: dense;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-large);
  }

  .reaction-table tr.is-limiting {
    border-color: var(--accent-border);
    background: var(--accent-soft);
  }

  .reaction-table tr.is-limiting td,
  .reaction-table tr.is-limiting td:first-child {
    padding: 0;
    background: none;
    box-shadow: none;
  }

  .reaction-table td {
    min-width: 0;
    padding: 0;
    border: 0;
  }

  .reaction-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 12px;
  }

  .reaction-table td:empty {
    display: none;
  }

  .reaction-table .number {
    text-align: left;
  }

  .species-cell,
  .status-cell,
  .reaction-table td:nth-child(3) {
    grid-column: 1 / -1;
    width: auto;
    min-width: 0;
  }

  .species-cell::before {
    display: none !important;
  }
}
