#main{
  width: 92%;
  max-width: 1200px;
  margin: 0 auto;
}

#search_div{
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 16px;
}

#search_field{
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 6px;
}

#search_field:focus{
  outline: none;
  border-color: #f29900;
  box-shadow: 0 0 0 3px rgba(242, 153, 0, 0.2);
}

#search_status{
  font-size: 13px;
  color: #555;
  min-height: 18px;
}

#search_status.busy::after{
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 8px;
  border: 2px solid #f29900;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

@keyframes spin{ to{ transform: rotate(360deg); } }

.results{
  max-height: 65vh;
  overflow-y: auto;
  margin-bottom: 60px;
}

.results table{
  margin: 8px 0;
}

tr.clickable{
  cursor: pointer;
}

tr.clickable:hover > td{
  background: #fff4e0;
}

tr.clickable.open > td{
  background: #ffe7bf;
  font-weight: 600;
}

.patient_row td::before{
  content: '▸';
  display: inline-block;
  width: 16px;
  color: #f29900;
}

.patient_row.open td::before{
  content: '▾';
}

.count{
  float: right;
  font-size: 12px;
  font-weight: normal;
  color: #777;
}

tr.detail_row > td{
  background: #fafafa;
  padding: 4px 12px 8px 24px;
}

.documents_table th{
  background-color: #1e88e5;
}

.items_table th{
  background-color: #546e7a;
}

.documents_table td,
.items_table td{
  font-weight: normal;
}

.items_table th:nth-child(1){ width: 30%; }
.items_table th:nth-child(3){ width: 12%; }

td.qty{
  text-align: center;
}

mark{
  background: #ffe082;
  padding: 0 1px;
}

@media (max-width: 700px){
  #main{ width: auto; margin: 0 16px; }
  tr.detail_row > td{ padding: 4px 4px 8px 8px; }
  .count{ float: none; display: block; }
}
