.legend {
  max-width: 900px;
  margin: 0 auto 2rem;
}

.legend h2 {
  font-size: 1.1rem;
  color: var(--subtle);
  margin-bottom: 0.6rem;
}

#legend-table, #trains-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border-radius: 8px;
  overflow: hidden;
}

#legend-table th, #legend-table td,
#trains-table th, #trains-table td {
  padding: 0.5rem 0.7rem;
  text-align: left;
  border-bottom: 1px solid #2a333a;
  font-size: 0.88rem;
}

#legend-table th, #trains-table th {
  color: var(--subtle);
  font-weight: 600;
  background: #161c20;
}

#trains-table th {
  cursor: pointer;
  user-select: none;
}

#trains-table th:hover {
  color: var(--accent);
}

#legend-body tr {
  cursor: pointer;
}

#legend-body tr:hover {
  background: #202932;
}

#legend-body tr.filter-active {
  background: rgba(232, 65, 44, 0.15);
  outline: 1px solid var(--accent);
}

.legend label {
  margin-right: 0.6rem;
  font-size: 0.82rem;
  color: var(--subtle);
  cursor: pointer;
}

.legend input[type="radio"] {
  margin-right: 0.2rem;
}

.legend-count {
  font-weight: 600;
}

#classification-status {
  margin-top: 0.5rem;
  min-height: 1.2em;
}

.trains-section {
  max-width: 700px;
  margin: 0 auto;
}

.controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}

#search-box {
  flex: 1;
  min-width: 200px;
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid #2a333a;
  border-radius: 6px;
  padding: 0.5rem 0.8rem;
  font-size: 0.9rem;
}
