.order-fee-filter-heading,
.order-fee-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
}

.order-fee-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-inline-start: auto;
}

.order-fee-filter-heading {
  margin-bottom: 10px;
}

.order-fee-filter-heading h2 {
  margin: 0;
  font-size: .95rem;
}

.order-fee-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 10px 14px;
  padding-bottom: 12px;
}

.order-fee-filters[hidden] {
  display: none;
}

.order-fee-filters > label,
.order-fee-date {
  display: grid;
  min-width: 0;
  gap: 4px;
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--subtle);
  font-size: .8125rem;
}

.order-fee-date legend {
  margin-bottom: 4px;
  padding: 0;
}

.order-fee-date > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 4px;
}

.order-fee-filters :is(input, select) {
  width: 100%;
  min-width: 0;
  color: var(--ink);
}

.order-fee-date input {
  padding-inline: 5px;
}

.order-fee-toolbar {
  margin-bottom: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.order-fee-booking-tabs {
  align-items: center;
  margin: 0;
  padding: 0;
  border: 0;
}

.order-fee-booking-tabs > span {
  margin-right: 6px;
  color: var(--subtle);
  white-space: nowrap;
}

@container (max-width: 980px) {
  .order-fee-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@container (max-width: 720px) {
  .order-fee-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@container (max-width: 470px) {
  .order-fee-filters { grid-template-columns: minmax(0, 1fr); }
}

.order-fees .tablewrap table {
  min-width: 1080px;
}

.order-fees-focused .tablewrap table {
  min-width: 580px;
}

.order-fees td:nth-child(2) {
  max-width: 230px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.order-fees :is(th, td):nth-child(n+9):nth-child(-n+11) {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.order-fee-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 166px;
}

.order-fee-actions button {
  white-space: nowrap;
}

.order-fee-message,
.order-fee-notice {
  margin: 10px 0;
  padding: 8px 10px;
  border-radius: var(--radius);
}

.order-fee-message {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.order-fee-notice {
  background: #fff4dd;
  color: #76511d;
}

.order-fee-dialog {
  width: min(700px, calc(100vw - 28px));
}

.order-fee-reference {
  margin: -4px 0 14px;
  color: var(--subtle);
  overflow-wrap: anywhere;
}

.order-fee-dialog .actions {
  flex-wrap: wrap;
  margin-top: 16px;
}

.order-fee-fields,
.order-fee-detail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.order-fee-dialog label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.order-fee-dialog select {
  width: 100%;
  min-width: 0;
}

.order-fee-supplier {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 8px;
}

.order-fee-template-picker {
  grid-column: 1 / -1;
}

.order-fee-detail {
  margin: 0;
}

.order-fee-detail > div {
  border-bottom: 1px solid var(--line-soft);
  padding: 0 0 6px;
}

.order-fee-detail dt {
  color: var(--subtle);
  font-size: .8rem;
}

.order-fee-detail dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

.order-fee-dialog h3 {
  margin: 16px 0 6px;
  font-size: .9rem;
}

.order-fee-error {
  color: #a22527;
}

@media (max-width: 520px) {
  .order-fee-dialog {
    padding: 14px;
  }

  .order-fee-fields,
  .order-fee-supplier {
    grid-template-columns: minmax(0, 1fr);
  }

  .order-fee-supplier {
    border-bottom: 1px solid var(--line-soft);
    padding-bottom: 8px;
  }

  .order-fee-supplier button {
    justify-self: start;
  }

  .order-fee-dialog :is(button, input, select) {
    min-height: 40px;
  }
}
