.routing-control {
  display: grid;
  grid-template-columns: 1fr 440px;
  gap: 32px;
  padding: 28px;
  background: #fff;
  border: 1px solid #dde4ee;
  border-radius: 16px;
  margin-bottom: 22px;
}
.routing-control h2 {
  font-size: 22px;
  margin: 10px 0;
}
.routing-control p {
  max-width: 580px;
  color: #64748b;
  line-height: 1.6;
  margin: 0;
}
.route-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: center;
}
.overflow-control {
  grid-column: 1 / -1;
  display: grid;
  gap: 18px;
  border-top: 1px solid #e3e8ee;
  padding-top: 24px;
}
.overflow-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 17px;
  cursor: pointer;
}
.overflow-toggle input {
  width: 22px;
  height: 22px;
  min-height: 22px;
  margin: 0;
  accent-color: #183d39;
}
.overflow-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 240px) auto;
  gap: 16px;
  align-items: end;
}
.overflow-fields input,
.overflow-fields select {
  min-width: 0;
  width: 100%;
}
.routing-control .overflow-help {
  max-width: 900px;
  font-size: 15px;
}
@media (max-width: 700px) {
  .overflow-fields {
    grid-template-columns: 1fr;
  }
}
.mode-option {
  background: #f8fafc !important;
  color: #334155 !important;
  border: 1px solid #dce3ee !important;
  border-radius: 12px;
  padding: 18px 14px !important;
  text-align: left;
  font-size: 16px;
}
.mode-option small {
  display: block;
  margin-top: 8px;
  font-weight: 400;
  color: #64748b;
}
.mode-option.selected {
  background: #eff4ff !important;
  border-color: #6484d7 !important;
  color: #254baa !important;
  box-shadow: 0 0 0 1px #6484d7;
}
.gateway-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 24px 0;
  color: #64748b;
  font-size: 15px;
}
.gateway-summary span:last-child {
  margin-left: auto;
}
.gateway-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}
.gateway-card {
  padding: 26px;
  background: white;
  border: 1px solid #dce4ef;
  border-radius: 16px;
  box-shadow: 0 3px 14px #182b4c04;
}
.gateway-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}
.gateway-head h2 {
  font-size: 20px;
  margin: 0 0 8px;
}
.gateway-card small {
  font-size: 15px;
  color: #748398;
  line-height: 1.5;
}
.gateway-badge {
  font-size: 14px;
  padding: 7px 10px;
  border-radius: 8px;
  background: #f1f4f8;
  color: #64748b;
  white-space: nowrap;
}
.gateway-badge.selected {
  background: #eaf1ff;
  color: #3459b5;
}
.gateway-endpoint {
  color: #7a8ba1;
  font-size: 15px;
  overflow-wrap: anywhere;
  margin: 14px 0 22px;
}
.gateway-health {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 18px;
  font-size: 15px;
  border-top: 1px solid #edf0f5;
  padding: 16px 0;
}
.gateway-health small {
  width: 100%;
}
.good {
  color: #25866c;
}
.bad {
  color: #bf5151 !important;
}
.gateway-stats {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 20px;
  margin: 10px 0 16px;
}
.gateway-stats small,
.gateway-stats strong {
  display: block;
}
.gateway-stats strong {
  font-size: 28px;
  font-weight: 600;
  color: #1e2b43;
  margin: 10px 0;
}
.gateway-stats small:first-child {
  font-size: 14px;
  letter-spacing: 1px;
}
.gateway-card progress {
  width: 100%;
  height: 5px;
  accent-color: #5279cb;
  border: none;
  display: block;
  margin-bottom: 22px;
}
.gateway-balance {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  padding: 16px;
  background: #f7f9fc;
  border-radius: 10px;
  font-size: 15px;
}
.gateway-balance small {
  grid-column: 1/-1;
}
.gateway-limit {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 10px;
  margin-top: 22px;
}
.gateway-limit label {
  display: grid;
  gap: 8px;
  font-size: 15px;
  color: #536279;
}
.gateway-limit input {
  width: 100% !important;
  min-width: 0;
  border-radius: 8px !important;
  height: 40px;
}
.gateway-limit button {
  height: 40px;
  border-radius: 8px;
  background: #edf2fa;
  color: #345484;
  border: 1px solid #d6e0ee;
}
.gateway-limit > small {
  grid-column: 1/-1;
}
.gateway-actions {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 22px 0 0 !important;
  padding: 18px 0 0 !important;
  border-top: 1px solid #edf0f5;
  font-size: 15px;
}
.gateway-actions select {
  width: auto;
  min-width: 140px;
  border-radius: 8px;
}
.gateway-actions button {
  background: #4268b6;
  border-radius: 8px;
}
.gateway-actions small {
  text-align: right;
}
.gateway-card button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.gateway-card input:focus,
.gateway-card select:focus {
  outline: 2px solid #799be4;
  outline-offset: 2px;
}
@media (max-width: 1100px) {
  .routing-control {
    grid-template-columns: 1fr;
  }
  .gateway-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 650px) {
  .routing-control,
  .gateway-card {
    padding: 18px;
  }
  .gateway-summary span:last-child {
    margin-left: 0;
  }
  .route-modes {
    grid-template-columns: 1fr;
  }
  .gateway-actions {
    flex-wrap: wrap;
  }
}

.gateway-head {
  height: auto;
  border: 0;
  color: #22324b;
}
.gateway-head > div {
  display: block;
}
.gateway-card progress::-webkit-progress-bar {
  background: #edf1f6;
  border-radius: 8px;
}
.gateway-card progress::-webkit-progress-value {
  background: #5b80cf;
  border-radius: 8px;
}
@media (max-width: 650px) {
  nav {
    scrollbar-width: none;
  }
  nav::-webkit-scrollbar {
    display: none;
  }
}

#enrollment-result {
  padding: 24px;
  margin-bottom: 24px;
  border: 1px solid #b9cbea;
  background: #f7faff;
}
#enrollment-result p {
  line-height: 1.65;
  color: #536279;
}
#enrollment-result input {
  width: 100%;
  font-family: monospace;
  font-size: 16px;
  margin: 12px 0;
}
#add-node small {
  font-weight: 400;
  line-height: 1.5;
}
#add-node input {
  min-width: 0;
  width: 100%;
}
